Have some of the configuration section working and more updated to the database abstract.
authorChuck Scott <cscott@gaslightmedia.com>
Thu, 22 Jan 2015 00:50:08 +0000 (19:50 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Thu, 22 Jan 2015 00:50:08 +0000 (19:50 -0500)
35 files changed:
.gitignore [new file with mode: 0644]
activate.php
classes/data/dataCities.php [new file with mode: 0644]
classes/data/dataMemberTypes.php [new file with mode: 0644]
classes/data/dataMembers.php
classes/data/dataRegions.php [new file with mode: 0644]
classes/glmPluginSupport.php
config/colors.ini [new file with mode: 0644]
config/countries.ini [new file with mode: 0644]
config/plugin.ini [new file with mode: 0644]
config/states.ini [new file with mode: 0644]
controllers/admin.php
controllers/front.php
css/admin.css
defines.php
index.php
lib/GlmDataAbstract/DataAbstract.php
lib/GlmDataAbstract/documentation.txt
lib/smartyTemplateSupport.php
misc/databaseScripts/create_database_V0.1.sql
misc/databaseScripts/drop_database_V0.1.sql
models/admin/configure/cities.php [new file with mode: 0644]
models/admin/configure/memberTypes.php [new file with mode: 0644]
models/admin/configure/regions.php [new file with mode: 0644]
models/admin/member/index.php
models/admin/member/member.php
models/admin/members/index.php
models/admin/members/list.php
uninstall.php
views/admin/configure/cities.html [new file with mode: 0644]
views/admin/configure/header.html
views/admin/configure/memberTypes.html [new file with mode: 0644]
views/admin/configure/regions.html [new file with mode: 0644]
views/admin/member/index.html
views/admin/member/member.html

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..1ef30ec
--- /dev/null
@@ -0,0 +1,2 @@
+# Don't save smarty cache directories or files
+misc/smarty/*
\ No newline at end of file
index 9b25583..ef29d27 100644 (file)
@@ -126,8 +126,12 @@ class glmMembersPluginActivate extends glmPluginSupport
                  WHERE table_name like '".GLM_MEMBERS_PLUGIN_DB_PREFIX."%';
             ");
 
-            // Check if the number of tables is correct
-            if ($tables != $existingTables) {
+            // If there's no tables, just assume we need to install all new ones.
+            if ($existingTables == 0) {
+                $dbVersion = false;
+
+            // Otherwise check if the number of tables is correct
+            } elseif ($tables != $existingTables) {
                 $this->addNotice('We do not have the correct number of tables for the currently set database version (V'.$dbVersion.') for the '.GLM_MEMBERS_PLUGIN_NAME.'.');
                 $this->addNotice("There should be $tables but there are currently $existingTables. Please call for support.");
                 return false;
@@ -172,8 +176,8 @@ class glmMembersPluginActivate extends glmPluginSupport
 
             } else {
                 $this->addNotice('Failure installing database tables for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin.');
-                $this->addNotice('<small>'.print_r($queryError,1).'</small>');
-//                $this->addNotice('<p><small>'.print_r($q,1).'</small>');
+                $this->addNotice('<b>Database Installation Error:</b> '.print_r($queryError,1), 'Alert');
+                $this->addNotice($q, 'DataBlock', 'Database Installation Query');
             }
 
         // Otherwise, check if we need to update the database
@@ -232,7 +236,7 @@ class glmMembersPluginActivate extends glmPluginSupport
                         $this->addNotice('Failure updating the database tables for the '.GLM_MEMBERS_PLUGIN_NAME.' plugin '
                             .'from V'.$dbVersion.'_V'.$ver.'.');
                         $db_setup_status = false;
-                        $this->addNotice('ERROR: '.$queryError);
+                        $this->addNotice('<b>Database Update Error:</b> '.$queryError, 'Alert');
                     }
 
                 }
diff --git a/classes/data/dataCities.php b/classes/data/dataCities.php
new file mode 100644 (file)
index 0000000..ca27415
--- /dev/null
@@ -0,0 +1,133 @@
+<?php
+
+/**
+ * GLM Member-DB WordPress Plugin
+ * Cities data class
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package  GLM Member-DB
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  SVN: $Id: dataMemberType.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * EventManagementDataCities class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ *          @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ *          Exp $
+ * @link http://www.visitgreatlakesbay.org/
+ */
+abstract class GlmDataCities extends GlmDataAbstract
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Field definitions
+     *
+     * @var $ini
+     * @access public
+     */
+    public $table;
+
+    /**
+     * Field definitions
+     *
+     * 'type' is type of field as defined by the application
+     * text Regular text field
+     * pointer Pointer to an entry in another table
+     * 'filters' is the filter name for a particular filter ID in PHP filter
+     * functions
+     * See PHP filter_id()
+     *
+     * 'use' is when to use the field
+     * l = List
+     * g = Get
+     * n = New
+     * i = Insert
+     * e = Edit
+     * u = Update
+     * d = Delete
+     * a = All
+     *
+     * @var $ini
+     * @access public
+     */
+    public $fields = false;
+
+    /**
+     * Constructor
+     *
+     * @param object $d
+     *            database connection
+     *
+     * @return void
+     * @access public
+     */
+    function __construct ($wpdb, $config)
+    {
+        parent::__construct($wpdb, $config);
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        /*
+         * Table Name
+         */
+        $this->table = GLM_MEMBERS_PLUGIN_DB_PREFIX . 'cities';
+
+        /*
+         * Table Data Fields
+         */
+        $this->fields = array(
+
+                'id' => array(
+                        'field' => 'id',
+                        'type' => 'integer',
+                        'view_only' => true,
+                        'use' => 'a'
+                ),
+
+                // Name
+                'name' => array(
+                        'field' => 'name',
+                        'type' => 'text',
+                        'required' => true,
+                        'unique' => true,
+                        'use' => 'a'
+                )
+
+        );
+
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
+        }
+
+    }
+}
+
+?>
\ No newline at end of file
diff --git a/classes/data/dataMemberTypes.php b/classes/data/dataMemberTypes.php
new file mode 100644 (file)
index 0000000..6d0dde4
--- /dev/null
@@ -0,0 +1,141 @@
+<?php
+
+/**
+ * GLM Member-DB WordPress Plugin
+ * Member Type data class
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package  GLM Member-DB
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  SVN: $Id: dataMemberType.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * EventManagementDataMemberType class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ *          @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ *          Exp $
+ * @link http://www.visitgreatlakesbay.org/
+ */
+abstract class GlmDataMemberTypes extends GlmDataAbstract
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Field definitions
+     *
+     * @var $ini
+     * @access public
+     */
+    public $table;
+
+    /**
+     * Field definitions
+     *
+     * 'type' is type of field as defined by the application
+     * text Regular text field
+     * pointer Pointer to an entry in another table
+     * 'filters' is the filter name for a particular filter ID in PHP filter
+     * functions
+     * See PHP filter_id()
+     *
+     * 'use' is when to use the field
+     * l = List
+     * g = Get
+     * n = New
+     * i = Insert
+     * e = Edit
+     * u = Update
+     * d = Delete
+     * a = All
+     *
+     * @var $ini
+     * @access public
+     */
+    public $fields = false;
+
+    /**
+     * Constructor
+     *
+     * @param object $d
+     *            database connection
+     *
+     * @return void
+     * @access public
+     */
+    function __construct ($wpdb, $config)
+    {
+        parent::__construct($wpdb, $config);
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        /*
+         * Table Name
+         */
+        $this->table = GLM_MEMBERS_PLUGIN_DB_PREFIX . 'member_type';
+
+        /*
+         * Table Data Fields
+         */
+        $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'
+                )
+
+
+        );
+
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
+        }
+
+    }
+}
+
+?>
\ No newline at end of file
index 2ccb33e..e3484b9 100644 (file)
  */
 abstract class GlmDataMembers extends GlmDataAbstract {
 
-       /**
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
         * Field definitions
         *
         * @var $ini
@@ -69,11 +83,24 @@ abstract class GlmDataMembers extends GlmDataAbstract {
         * @return void
         * @access public
         */
-       function __construct($dbh, $config) {
-               parent::__construct ( $dbh, $config );
+       function __construct($wpdb, $config) {
+
+               parent::__construct ( $wpdb, $config );
+
+               // 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 (
@@ -83,14 +110,29 @@ abstract class GlmDataMembers extends GlmDataAbstract {
                                                'use' => 'a'
                                ),
 
-                               // Active
-                               'active' => array (
-                                               'field' => 'active',
-                                       'type' => 'checkbox',
+                               // Status
+                               'status' => array (
+                                               'field' => 'status',
+                                       'type' => 'list',
+                                       'list' => $this->config['status'],
+                                       'required' => true,
+                                       'default' => $this->config['status_numb']['Pending'],
                                        'use' => 'a'
                                ),
 
-                               // Member Name
+                               // 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,
+                                               'use' => 'a'
+                               ),
+
+                       // Member Name
                                'name' => array (
                                                'field' => 'name',
                                                'type' => 'text',
@@ -137,9 +179,14 @@ abstract class GlmDataMembers extends GlmDataAbstract {
                        )
 
 
-               )
-               //
-               ;
+               );
+
+               if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+                   glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
+               }
+
+
+
        }
 }
 
diff --git a/classes/data/dataRegions.php b/classes/data/dataRegions.php
new file mode 100644 (file)
index 0000000..df9a502
--- /dev/null
@@ -0,0 +1,148 @@
+<?php
+
+/**
+ * GLM Member-DB WordPress Plugin
+ * Regions data class
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package  GLM Member-DB
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  SVN: $Id: dataMemberType.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * EventManagementDataRegions class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package EventManagement
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ *          @release SVN: $Id: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ *          Exp $
+ * @link http://www.visitgreatlakesbay.org/
+ */
+abstract class GlmDataRegions extends GlmDataAbstract
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Field definitions
+     *
+     * @var $ini
+     * @access public
+     */
+    public $table;
+
+    /**
+     * Field definitions
+     *
+     * 'type' is type of field as defined by the application
+     * text Regular text field
+     * pointer Pointer to an entry in another table
+     * 'filters' is the filter name for a particular filter ID in PHP filter
+     * functions
+     * See PHP filter_id()
+     *
+     * 'use' is when to use the field
+     * l = List
+     * g = Get
+     * n = New
+     * i = Insert
+     * e = Edit
+     * u = Update
+     * d = Delete
+     * a = All
+     *
+     * @var $ini
+     * @access public
+     */
+    public $fields = false;
+
+    /**
+     * Constructor
+     *
+     * @param object $d
+     *            database connection
+     *
+     * @return void
+     * @access public
+     */
+    function __construct ($wpdb, $config)
+    {
+        parent::__construct($wpdb, $config);
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        /*
+         * Table Name
+         */
+        $this->table = GLM_MEMBERS_PLUGIN_DB_PREFIX . 'regions';
+
+        /*
+         * Table Data Fields
+         */
+        $this->fields = array(
+
+                'id' => array(
+                        'field' => 'id',
+                        'type' => 'integer',
+                        'view_only' => true,
+                        'use' => 'a'
+                ),
+
+                // Name
+                'name' => array(
+                        'field' => 'name',
+                        'type' => 'text',
+                        'required' => true,
+                        'unique' => true,
+                        'use' => 'a'
+                ),
+
+                // Description
+                'descr' => array(
+                        'field' => 'descr',
+                        'type' => 'text',
+                        'use' => 'a'
+                ),
+
+                // Short Description
+                'short_descr' => array(
+                        'field' => 'short_descr',
+                        'type' => 'text',
+                        'use' => 'a'
+                )
+
+
+        );
+
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice($this->fields, 'DataBlock', 'Table Fields: '.$this->table);
+        }
+
+    }
+}
+
+?>
\ No newline at end of file
index b7f4dd6..b7f9441 100644 (file)
@@ -23,23 +23,53 @@ class GlmPluginSupport
     /*
      * Add a message to the 'glmMembersAdminNotices' option for output later.
      *
+     * Messages that don't have a $type specified are displayed in
+     * the admin WordPress message area.
+     *
+     * Messages that have a $type are for the debug window and are categorized
+     * as follows and in this order in the debug window
+     *  Alert       Placed sequentially in the Alerts list
+     *  Process     Placed sequentially in the process list
+     *  DataBlock   Placed in a colored data block. Requires a $title
+     *
      * @param string $message
+     * @param string $type
+     * @param string $title
      *
      * @return void
      * @access public
      */
-    public static function addNotice ($message, $title = false)
+    public static function addNotice ($message, $type = false, $title = false)
     {
-        $notices = get_option('glmMembersAdminNotices');
 
-        // If there's a title, include that
-        $mes = $message;
-        if ($title) {
-            $mes = '<div class="glm-debug-section-title">'.$title.'</div><div class="glm-debug-section-body">'.$mes."</div>";
+        switch($type) {
+
+            case 'Alert';
+                $alerts = get_option('glmMembersAdminNoticeAlerts');
+                $alerts[] = $message;
+                update_option('glmMembersAdminNoticeAlerts', $alerts);
+                break;
+
+            case 'Process';
+                $process = get_option('glmMembersAdminNoticeProcess');
+                $process[] = $message;
+                update_option('glmMembersAdminNoticeProcess', $process);
+                break;
+
+            case 'DataBlock';
+                $dataBlocks = get_option('glmMembersAdminNoticeDataBlocks');
+                $dataBlocks[] = array('data' => $message, 'title' => $title);
+                update_option('glmMembersAdminNoticeDataBlocks', $dataBlocks);
+                break;
+
+            default;
+                $notices = get_option('glmMembersAdminNotices');
+                $notices[] = $message;
+                update_option('glmMembersAdminNotices', $notices);
+                break;
+
         }
 
-        $notices[] = $mes;
-        update_option('glmMembersAdminNotices', $notices);
     }
 
     /*
diff --git a/config/colors.ini b/config/colors.ini
new file mode 100644 (file)
index 0000000..82087c3
--- /dev/null
@@ -0,0 +1,120 @@
+;
+; Standard color names and codes
+; Gaslight Media Members Database Plugin 
+;
+
+[common]
+
+color[800000] = 'maroon'
+color[8B0000] = 'darkred'
+color[FF0000] = 'red'
+color[FFB6C1] = 'lightpink'
+color[DC143C] = 'crimson'
+color[DB7093] = 'palevioletred'
+color[FF69B4] = 'hotpink'
+color[FF1493] = 'deeppink'
+color[C71585] = 'mediumvioletred'
+color[800080] = 'purple'
+color[8B008B] = 'darkmagenta'
+color[DA70D6] = 'orchid'
+color[D8BFD8] = 'thistle'
+color[DDA0DD] = 'plum'
+color[EE82EE] = 'violet'
+color[FF00FF] = 'fuchsia'
+color[FF00FF] = 'magenta'
+color[BA55D3] = 'mediumorchid'
+color[9400D3] = 'darkviolet'
+color[9932CC] = 'darkorchid'
+color[8A2BE2] = 'blueviolet'
+color[4B0082] = 'indigo'
+color[9370DB] = 'mediumpurple'
+color[6A5ACD] = 'slateblue'
+color[7B68EE] = 'mediumslateblue'
+color[00008B] = 'darkblue'
+color[05367D] = 'mackinawblue'
+color[0000CD] = 'mediumblue'
+color[0000FF] = 'blue'
+color[000080] = 'navy'
+color[191970] = 'midnightblue'
+color[483D8B] = 'darkslateblue'
+color[4169E1] = 'royalblue'
+color[6495ED] = 'cornflowerblue'
+color[B0C4DE] = 'lightsteelblue'
+color[F0F8FF] = 'aliceblue'
+color[F8F8FF] = 'ghostwhite'
+color[E6E6FA] = 'lavender'
+color[1E90FF] = 'dodgerblue'
+color[4682B4] = 'steelblue'
+color[00BFFF] = 'deepskyblue'
+color[708090] = 'slategray'
+color[778899] = 'lightslategray'
+color[87CEFA] = 'lightskyblue'
+color[87CEEB] = 'skyblue'
+color[ADD8E6] = 'lightblue'
+color[008080] = 'teal'
+color[008B8B] = 'darkcyan'
+color[00CED1] = 'darkturquoise'
+color[00FFFF] = 'aqua'
+color[48D1CC] = 'mediumturquoise'
+color[5F9EA0] = 'cadetblue'
+color[AFEEEE] = 'paleturquoise'
+color[E0FFFF] = 'lightcyan'
+color[F0FFFF] = 'azure'
+color[20B2AA] = 'lightseagreen'
+color[40E0D0] = 'turquoise'
+color[B0E0E6] = 'powderblue'
+color[2F4F4F] = 'darkslategray'
+color[7FFFD4] = 'aquamarine'
+color[00FA9A] = 'mediumspringgreen'
+color[66CDAA] = 'mediumaquamarine'
+color[00FF7F] = 'springgreen'
+color[3CB371] = 'mediumseagreen'
+color[2E8B57] = 'seagreen'
+color[32CD32] = 'limegreen'
+color[006400] = 'darkgreen'
+color[008000] = 'green'
+color[00FF00] = 'lime'
+color[228B22] = 'forestgreen'
+color[8FBC8F] = 'darkseagreen'
+color[90EE90] = 'lightgreen'
+color[98FB98] = 'palegreen'
+color[F5FFFA] = 'mintcream'
+color[F0FFF0] = 'honeydew'
+color[7FFF00] = 'chartreuse'
+color[7CFC00] = 'lawngreen'
+color[6B8E23] = 'olivedrab'
+color[556B2F] = 'darkolivegreen'
+color[9ACD32] = 'yellowgreen'
+color[ADFF2F] = 'greenyellow'
+color[F5F5DC] = 'beige'
+color[FAF0E6] = 'linen'
+color[FAFAD2] = 'lightgoldenrodyellow'
+color[808000] = 'olive'
+color[FFFF00] = 'yellow'
+color[FFFFE0] = 'lightyellow'
+color[FFFFF0] = 'ivory'
+color[BDB76B] = 'darkkhaki'
+color[F0E68C] = 'khaki'
+color[EEE8AA] = 'palegoldenrod'
+color[F5DEB3] = 'wheat'
+color[FFD700] = 'gold'
+color[FFFACD] = 'lemonchiffon'
+color[FFEFD5] = 'papayawhip'
+color[B8860B] = 'darkgoldenrod'
+color[DAA520] = 'goldenrod'
+color[FAEBD7] = 'antiquewhite'
+color[FFF8DC] = 'cornsilk'
+color[FDF5E6] = 'oldlace'
+color[FFE4B5] = 'moccasin'
+color[FFDEAD] = 'navajowhite'
+color[FFA500] = 'orange'
+color[FFE4C4] = 'bisque'
+color[D2B48C] = 'tan'
+color[FF8C00] = 'darkorange'
+color[DEB887] = 'burlywood'
+color[8B4513] = 'saddlebrown'
+color[F4A460] = 'sandybrown'
+color[FFEBCD] = 'blanchedalmond'
+color[FFF0F5] = 'lavenderblush'
+color[FFF5EE] = 'seashell'
+color[FFFAF0] = 'floralwhite'
diff --git a/config/countries.ini b/config/countries.ini
new file mode 100644 (file)
index 0000000..cea0955
--- /dev/null
@@ -0,0 +1,247 @@
+;
+; Countries
+; Gaslight Media Members Database Plugin 
+;
+
+[common]
+
+countries[US] = "United States"
+countries[CA] = "Canada"
+countries[AF] = "Afghanistan"
+countries[AX] = "Land Islands"
+countries[AL] = "Albania"
+countries[DZ] = "Algeria"
+countries[AS] = "American Samoa"
+countries[AD] = "Andorra"
+countries[AO] = "Angola"
+countries[AI] = "Anguilla"
+countries[AQ] = "Antarctica"
+countries[AG] = "Antigua and Barbuda"
+countries[AR] = "Argentina"
+countries[AM] = "Armenia"
+countries[AW] = "Aruba"
+countries[AU] = "Australia"
+countries[AT] = "Austria"
+countries[AZ] = "Azerbaijan"
+countries[BS] = "Bahamas"
+countries[BH] = "Bahrain"
+countries[BD] = "Bangladesh"
+countries[BB] = "Barbados"
+countries[BY] = "Belarus"
+countries[BE] = "Belgium"
+countries[BZ] = "Belize"
+countries[BJ] = "Benin"
+countries[BM] = "Bermuda"
+countries[BT] = "Bhutan"
+countries[BO] = "Bolivia"
+countries[BA] = "Bosnia and Herzegovina"
+countries[BW] = "Botswana"
+countries[BV] = "Bouvet Island"
+countries[BR] = "Brazil"
+countries[IO] = "British Indian Ocean Territory"
+countries[BN] = "Brunei Darussalam"
+countries[BG] = "Bulgaria"
+countries[BF] = "Burkina Faso"
+countries[BI] = "Burundi"
+countries[KH] = "Cambodia"
+countries[CM] = "Cameroon"
+countries[CV] = "Cape Verde"
+countries[KY] = "Cayman Islands"
+countries[CF] = "Central African Republic"
+countries[TD] = "Chad"
+countries[CL] = "Chile"
+countries[CN] = "China"
+countries[CX] = "Christmas Island"
+countries[CC] = "Cocos (Keeling) Islands"
+countries[CO] = "Colombia"
+countries[KM] = "Comoros"
+countries[CG] = "Congo"
+countries[CD] = "Congo&#44; the Democratic Rep&#46; of"
+countries[CK] = "Cook Islands"
+countries[CR] = "Costa Rica"
+countries[CI] = "Cote D'Ivoire"
+countries[HR] = "Croatia"
+countries[CU] = "Cuba"
+countries[CY] = "Cyprus"
+countries[CZ] = "Czech Republic"
+countries[DK] = "Denmark"
+countries[DJ] = "Djibouti"
+countries[DM] = "Dominica"
+countries[DO] = "Dominican Republic"
+countries[EC] = "Ecuador"
+countries[EG] = "Egypt"
+countries[SV] = "El Salvador"
+countries[GQ] = "Equatorial Guinea"
+countries[ER] = "Eritrea"
+countries[EE] = "Estonia"
+countries[ET] = "Ethiopia"
+countries[FK] = "Falkland Islands (Malvinas)"
+countries[FO] = "Faroe Islands"
+countries[FJ] = "Fiji"
+countries[FI] = "Finland"
+countries[FR] = "France"
+countries[GF] = "French Guiana"
+countries[PF] = "French Polynesia"
+countries[TF] = "French Southern Territories"
+countries[GA] = "Gabon"
+countries[GM] = "Gambia"
+countries[GE] = "Georgia"
+countries[DE] = "Germany"
+countries[GH] = "Ghana"
+countries[GI] = "Gibraltar"
+countries[GR] = "Greece"
+countries[GL] = "Greenland"
+countries[GD] = "Grenada"
+countries[GP] = "Guadeloupe"
+countries[GU] = "Guam"
+countries[GT] = "Guatemala"
+countries[GN] = "Guinea"
+countries[GW] = "Guinea-Bissau"
+countries[GY] = "Guyana"
+countries[HT] = "Haiti"
+countries[HM] = "Heard Island&#44; McDonald Islands"
+countries[VA] = "Holy see (Vatican City State)"
+countries[HN] = "Honduras"
+countries[HK] = "Hong Kong"
+countries[HU] = "Hungary"
+countries[IS] = "Iceland"
+countries[IN] = "India"
+countries[ID] = "Indonesia"
+countries[IR] = "Iran&#44; Islamic Republic of"
+countries[IQ] = "Iraq"
+countries[IE] = "Ireland"
+countries[IL] = "Israel"
+countries[IT] = "Italy"
+countries[JM] = "Jamaica"
+countries[JP] = "Japan"
+countries[JO] = "Jordan"
+countries[KZ] = "Kazakhstan"
+countries[KE] = "Kenya"
+countries[KI] = "Kiribati"
+countries[KP] = "Korea&#44; Democratic People's Rep&#46; of"
+countries[KR] = "Korea&#44; Republic of"
+countries[KW] = "Kuwait"
+countries[KG] = "Kyrgyzstan"
+countries[LA] = "Lao People's Democratic Republic"
+countries[LV] = "Latvia"
+countries[LB] = "Lebanon"
+countries[LS] = "Lesotho"
+countries[LR] = "Liberia"
+countries[LY] = "Libyan Arab Jamahiriya"
+countries[LI] = "Liechtenstein"
+countries[LT] = "Lithuania"
+countries[LU] = "Luxembourg"
+countries[MO] = "Macao"
+countries[MK] = "Macedonia&#44; the Former Yugoslav Rep&#46;"
+countries[MG] = "Madagascar"
+countries[MW] = "Malawi"
+countries[MY] = "Malaysia"
+countries[MV] = "Maldives"
+countries[ML] = "Mali"
+countries[MT] = "Malta"
+countries[MH] = "Marshall Islands"
+countries[MQ] = "Martinique"
+countries[MR] = "Mauritania"
+countries[MU] = "Mauritius"
+countries[YT] = "Mayotte"
+countries[MX] = "Mexico"
+countries[FM] = "Micronesia&#44; Federated States of"
+countries[MD] = "Moldova&#44; Republic of"
+countries[MC] = "Monaco"
+countries[MN] = "Mongolia"
+countries[MS] = "Montserrat"
+countries[MA] = "Morocco"
+countries[MZ] = "Mozambique"
+countries[MM] = "Myanmar"
+countries[NA] = "Namibia"
+countries[NR] = "Nauru"
+countries[NP] = "Nepal"
+countries[NL] = "Netherlands"
+countries[AN] = "Netherlands Antilles"
+countries[NC] = "New Caledonia"
+countries[NZ] = "New Zealand"
+countries[NI] = "Nicaragua"
+countries[NE] = "Niger"
+countries[NG] = "Nigeria"
+countries[NU] = "Niue"
+countries[NF] = "Norfolk Island"
+countries[MP] = "Northern Mariana Islands"
+countries[NO] = "Norway"
+countries[OM] = "Oman"
+countries[PK] = "Pakistan"
+countries[PW] = "Palau"
+countries[PS] = "Palestinian Territory&#44; Occupied"
+countries[PA] = "Panama"
+countries[PG] = "Papua New Guinea"
+countries[PY] = "Paraguay"
+countries[PE] = "Peru"
+countries[PH] = "Philippines"
+countries[PN] = "Pitcairn"
+countries[PL] = "Poland"
+countries[PT] = "Portugal"
+countries[PR] = "Puerto Rico"
+countries[QA] = "Qatar"
+countries[RE] = "Reunion"
+countries[RO] = "Romania"
+countries[RU] = "Russian Federation"
+countries[RW] = "Rwanda"
+countries[SH] = "Saint Helena"
+countries[KN] = "Saint Kitts and Nevis"
+countries[LC] = "Saint Lucia"
+countries[PM] = "Saint Pierre and Miquelon"
+countries[VC] = "Saint Vincent and the Grenadines"
+countries[WS] = "Samoa"
+countries[SM] = "San Marino"
+countries[ST] = "Sao Tome and Principe"
+countries[SA] = "Saudi Arabia"
+countries[SN] = "Senegal"
+countries[CS] = "Serbia and Montenegro"
+countries[SC] = "Seychelles"
+countries[SL] = "Sierra Leone"
+countries[SG] = "Singapore"
+countries[SK] = "Slovakia"
+countries[SI] = "Slovenia"
+countries[SB] = "Solomon Islands"
+countries[SO] = "Somalia"
+countries[ZA] = "South Africa"
+countries[GS] = "South Georgia&#44; South Sandwich Islands"
+countries[ES] = "Spain"
+countries[LK] = "Sri Lanka"
+countries[SD] = "Sudan"
+countries[SR] = "Suriname"
+countries[SJ] = "Svalbard and Jan Mayen"
+countries[SZ] = "Swaziland"
+countries[SE] = "Sweden"
+countries[CH] = "Switzerland"
+countries[SY] = "Syrian Arab Republic"
+countries[TW] = "Taiwan&#44; Province of China"
+countries[TJ] = "Tajikistan"
+countries[TZ] = "Tanzania&#44; United Republic of"
+countries[TH] = "Thailand"
+countries[TL] = "Timor-Leste"
+countries[TG] = "Togo"
+countries[TK] = "Tokelau"
+countries[TO] = "Tonga"
+countries[TT] = "Trinidad and Tobago"
+countries[TN] = "Tunisia"
+countries[TR] = "Turkey"
+countries[TM] = "Turkmenistan"
+countries[TC] = "Turks and Caicos Islands"
+countries[TV] = "Tuvalu"
+countries[UG] = "Uganda"
+countries[UA] = "Ukraine"
+countries[AE] = "United Arab Emirates"
+countries[GB] = "United Kingdom"
+countries[UM] = "United States minor outlying islands"
+countries[UY] = "Uruguay"
+countries[UZ] = "Uzbekistan"
+countries[VU] = "Vanuatu"
+countries[VE] = "Venezuela"
+countries[VN] = "Viet Nam"
+countries[VG] = "Virgin Islands&#44; British"
+countries[VI] = "Virgin Islands&#44; U&#46;S&#46;"
+countries[WF] = "Wallis and Futuna"
+countries[EH] = "Western Sahara"
+countries[YE] = "Yemen"
+countries[ZM] = "Zambia"
+countries[ZW] = "Zimbabwe"
diff --git a/config/plugin.ini b/config/plugin.ini
new file mode 100644 (file)
index 0000000..914cc45
--- /dev/null
@@ -0,0 +1,157 @@
+;
+; Main Configuration File
+; Gaslight Media Members Database Plugin 
+;
+; Custom configurations for development and developer configuration at bottom of file.
+;
+
+[common]
+
+;
+; Entry Status Types
+;
+status[10] = 'Active'
+status[20] = 'Inactive'
+status[30] = 'Pending Review'
+status[40] = 'Archived'
+
+status_numb['None'] = 0
+status_numb['Active'] = 10
+status_numb['Inactive'] = 20
+status_numb['Pending'] = 30
+status_numb['Archived'] = 40
+
+;
+; Entity Reference Type
+;
+ref_type[0] = 'None'
+ref_type[10] = 'Member'
+ref_type[20] = 'Location'
+ref_type[30] = 'Facility'
+ref_type[40] = 'Activity'
+ref_type[50] = 'Golf'
+ref_type[60] = 'Restaurant'
+ref_type[70] = 'Contact'
+
+ref_type_numb['None'] = 0
+ref_type_numb['Member'] = 10
+ref_type_numb['Location'] = 20
+ref_type_numb['Facility'] = 30
+ref_type_numb['Activity'] = 40
+ref_type_numb['Golf'] = 50
+ref_type_numb['Restaurant'] = 60
+ref_type_numb['Contact']  = 70
+
+;
+; Facility Type
+;
+facility_type[0] = 'None'
+facility_type[10] = 'Hotel - Motel'
+facility_type[20] = 'Bed and Breakfast'
+facility_type[30] = 'Restaurant'
+facility_type[40] = 'Golf'
+
+facility_type_numb['None'] = 0
+facility_type_numb['HotelMotel'] = 10
+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
+
+;
+; Invoice Delivery
+;
+invoice_delivery[0] = 'None'
+invoice_delivery[10] = 'E-Mail'
+invoice_delivery[20] = 'US Mail'
+invoice_delivery[30] = 'FAX'
+invoice_delivery[40] = 'Hand'
+
+invoice_delivery_numb['None'] = 0
+invoice_delivery_numb['Email'] = 10
+invoice_delivery_numb['USPS'] = 20
+invoice_delivery_numb['FAX'] = 30
+invoice_delivery_numb['Hand'] = 40
+
+;
+; Payment Type
+;
+payment_type[0] = 'None'
+payment_type[10] = 'Upon Arrival'
+payment_type[20] = 'Corporate Account'
+payment_type[30] = 'Check By Mail'
+payment_type[40] = 'Credit Card'
+payment_type[50] = 'Debit Card'
+payment_type[60] = 'PayPal'
+
+payment_type_numb['None'] = 0
+payment_type_numb['UponArrival'] = 10
+payment_type_numb['CorpAccount'] = 20
+payment_type_numb['CheckByMail'] = 30
+payment_type_numb['CreditCard'] = 40
+payment_type_numb['DebitCard'] = 50
+payment_type_numb['PayPal'] = 60
+
+; Days of the week - numbers are an exponent of 2 that represent the bit position
+days[0] = "Sunday"
+days[1] = "Monday"
+days[2] = "Tuesday"
+days[3] = "Wednesday"
+days[4] = "Thursday"
+days[5] = "Friday"
+days[6] = "Saturday"
+
+;
+; Common Terms/Phrases
+;
+
+; Admin Menus
+term['term_admin_menu_members'] = 'Members'
+term['term_admin_menu_member'] = 'Member'
+term['term_admin_menu_configure'] = 'Configure'
+
+; General Terms
+term['term_member'] = 'member'
+term['term_member_cap'] = 'Member'
+term['term_member_plur'] = 'members'
+term['term_member_plur_cap'] = 'Members'
+
+term['term_location'] = 'location'
+term['term_location_cap'] = 'Location'
+term['term_location_plur'] = 'locations'
+term['term_location_plur_cap'] = 'Locations'
+
+term['term_facility'] = 'facility'
+term['term_facility_cap'] = 'Facility'
+term['term_facility_plur'] = 'facilities'
+term['term_facility_plur_cap'] = 'Facilities'
+
+term['term_attraction'] = 'attraction'
+term['term_attraction_cap'] = 'Attraction'
+term['term_attraction_plur'] = 'attractions'
+term['term_attraction_plur_cap'] = 'Attractions'
+
+term['term_contact'] = 'contact'
+term['term_contact_cap'] = 'Contact'
+term['term_contact_plur'] = 'contacts'
+term['term_contact_plur_cap'] = 'Contacts'
+
+; Phrases
+phrase['phrase_test'] = 'test'
+
+
+[development:common]
+
+
+[chuck:common]
+
diff --git a/config/states.ini b/config/states.ini
new file mode 100644 (file)
index 0000000..b36d888
--- /dev/null
@@ -0,0 +1,77 @@
+;
+; States
+; Gaslight Media Members Database Plugin 
+;
+
+[common]
+states['AL'] = 'Alabama'
+states['AK'] = 'Alaska'
+states['AB'] = 'Alberta'
+states['AZ'] = 'Arizona'
+states['AR'] = 'Arkansas'
+states['BC'] = 'British Columbia'
+states['CA'] = 'California'
+states['CO'] = 'Colorado'
+states['CT'] = 'Connecticut'
+states['DE'] = 'Delaware'
+states['DC'] = 'District of Columbia'
+states['FL'] = 'Florida'
+states['GA'] = 'Georgia'
+states['GU'] = 'Guam'
+states['HI'] = 'Hawaii'
+states['ID'] = 'Idaho'
+states['IL'] = 'Illinois'
+states['IN'] = 'Indiana'
+states['IA'] = 'Iowa'
+states['KS'] = 'Kansas'
+states['KY'] = 'Kentucky'
+states['LA'] = 'Louisiana'
+states['ME'] = 'Maine'
+states['MB'] = 'Manitoba'
+states['MD'] = 'Maryland'
+states['MA'] = 'Massachusetts'
+states['MI'] = 'Michigan'
+states['MN'] = 'Minnesota'
+states['MS'] = 'Mississppi'
+states['MO'] = 'Missouri'
+states['MT'] = 'Montana'
+states['NE'] = 'Nebraska'
+states['NV'] = 'Nevada'
+states['NB'] = 'New Brunswick'
+states['NF'] = 'Newfoundland'
+states['NH'] = 'New Hampshire'
+states['NJ'] = 'New Jersey'
+states['NM'] = 'New Mexico'
+states['NY'] = 'New York'
+states['NC'] = 'North Carolina'
+states['ND'] = 'North Dakota'
+states['NT'] = 'Northwest Territories'
+states['NS'] = 'Nova Scotia'
+states['OH'] = 'Ohio'
+states['OK'] = 'Oklahoma'
+states['ON'] = 'Ontario'
+states['OR'] = 'Oregon'
+states['PA'] = 'Pennsylvania'
+states['PE'] = 'Prince Edward Island'
+states['PR'] = 'Puerto Rico'
+states['QC'] = 'Quebec'
+states['RI'] = 'Rhode Island'
+states['SK'] = 'Saskatchewan'
+states['SC'] = 'South Carolina'
+states['SD'] = 'South Dakota'
+states['TN'] = 'Tennessee'
+states['TX'] = 'Texas'
+states['UT'] = 'Utah'
+states['VT'] = 'Vermont'
+states['VI'] = 'Virgin Islands'
+states['VA'] = 'Virginia'
+states['WA'] = 'Washington'
+states['WV'] = 'West Virginia'
+states['WI'] = 'Wisconsin'
+states['WY'] = 'Wyoming'
+states['YT'] = 'Yukon'
+
+[development:common]
+
+
+[chuck:common]
index 293a282..67b05eb 100644 (file)
@@ -43,9 +43,8 @@ $GLOBALS['glmMembersAdminValidActions'] = array(
         ,
         'configure' => array(
                 'index',
+                'memberTypes',
                 'cities',
-                'states',
-                'countries',
                 'regions'
         ),
         'error' => array(
@@ -215,6 +214,7 @@ class glmMembersAdmin extends GlmPluginSupport
         wp_enqueue_script('jquery-style');
         wp_enqueue_script('jquery-ui-core');
         wp_enqueue_script('jquery-ui-dialog');
+        wp_enqueue_style("wp-jquery-ui-dialog");
 
         wp_enqueue_media();
         wp_register_script('glm-members-admin-js',
@@ -230,6 +230,7 @@ class glmMembersAdmin extends GlmPluginSupport
                 GLM_MEMBERS_PLUGIN_URL . 'css/admin.css');
         wp_enqueue_style('glmMembersAdminStyle');
 
+
     }
 
     /**
@@ -361,16 +362,24 @@ class glmMembersAdmin extends GlmPluginSupport
 
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
 
-            // Get all defiend constants then if not VERBOSE select out only user contstants
+            // If debug is VERBOSE
             $consts = get_defined_constants(true);
-            if (!GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-                $consts = $consts['user'];
+            if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+                $this->addNotice("<pre>".print_r($_SERVER,1).'</pre>', 'DataBlock', 'Server Defines');
+                $this->addNotice('<pre>'.print_r($consts,1).'</pre>', 'DataBlock', 'Defined Parameters');
+            // Not verbose
             } else {
-                $this->addNotice("<pre>".print_r($_SERVER,1)."</pre>", "Server Defines");
+                $ourConsts  = array();
+                foreach ($consts['user'] as $k => $v) {
+                    if (strncmp($k, 'GLM_MEMBERS_PLUGIN', 18) == 0) {
+                        $ourConsts[$k] = $v;
+                    }
+                }
+                $this->addNotice('<pre>'.print_r($ourConsts,1).'</pre>', 'DataBlock', 'Defined Parameters');
             }
 
-            $this->addNotice("<pre>".print_r($consts,1)."</pre>", "Defined Parameters");
-            $this->addNotice("<pre>".print_r($_REQUEST,1)."</pre>", "Request Data");
+            $this->addNotice('<pre>'.print_r($this->config,1).'</pre>', 'DataBlock', 'Configuration Settings');
+            $this->addNotice("<pre>".print_r($_REQUEST,1)."</pre>", 'DataBlock', "Request Data");
         }
 
         /*
@@ -395,7 +404,7 @@ class glmMembersAdmin extends GlmPluginSupport
         do {
 
             if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-                $this->addNotice("<b>Requested Action:</b> Menu item = $menuItem, Action = $action");
+                $this->addNotice("<b>Requested Action:</b> Menu item = $menuItem, Action = $action", 'Process');
             }
 
             $modelRedirect = false;
@@ -403,6 +412,10 @@ class glmMembersAdmin extends GlmPluginSupport
             // Verify that we have the requested menu item in the valid actions
             if (!isset($GLOBALS['glmMembersAdminValidActions'][$menuItem])) {
 
+                if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+                    $this->addNotice('<b>Error in Admin Controller:</b> Menu Item not specified!', 'Alert');
+                }
+
                 $modelRedirect = true;
                 $menuItem = 'error';
                 $action = 'index';
@@ -414,6 +427,11 @@ class glmMembersAdmin extends GlmPluginSupport
             if (! isset($GLOBALS['glmMembersAdminValidActions'][$menuItem]) ||
                      ! in_array($action,
                             $GLOBALS['glmMembersAdminValidActions'][$menuItem])) {
+
+                if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+                    $this->addNotice('<b>Error in Admin Controller:</b> Requested Menu Item is invalid!', 'Alert');
+                }
+
                 $menuItem = 'error';
                 $action = 'badAction';
             }
@@ -430,6 +448,10 @@ class glmMembersAdmin extends GlmPluginSupport
             // If model file doesn't exist - we have an error
             if (!file_exists($modelName)) {
 
+                if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+                    $this->addNotice("<b>Error in Admin Controller:</b> Model file doesn't exist - ".$modelName, 'Alert');
+                }
+
                 $modelRedirect = true;
                 $menuItem = 'error';
                 $action = 'index';
@@ -444,6 +466,10 @@ class glmMembersAdmin extends GlmPluginSupport
                 // check for an invalid model class name
                 if (!class_exists($className)) {
 
+                    if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+                        $this->addNotice("<b>Error in Admin Controller:</b> Invalid Model Class Name - ".$className, 'Alert');
+                    }
+
                     $modelRedirect = true;
                     $menuItem = 'error';
                     $action = 'index';
@@ -454,7 +480,6 @@ class glmMembersAdmin extends GlmPluginSupport
                     // Check if this is a re-direct with parameters
                     $args = false;
 
-
                     // Instantiate the model and ask it to perform the work
                     $model = new $className($this->wpdb, $this->config);
                     $results = $model->modelAction($redirectData);
@@ -486,6 +511,11 @@ class glmMembersAdmin extends GlmPluginSupport
 
                     // Check for invalid or missing view file
                     if (!$view || !is_file(GLM_MEMBERS_PLUGIN_DIR . '/views/'.$view)) {
+
+                        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+                            $this->addNotice("<b>Error in Admin Controller:</b> Requested View file doesn't exist - ".$view, 'Alert');
+                        }
+
                         $modelRedirect = true;
                         $menuItem = 'error';
                         $action = 'index';
@@ -501,7 +531,7 @@ class glmMembersAdmin extends GlmPluginSupport
             }
 
             if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG && $modelRedirect) {
-                $this->addNotice('<b>Redirecting...</b>');
+                $this->addNotice('<b>Redirecting...</b>', 'Process');
             }
 
             // Loop again if there's a model redirect
@@ -527,6 +557,15 @@ class glmMembersAdmin extends GlmPluginSupport
         require (GLM_MEMBERS_PLUGIN_DIR . '/lib/smartyTemplateSupport.php');
         $smarty = new smartyTemplateSupport();
 
+        // Add standard template parameters
+        $smarty->templateAssign ( 'adminDebug', GLM_MEMBERS_PLUGIN_ADMIN_DEBUG);
+        $smarty->templateAssign ( 'thisURL', GLM_MEMBERS_PLUGIN_CURRENT_BASE_URL );
+        $smarty->templateAssign ( 'thisPage', $_REQUEST['page']);
+        $smarty->templateAssign ( 'glmPluginName', GLM_MEMBERS_PLUGIN_NAME );
+        $smarty->templateAssign ( 'thisYear', date ( 'Y' ) );
+        $smarty->templateAssign ( $this->config['term']);
+        $smarty->templateAssign ( $this->config['phrase']);
+
         // Add data from model to Smarty template
         if (is_array($results['data']) && count($results['data']) > 0) {
             foreach ($results['data'] as $k => $d) {
@@ -545,11 +584,16 @@ class glmMembersAdmin extends GlmPluginSupport
         // If view debug has been requested
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
 
-            glmMembersAdmin::addNotice("<b>Template Data</b><br> $view");
+            glmMembersAdmin::addNotice("<b>Template File:</b> $view", 'Process');
 
             $x = $smarty->template->getTemplateVars();
+
+            if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+                glmMembersAdmin::addNotice($x, 'DataBlock', 'Template Parameters');
+            }
+
             $templateVars = '<pre>' . print_r($x, 1) . '</pre>';
-            glmMembersAdmin::addNotice($templateVars, 'Template Parameters');
+            glmMembersAdmin::addNotice($templateVars, 'Template Parameters', 'Process');
         }
 
         // Generate output from model data and view
index 9dc68e7..ff08b32 100644 (file)
@@ -196,8 +196,8 @@ class glmMembersFront extends GlmPluginSupport
                 $consts = $consts['user'];
             }
 
-            $this->addNotice("<pre>".print_r($consts,1)."</pre>", "Defined Parameters");
-            $this->addNotice("<pre>".print_r($_REQUEST,1)."</pre>", "Request Data");
+            $this->addNotice("<pre>".print_r($consts,1)."</pre>", 'DataBlock', "Defined Parameters");
+            $this->addNotice("<pre>".print_r($_REQUEST,1)."</pre>", 'DataBlock', "Request Data");
         }
 
         /*
@@ -223,7 +223,7 @@ class glmMembersFront extends GlmPluginSupport
 
             if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
                 $this->addNotice(
-                        "<b>Requested Action:</b> Menu item = $menuItem, Action = $action");
+                        "<b>Requested Action:</b> Menu item = $menuItem, Action = $action", 'Process');
             }
 
             $modelRedirect = false;
@@ -330,7 +330,7 @@ class glmMembersFront extends GlmPluginSupport
             }
 
             if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG && $modelRedirect) {
-                $this->addNotice('<b>Redirecting...</b>');
+                $this->addNotice('<b>Redirecting...</b>', 'Process');
             }
 
             // Loop again if there's a model redirect
@@ -356,6 +356,17 @@ class glmMembersFront extends GlmPluginSupport
         require (GLM_MEMBERS_PLUGIN_DIR . '/lib/smartyTemplateSupport.php');
         $smarty = new smartyTemplateSupport();
 
+        // Add standard parameters
+        $smarty->templateAssign ( 'adminDebug', GLM_MEMBERS_PLUGIN_ADMIN_DEBUG);
+        $smarty->templateAssign ( 'thisURL', GLM_MEMBERS_PLUGIN_CURRENT_BASE_URL );
+        $smarty->templateAssign ( 'thisPage', $_REQUEST['page']);
+        $smarty->templateAssign ( 'glmPluginName', GLM_MEMBERS_PLUGIN_NAME );
+        $smarty->templateAssign ( 'thisYear', date ( 'Y' ) );
+
+        // Add all terms and phrases from the config/plugin.ini file
+        $smarty->templateAssign ( 'terms', $this->config->term);
+        $smarty->templateAssign ( 'phrase', $this->config->phrase);
+
         // Add data from model to Smarty template
         if (is_array($results['data']) && count($results['data']) > 0) {
             foreach ($results['data'] as $k => $d) {
@@ -373,11 +384,11 @@ class glmMembersFront extends GlmPluginSupport
         // If view debug has been requested
         if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
 
-            glmMembersFront::addNotice("<b>Template Data</b><br> $view");
+            glmMembersFront::addNotice("<b>Template File:</b><br> $view", 'Process');
 
             $x = $smarty->template->getTemplateVars();
             $templateVars = '<pre>' . print_r($x, 1) . '</pre>';
-            glmMembersFront::addNotice($templateVars, 'Template Parameters');
+            glmMembersFront::addNotice($templateVars, 'DataBlock', 'Template Parameters');
         }
 
         // Generate output from model data and view
index d9a6c77..dcaf052 100644 (file)
@@ -13,6 +13,9 @@
 .glm-notice {
     color: red;
 }
+.glm-active {
+    color: blue;
+}
 .glm-right {
     float: right;    
 }
 }
 
 /* Overlay dialog box */
-.glm-dialog-box {
+.ui-dialog {
     background: #fff;
     border: 1px black solid;
     border-radius: 7px;
     padding: 5px;
-    z-axis: 100;
 }
 .glm-dialog-no-close .ui-dialog-titlebar-close {
     display: none;
index a92689b..e93d3a2 100644 (file)
@@ -1,9 +1,8 @@
 <?php
-
-/*
+/**
+ * Gaslight Media Members Database Plugin
  *
  * Set standard defined parameters
- *
  */
 
 // Determine current http/https protocol
index 1d05417..161518d 100644 (file)
--- a/index.php
+++ b/index.php
 // Get standard defined parameters
 require_once('defines.php');
 
+// Get plugin configuration - Just use common section for now, we'll deal with others later
+$configData = parse_ini_file(GLM_MEMBERS_PLUGIN_DIR.'/config/plugin.ini', true);
+$config = $configData['common'];
+
+// Get additional configuration data
+$stateData = parse_ini_file(GLM_MEMBERS_PLUGIN_DIR.'/config/states.ini');
+$config['states'] = $stateData['states'];
+$countryData = parse_ini_file(GLM_MEMBERS_PLUGIN_DIR.'/config/countries.ini');
+$config['countries'] = $countryData['countries'];
+
 // 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);
 
+// Custom plugin post type (for wp_post entries)
+// define('GLM_MEMBERS_PLUGIN_POST_TYPE', '');
+
 
 /**
  * *******************************************************************************
@@ -174,13 +187,6 @@ add_option('glmMembersDatabaseDbVersion', false);
  * ********************************************************************************
  */
 
-// Get plugin configuration
-//** not written yet
-$config = false; // Temporary till written
-
-// Custom plugin post type (for wp_post entries)
-// define('GLM_MEMBERS_PLUGIN_POST_TYPE', '');
-
 /*
  *
  * Activate, Deactivate, Uninstall hooks
@@ -248,56 +254,104 @@ if (isset($_REQUEST['glmDebugWindow']) && $_REQUEST['glmDebugWindow'] == true) {
 function glmMembersAdminNotices($windowed = false)
 {
 
-    $output = '';
+    $output  = '';
 
-    // If windowed, also include HTML header and stylesheet
+    // If windowed for debug, also include HTML header and stylesheet
     if ($windowed) {
+
            $output .= '
-               <html>
-                   <head>
-                       <link rel="stylesheet" href="'.GLM_MEMBERS_PLUGIN_URL.'/css/admin.css">
-                       <head>
-                       <body>
-                       <div id="glm-debug-timestamp">'.date('m/d/Y G:i:s A').'</div>
-                       <div id="glm-debug-header">'.GLM_MEMBERS_PLUGIN_NAME.' - Debug Data</div>
+            <html>
+                <head>
+                    <link rel="stylesheet" href="'.GLM_MEMBERS_PLUGIN_URL.'/css/admin.css">
+                <head>
+                <body>
+                    <a name="top"></a>
+                    <div id="glm-debug-timestamp">'.date('m/d/Y G:i:s A').'</div>
+                    <div id="glm-debug-header">'.GLM_MEMBERS_PLUGIN_NAME.' - Debug Data</div>
            ';
-    }
 
-    // Start with div class to output in standard admin notice block
-    $output .= '<div class="updated"><p>';
+        // Display alerts
+           $alerts = get_option('glmMembersAdminNoticeAlerts');
+           if(is_array($alerts)) {
+              $output .= '<div id="glm-debug-alerts" class="glm-error"><h2>Alerts</h2>';
+               foreach($alerts as $a) {
+               $output .= $a.'<br>';
+           }
+           } else {
+               $output .= '<div id="glm-debug-alerts"><h2>Alerts</h2>';
+           }
+        $output .= '</div><hr>';
+        delete_option('glmMembersAdminNoticeAlerts');
+
+           // Display process messages
+        $process = get_option('glmMembersAdminNoticeProcess');
+        $output .= '<div id="glm-debug-process"><h2>Processing</h2>';
+        if(is_array($process)) {
+            foreach($process as $p) {
+                $output .= $p.'<br>';
+            }
+        }
+        $output .= '</div><hr>';
+        delete_option('glmMembersAdminNoticeProcess');
+
+           // Display data blocks table of contents then the data blocks
+        $dataBlocks = get_option('glmMembersAdminNoticeDataBlocks');
+        $output .= '<div id="glm-debug-contents"><h2>Data Blocks</h2><ul>';
+        $n = 0;
+        if (is_array($dataBlocks)) {
+            foreach($dataBlocks as $d) {
+                $output .= '<li><a href="#'.++$n.'">'.$d['title'].'</a></li>';
+            }
+        }
+        $output .= '</ul></div><hr>';
+        if (is_array($dataBlocks)) {
+            reset($dataBlocks);
+            $n = 0;
+            foreach($dataBlocks as $d) {
+                $output .= '
+                    <div  style="margin-top: 2em;">
+                        <div style="float: right;"><a href="#top">[Top]</a></div>
+                        <div class="glm-debug-section-title"><a name="'.++$n.'"><h4>'.$d['title'].'</h4></a></div>
+                        <div class="glm-debug-section-body"><pre>'.print_r($d['data'],1).'</pre></div>
+                    </div>
+                ';
+            }
+        }
+        delete_option('glmMembersAdminNoticeDataBlocks');
 
-    // Get the notice texts
-    $notices = get_option('glmMembersAdminNotices');
+        echo $output.'
+                </body>
+            </html>
+        ';
 
-    if (is_array($notices) && count($notices) > 0) {
+    // Otherwise we're outputting data to the message block in the WordPress admin area
+    } else {
 
-        // For each notice retrieved
-        $br = '';
-        foreach($notices as $n) {
+        // Start with div class to output in standard admin notice block
+        $output .= '<div class="updated"><p>';
 
-            // Add the notice to the output
-            $output .= $br.$n;
-            $br = '<br>';
-        }
+        // Get the notice texts
+        $notices = get_option('glmMembersAdminNotices');
 
-    }
+        if (is_array($notices) && count($notices) > 0) {
 
-    // Output the notices
-    $output .= '</p></div>';
+            // For each notice retrieved
+            $br = '';
+            foreach($notices as $n) {
 
+                // Add the notice to the output
+                $output .= $br.$n;
+                $br = '<br>';
+            }
 
-    // If windowed, also include HTML header and stylesheet
-    if ($windowed) {
-       $output .= '
-                       </body>
-           </html>
-           ';
-    }
+        }
 
-    echo $output;
+        echo $output.'</p></div>';
 
-    // Delete the option containing the notices to indicate they have been sent
-    delete_option('glmMembersAdminNotices');
+        // Delete the option containing the notices to indicate they have been sent
+        delete_option('glmMembersAdminNotices');
+
+    }
 
 }
 // Check if there's admin notices for output
index 40d64a4..f16ec2c 100755 (executable)
@@ -545,21 +545,28 @@ abstract class GlmDataAbstract
      */
     function pointerField($f)
     {
+
+        // Get ID field of other table - default to 'id'
+        $p_id = 'id';
+        if(isset($f['p_id'])) {
+            $p_id = $f['p_id'];
+        }
+
         // Check if there's a specified WHERE clause
-        $where = $f['p_id']." = T.".$f['field'];
-        if ($f['p_where']) {
+        $where = $p_id." = T.".$f['field'];
+        if (isset($f['p_where']) && $f['p_where']) {
             $where = $f['p_where'];
         }
 
         // Check if there's an addional FROM tables
         $from = '';
-        if ($f['p_from']) {
+        if (isset($f['p_from']) && $f['p_from']) {
             $from = ', '.$f['p_from'];
         }
 
         // Check if the results from this pointer is to be summed
         $field_val = $f['p_field'];
-        if ($f['p_sum']) {
+        if (isset($f['p_sum']) && $f['p_sum']) {
             $field_val = 'COALESCE(sum('.$field_val.'), 0) ';
         }
 
@@ -574,9 +581,16 @@ abstract class GlmDataAbstract
     }
     function pointerOptions($f)
     {
+
+        // Get ID field of other table - default to 'id'
+        $p_id = 'id';
+        if(isset($f['p_id'])) {
+            $p_id = $f['p_id'];
+        }
+
         $sql = "
             SELECT "
-            .$f['p_id'].", ".$f['p_field']."
+            .$p_id.", ".$f['p_field']."
              FROM "
             .$f['p_table']."
             ORDER BY "
@@ -614,8 +628,15 @@ abstract class GlmDataAbstract
             if ($f['p_where']) {
                 $where = 'WHERE '.$f['p_where'];
             }
+
+            // Get ID field of other table - default to 'id'
+            $p_id = 'id';
+            if(isset($f['p_id'])) {
+                $p_id = $f['p_id'];
+            }
+
             $sql = "
-                SELECT ".$f['p_id']." AS p_id,
+                SELECT ".$p_id." AS p_id,
                        ".$f['p_field']." AS p_value
                   FROM ".$f['p_table']."
                        $where
@@ -628,10 +649,14 @@ abstract class GlmDataAbstract
             $selected_name = '';
             $pick_list = array();
 
-            if ($f['p_blank']) {
+            $blankText = '';
+            if (isset($f['p_blank_text']) && $f['p_blank_text'] != '') {
+                $blankText = $f['p_blank_text'];
+            }
+            if (isset($f['p_blank']) && $f['p_blank']) {
                 $pick_list[0] = array(\r
                     'value'   => '',\r
-                    'name'    => '(none selected)',\r
+                    'name'    => $blankText,\r
                     'default' => ($p['p_id'] == '')\r
                 );\r
             }
@@ -669,7 +694,7 @@ abstract class GlmDataAbstract
                 'value'     => $p_value,
                 'name'      => $selected_name,
                 'nameEsc'   => addslashes($selected_name),
-                'pick_list' => $pick_list
+                'list' => $pick_list
             );
 
             return $r;
@@ -691,12 +716,19 @@ abstract class GlmDataAbstract
 
         // Get picklist options from other table
         $where = '';
-        if ($f['p_where']) {
+        if (isset($f['p_where']) && $f['p_where'] != '') {
             $where = 'WHERE '.$f['p_where'];
         }
+
+        // Get ID field of other table - default to 'id'
+        $p_id = 'id';
+        if(isset($f['p_id'])) {
+            $p_id = $f['p_id'];
+        }
+
         $sql = "
             SELECT "
-            .$f['p_id']." AS p_id,
+            .$p_id." AS p_id,
                    "
             .$f['p_field']." AS p_value
               FROM "
@@ -756,6 +788,21 @@ abstract class GlmDataAbstract
         if (count($p_list) > 0) {
 
             $pick_list = array();
+
+            // Deal with optional blank entry
+            $blankText = '';
+            if (isset($f['p_blank_text']) && $f['p_blank_text'] != '') {
+                $blankText = $f['p_blank_text'];
+            }
+            if (isset($f['p_blank']) && $f['p_blank']) {
+                $pick_list[0] = array(
+                        'value'   => '',
+                        'name'    => $blankText,
+                        'nameEsc' => addslashes($blankText),
+                        'default' => false
+                );
+            }
+
             reset($p_list);
             foreach ($p_list as $p) {
 
@@ -821,7 +868,7 @@ abstract class GlmDataAbstract
             'value'        => $in,
             'name'      => $selected_name,
             'nameEsc'   => addslashes($selected_name),
-            'pick_list' => $pick_list
+            'list' => $pick_list
         );
 
         return $r;
@@ -880,7 +927,7 @@ abstract class GlmDataAbstract
         );
 
        // if the list is not required, dump it now. (List, Get, Delete, Confirm delete)
-        if (in_array($op, array(l, g, d, c))) {
+        if (in_array($op, array('l', 'g', 'd', 'c'))) {
                $r['list'] = false;
         }
 
@@ -2543,7 +2590,7 @@ abstract class GlmDataAbstract
                  WHERE $where;";
 
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-            glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - getStats() query");
+            glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getStats() query");
         }
 
         $stats = $this->wpdb->get_row($sql, ARRAY_A);
@@ -2581,7 +2628,7 @@ abstract class GlmDataAbstract
         }
 
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-            glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - getList() query");
+            glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getList() query");
         }
 
         //echo "<pre>$sql</pre>";
@@ -2622,7 +2669,7 @@ abstract class GlmDataAbstract
                 ;";
 
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-            glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - getEntry() query");
+            glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getEntry() query");
         }
 
         $detail = $this->wpdb->get_row($sql, ARRAY_A);
@@ -2713,7 +2760,7 @@ abstract class GlmDataAbstract
                 $r['insertedID'] = $this->wpdb->insert_id;
 
                 if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-                    glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - insertEntry() query");
+                    glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - insertEntry() query");
                 }
 
                 // Get the data again for output
@@ -2742,7 +2789,7 @@ abstract class GlmDataAbstract
                 ;";
 
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-            glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - editEntry() query");
+            glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - editEntry() query");
         }
 
         $detail = $this->wpdb->get_row($sql, ARRAY_A);
@@ -2821,7 +2868,7 @@ abstract class GlmDataAbstract
             ";
 
             if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-                glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - updateEntry() query");
+                glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - updateEntry() query");
             }
 
             // Now store the field data
@@ -2878,7 +2925,7 @@ abstract class GlmDataAbstract
                 ";
 
                 if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-                    glmMembersAdmin::addNotice("<pre>".print_r($sql,1)."</pre>", "DataAbstract - deleteEntry() query");
+                    glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - deleteEntry() query");
                 }
 
                 // Assume things will go fine
index ea0f0e6..88a50c9 100644 (file)
@@ -301,6 +301,8 @@ Field Specifications:
 
 'p_blank'            If set or true provide a "blank" option for pointer input
 
+'p_blank_text'      If set, use this as the text for the 'p_blank' option
+
 'p_sort'            Optional ORDER BY sort clause (i.e. "name, age DESC") - May not be functional yet.
 
 'p_orderby'            Optional "ORDER BY" clause for results from table pointed to by pointer
index c50da95..1a15080 100644 (file)
@@ -57,13 +57,6 @@ class smartyTemplateSupport {
 
                $this->template = new Smarty ();
 
-               // Add standard parameters
-           $this->templateAssign ( 'adminDebug', GLM_MEMBERS_PLUGIN_ADMIN_DEBUG);
-               $this->templateAssign ( 'thisURL', GLM_MEMBERS_PLUGIN_CURRENT_BASE_URL );
-               $this->templateAssign ( 'thisPage', $_REQUEST['page']);
-               $this->templateAssign ( 'glmPluginName', GLM_MEMBERS_PLUGIN_NAME );
-               $this->templateAssign ( 'thisYear', date ( 'Y' ) );
-
                /*
                 * Configure Smarty Templates for this site
                 */
index 0d7fdf7..91a93fe 100644 (file)
@@ -6,27 +6,18 @@
 -- To permit each query below to be executed separately,
 -- all queries must be separated by a line with ----
 
-CREATE TABLE {prefix}cities (
+CREATE TABLE {prefix}member_type (
   id INT NOT NULL AUTO_INCREMENT,
   name TINYTEXT NULL,
+  descr TINYTEXT NULL,
   PRIMARY KEY (id)
 );
 
 ----
 
-CREATE TABLE {prefix}states (
-  id INT NOT NULL AUTO_INCREMENT,
-  name TINYTEXT NULL,
-  code TINYTEXT NULL,
-  PRIMARY KEY (id)
-);
-
-----
-
-CREATE TABLE {prefix}countries (
+CREATE TABLE {prefix}cities (
   id INT NOT NULL AUTO_INCREMENT,
   name TINYTEXT NULL,
-  code TINYTEXT NULL,
   PRIMARY KEY (id)
 );
 
@@ -76,7 +67,7 @@ CREATE TABLE {prefix}members (
 CREATE TABLE {prefix}locations (
   id INT NOT NULL AUTO_INCREMENT,
   status INT NULL,
-  location_type ENUM('hotel','restaurant') NULL,
+  location_type INT NULL,
   member INT NULL,
   name TINYTEXT NULL,
   descr TEXT NULL,
@@ -105,7 +96,7 @@ CREATE TABLE {prefix}locations (
 CREATE TABLE {prefix}facilities (
   id INT NOT NULL AUTO_INCREMENT,
   status INT NULL,
-  facility_type ENUM('hotel_motel','bandb','restaurant','golf') NULL,
+  facility_type INT NULL,
   location INT NULL,
   name TINYTEXT NULL,
   descr TEXT NULL,
@@ -143,7 +134,7 @@ CREATE TABLE {prefix}activties (
   notes TEXT NULL,
   create_time TIMESTAMP NULL,
   modify_time TIMESTAMP NULL,
-  ref_type ENUM('member','location','facility') NULL,
+  ref_type INT NULL,
   ref_dest INT NULL,
   PRIMARY KEY (id)
 );
@@ -160,7 +151,7 @@ CREATE TABLE {prefix}accommodations (
   reservation_url TINYTEXT NULL,
   reservation_id TINYTEXT NULL,
   year_round TINYINT(1) NULL,
-  ref_type ENUM('member','location','facility') NULL,
+  ref_type INT NULL,
   ref_dest INT NULL,
   PRIMARY KEY (id)
 );
@@ -178,9 +169,9 @@ CREATE TABLE {prefix}golf (
   yardage TINYTEXT NULL,
   slope TINYTEXT NULL,
   walking TINYINT(1) NULL,
-  holes ENUM('9','18') NULL,
+  holes INT NULL,
   reservation_url TINYTEXT NULL,
-  ref_type ENUM('member','location','facility') NULL,
+  ref_type INT NULL,
   ref_dest INT NULL,
   PRIMARY KEY (id)
 );
@@ -202,7 +193,7 @@ CREATE TABLE {prefix}restaurants (
   alcohol TINYINT(1) NULL,
   non_smoking TINYINT(1) NULL,
   notes TEXT NULL,
-  ref_type ENUM('member','location','facility') NULL,
+  ref_type INT NULL,
   ref_dest INT NULL,
   PRIMARY KEY (id)
 );
@@ -265,11 +256,11 @@ CREATE TABLE {prefix}meals (
 CREATE TABLE {prefix}contacts (
   id INT NOT NULL AUTO_INCREMENT,
   status INT NULL,
-  ref_type ENUM('member','location','facility','activity') NULL,
+  ref_type INT NULL,
   ref_dest INT NULL,
   fname TINYTEXT NULL,
   lname TINYTEXT NULL,
-  contact_type ENUM('personal','role') NULL,
+  contact_type INT NULL,
   org TINYTEXT NULL,
   addr1 TINYTEXT NULL,
   addr2 TINYTEXT NULL,
@@ -303,7 +294,7 @@ CREATE TABLE {prefix}amenities (
   name TINYTEXT NULL,
   descr TEXT NULL,
   short_descr TINYTEXT NULL,
-  facility_type ENUM('hotel_motel','bandb','restaurant','golf') NULL,
+  facility_type INT NULL,
   PRIMARY KEY (id)
 );
 
@@ -321,7 +312,7 @@ CREATE TABLE {prefix}social_media (
 
 CREATE TABLE {prefix}social_media_member (
   id INT NOT NULL AUTO_INCREMENT,
-  ref_type ENUM('member','location','facility','contact') NULL,
+  ref_type INT NULL,
   ref_dest INT NULL,
   social_media INT NULL,
   url TINYTEXT NULL,
@@ -333,7 +324,7 @@ CREATE TABLE {prefix}social_media_member (
 CREATE TABLE {prefix}amenity_member (
   id INT NOT NULL AUTO_INCREMENT,
   amenity INT NULL,
-  ref_type ENUM('member','location','facility') NULL,
+  ref_type INT NULL,
   ref_dest INT NULL,
   PRIMARY KEY (id)
 );
@@ -343,8 +334,8 @@ CREATE TABLE {prefix}amenity_member (
 CREATE TABLE {prefix}accounts (
   id INT NOT NULL AUTO_INCREMENT,
   member INT NULL,
-  payment_type ENUM('credit_card','check') NULL,
-  invoice_delivery ENUM('email','usmail','fax') NULL,
+  payment_type INT NULL,
+  invoice_delivery INT NULL,
   PRIMARY KEY (id)
 );
 
@@ -365,7 +356,7 @@ CREATE TABLE {prefix}category_member (
   id INT NOT NULL AUTO_INCREMENT,
   cateogory INT NULL,
   main_category TINYINT(1) NULL,
-  ref_type ENUM('member','location','facility') NULL,
+  ref_type INT NULL,
   ref_dest INT NULL,
   PRIMARY KEY (id)
 );
@@ -381,7 +372,7 @@ CREATE TABLE {prefix}files (
   size INT NULL,
   pending TINYINT(1) NULL,
   create_date DATE NULL,
-  ref_type ENUM('member','location','facility') NULL,
+  ref_type INT NULL,
   ref_dest INT NULL,
   PRIMARY KEY (id)
 );
@@ -396,7 +387,7 @@ CREATE TABLE {prefix}images (
   caption TINYTEXT NULL,
   pending TINYINT(1) NULL,
   position INT NULL,
-  ref_type ENUM('member','location','facility','activity','accommodation','golf','restaurant','contact') NULL,
+  ref_type INT NULL,
   ref_dest INT NULL,
   PRIMARY KEY (id)
 );
index 54c65c1..eee1b69 100644 (file)
@@ -5,6 +5,7 @@
 
 DROP TABLE
     {prefix}members,
+    {prefix}member_type,
     {prefix}locations,
     {prefix}facilities,
     {prefix}activties,
@@ -23,8 +24,6 @@ DROP TABLE
        {prefix}regions,
        {prefix}social_media,
        {prefix}social_media_member,
-    {prefix}cities,
-    {prefix}states,
-       {prefix}countries
+    {prefix}cities
 ;
 
diff --git a/models/admin/configure/cities.php b/models/admin/configure/cities.php
new file mode 100644 (file)
index 0000000..d9e9252
--- /dev/null
@@ -0,0 +1,187 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Cities List
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+// Load Member Types data abstract
+require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataCities.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_configure_cities extends GlmDataCities
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+    /*
+     * Constructor
+     *
+     * This contructor sets up this model. At this time that only includes
+     * storing away the WordPress data object.
+     *
+     * @return object Class object
+     *
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        // Run constructor for members data class
+        parent::__construct($this->wpdb, $this->config);
+
+    }
+
+    /*
+     * Perform Model Action
+     *
+     * This method does the work for this model and returns any resulting data
+     *
+     * @return array Status and data array
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * 'menuItemRedirect'
+     *
+     * If not false, provides a menu item the controller should
+     * execute after this one. Normally if this is used, there would also be a
+     * modelRedirect value supplied as well.
+     *
+     * 'modelRedirect'
+     *
+     * If not false, provides an action the controller should execute after
+     * this one.
+     *
+     * 'view'
+     *
+     * A suggested view name that the contoller should use instead of the
+     * default view for this model or false to indicate that the default view
+     * should be used.
+     *
+     * 'data'
+     *
+     * Data that the model is returning for use in merging with the view to
+     * produce output.
+     *
+     */
+    public function modelAction ($redirectData = false)
+    {
+
+        $success = true;
+        $haveCities = false;
+        $citiew = false;
+        $error = false;
+
+        if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') {
+            $cities = $this->insertEntry();
+        }
+
+        if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete' && isset($_REQUEST['cityID'])) {
+            $id = $_REQUEST['cityID']-0;
+            if ($id > 0) {
+                $this->deleteEntry($id, true);
+            }
+        }
+
+        // Check if a city ID is supplied
+        if (isset($_REQUEST['city_id'])) {
+            // Make sure it's a number
+            $cityID = $_REQUEST['city_id']-0;
+        }
+
+        // Check for action option
+        $option = false;
+        if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+            $option = $_REQUEST['option'];
+        }
+
+// Check for options
+
+        // Get a current list of members
+        $cities = $this->getList();
+
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice($cities, 'DataBlock', 'City Data');
+        }
+
+        // If we have list entries - even if it's an empty list
+        $success = true;
+        $haveCities = false;
+        if ($cities !== false) {
+
+            $success = true;
+
+            // If we have any entries
+            if (count($cities) > 0) {
+                $haveCities = true;
+            }
+        }
+
+        // If we had a fatal error, redirect to the error page
+        if ($error) {
+            return array(
+                    'status' => $success,
+                    'menuItemRedirect' => 'error',
+                    'modelRedirect' => 'index',
+                    'view' => 'admin/error/index.html',
+                    'data' => false
+            );
+        }
+
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice($cities, 'DataBlock', 'Cities Data');
+        }
+
+        // Compile template data
+        $templateData = array(
+            'haveCities' => $haveCities,
+            'cities' => $cities
+        );
+echo "!@#!@##";
+        // Return status, suggested view, and data to controller
+        return array(
+            'status' => $success,
+            'menuItemRedirect' => false,
+            'modelRedirect' => false,
+            'view' => 'admin/configure/cities.html',
+            'data' => $templateData
+        );
+
+    }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/configure/memberTypes.php b/models/admin/configure/memberTypes.php
new file mode 100644 (file)
index 0000000..6b314b4
--- /dev/null
@@ -0,0 +1,187 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Member Type List
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+// Load Member Types data abstract
+require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataMemberTypes.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_configure_memberTypes extends GlmDataMemberTypes
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+    /*
+     * Constructor
+     *
+     * This contructor sets up this model. At this time that only includes
+     * storing away the WordPress data object.
+     *
+     * @return object Class object
+     *
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        // Run constructor for members data class
+        parent::__construct($this->wpdb, $this->config);
+
+    }
+
+    /*
+     * Perform Model Action
+     *
+     * This method does the work for this model and returns any resulting data
+     *
+     * @return array Status and data array
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * 'menuItemRedirect'
+     *
+     * If not false, provides a menu item the controller should
+     * execute after this one. Normally if this is used, there would also be a
+     * modelRedirect value supplied as well.
+     *
+     * 'modelRedirect'
+     *
+     * If not false, provides an action the controller should execute after
+     * this one.
+     *
+     * 'view'
+     *
+     * A suggested view name that the contoller should use instead of the
+     * default view for this model or false to indicate that the default view
+     * should be used.
+     *
+     * 'data'
+     *
+     * Data that the model is returning for use in merging with the view to
+     * produce output.
+     *
+     */
+    public function modelAction ($redirectData = false)
+    {
+
+        $success = true;
+        $haveMemberTypes = false;
+        $memberTypes = false;
+        $error = false;
+
+        if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') {
+            $memberData = $this->insertEntry();
+        }
+
+        if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete' && isset($_REQUEST['memberTypeID'])) {
+            $id = $_REQUEST['memberTypeID']-0;
+            if ($id > 0) {
+                $this->deleteEntry($id, true);
+            }
+        }
+
+        // Check if a member ID is supplied
+        if (isset($_REQUEST['member_id'])) {
+            // Make sure it's a number
+            $memberID = $_REQUEST['member_id']-0;
+        }
+
+        // Check for action option
+        $option = false;
+        if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+            $option = $_REQUEST['option'];
+        }
+
+// Check for options
+
+        // Get a current list of members
+        $memberTypes = $this->getList();
+
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice($memberTypes, 'DataBlock', 'Member Type Data');
+        }
+
+        // If we have list entries - even if it's an empty list
+        $success = true;
+        $haveMemberTypes = false;
+        if ($memberTypes !== false) {
+
+            $success = true;
+
+            // If we have any entries
+            if (count($memberTypes) > 0) {
+                $haveMemberTypes = true;
+            }
+        }
+
+        // If we had a fatal error, redirect to the error page
+        if ($error) {
+            return array(
+                    'status' => $success,
+                    'menuItemRedirect' => 'error',
+                    'modelRedirect' => 'index',
+                    'view' => 'admin/error/index.html',
+                    'data' => false
+            );
+        }
+
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice($memberTypes, 'DataBlock', 'Member Types Data');
+        }
+
+        // Compile template data
+        $templateData = array(
+            'haveMemberTypes' => $haveMemberTypes,
+            'memberTypes' => $memberTypes
+        );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status' => $success,
+            'menuItemRedirect' => false,
+            'modelRedirect' => false,
+            'view' => 'admin/configure/memberTypes.html',
+            'data' => $templateData
+        );
+
+    }
+
+
+}
+
+?>
\ No newline at end of file
diff --git a/models/admin/configure/regions.php b/models/admin/configure/regions.php
new file mode 100644 (file)
index 0000000..45b7fd6
--- /dev/null
@@ -0,0 +1,187 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Regions List
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @version  0.1
+ */
+
+// Load Member Types data abstract
+require_once(GLM_MEMBERS_PLUGIN_CLASS_DIR.'/data/dataRegions.php');
+
+/*
+ * This class performs the work for the default action of the "Members" menu
+ * option, which is to display the members dashboard.
+ *
+ */
+class GlmMembersAdmin_configure_regions extends GlmDataRegions
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+    /*
+     * Constructor
+     *
+     * This contructor sets up this model. At this time that only includes
+     * storing away the WordPress data object.
+     *
+     * @return object Class object
+     *
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        // Run constructor for members data class
+        parent::__construct($this->wpdb, $this->config);
+
+    }
+
+    /*
+     * Perform Model Action
+     *
+     * This method does the work for this model and returns any resulting data
+     *
+     * @return array Status and data array
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * 'menuItemRedirect'
+     *
+     * If not false, provides a menu item the controller should
+     * execute after this one. Normally if this is used, there would also be a
+     * modelRedirect value supplied as well.
+     *
+     * 'modelRedirect'
+     *
+     * If not false, provides an action the controller should execute after
+     * this one.
+     *
+     * 'view'
+     *
+     * A suggested view name that the contoller should use instead of the
+     * default view for this model or false to indicate that the default view
+     * should be used.
+     *
+     * 'data'
+     *
+     * Data that the model is returning for use in merging with the view to
+     * produce output.
+     *
+     */
+    public function modelAction ($redirectData = false)
+    {
+
+        $success = true;
+        $haveRegions = false;
+        $citiew = false;
+        $error = false;
+
+        if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'addNew') {
+            $regions = $this->insertEntry();
+        }
+
+        if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'delete' && isset($_REQUEST['cityID'])) {
+            $id = $_REQUEST['cityID']-0;
+            if ($id > 0) {
+                $this->deleteEntry($id, true);
+            }
+        }
+
+        // Check if a city ID is supplied
+        if (isset($_REQUEST['city_id'])) {
+            // Make sure it's a number
+            $cityID = $_REQUEST['city_id']-0;
+        }
+
+        // Check for action option
+        $option = false;
+        if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+            $option = $_REQUEST['option'];
+        }
+
+// Check for options
+
+        // Get a current list of members
+        $regions = $this->getList();
+
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice($regions, 'DataBlock', 'City Data');
+        }
+
+        // If we have list entries - even if it's an empty list
+        $success = true;
+        $haveRegions = false;
+        if ($regions !== false) {
+
+            $success = true;
+
+            // If we have any entries
+            if (count($regions) > 0) {
+                $haveRegions = true;
+            }
+        }
+
+        // If we had a fatal error, redirect to the error page
+        if ($error) {
+            return array(
+                    'status' => $success,
+                    'menuItemRedirect' => 'error',
+                    'modelRedirect' => 'index',
+                    'view' => 'admin/error/index.html',
+                    'data' => false
+            );
+        }
+
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
+            glmMembersAdmin::addNotice($regions, 'DataBlock', 'Regions Data');
+        }
+
+        // Compile template data
+        $templateData = array(
+            'haveRegions' => $haveRegions,
+            'regions' => $regions
+        );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status' => $success,
+            'menuItemRedirect' => false,
+            'modelRedirect' => false,
+            'view' => 'admin/configure/regions.html',
+            'data' => $templateData
+        );
+
+    }
+
+
+}
+
+?>
\ No newline at end of file
index 3cd0887..3b50ef7 100644 (file)
@@ -120,7 +120,7 @@ class GlmMembersAdmin_member_index extends GlmDataMembers
         if ($memberID <= 0) {
 
             if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-                glmMembersAdmin::addNotice('&nbsp;&nbsp;No member ID supplied.');
+                glmMembersAdmin::addNotice('&nbsp;&nbsp;No member ID supplied.', 'Process');
             }
 
             return array(
@@ -135,7 +135,7 @@ class GlmMembersAdmin_member_index extends GlmDataMembers
         }
 
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-            glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Member ID specified:</b> $memberID");
+            glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Member ID specified:</b> $memberID", 'Process');
         }
 
         // If a delete request has been made, try to delete the member without confirmation
@@ -156,7 +156,7 @@ class GlmMembersAdmin_member_index extends GlmDataMembers
         }
 
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-            glmMembersAdmin::addNotice("<pre>".print_r($memberData,1)."</pre>", 'Member Data');
+            glmMembersAdmin::addNotice($memberData, 'DataBlock', 'Member Data');
         }
 
         // Compile template data
index 16a8807..eee981f 100644 (file)
@@ -126,7 +126,7 @@ class GlmMembersAdmin_member_member extends GlmDataMembers
                 $memberData = $this->insertEntry();
 
                 if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-                    glmMembersAdmin::addNotice('<pre>'.print_r($memberData,1).'</pre>', 'New Member Data');
+                    glmMembersAdmin::addNotice($memberData, 'DataBlock', 'New Member Data');
                 }
 
                 if ($memberData['status']) {
@@ -179,7 +179,7 @@ class GlmMembersAdmin_member_member extends GlmDataMembers
             default:
 
                 if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-                    glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Member ID specified:</b> $memberID");
+                    glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Member ID specified:</b> $memberID", 'Process');
                 }
 
                 // If we have a member ID, try to get the member data
@@ -195,7 +195,7 @@ class GlmMembersAdmin_member_member extends GlmDataMembers
                     } else {
 
                         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-                            glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Specified Member ID is invalid:</b> $memberID");
+                            glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Specified Member ID is invalid:</b> $memberID", 'Process');
                         }
 
                         $error = true;
@@ -229,7 +229,7 @@ class GlmMembersAdmin_member_member extends GlmDataMembers
 
 
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-            glmMembersAdmin::addNotice("<pre>".print_r($memberData,1)."</pre>", 'Member Data');
+            glmMembersAdmin::addNotice($memberData, 'DataBlock', 'Member Data');
         }
 
         // Compile template data
index add413d..11295fa 100644 (file)
@@ -105,7 +105,7 @@ class GlmMembersAdmin_members_index extends GlmDataMembers
 
 /*
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-            glmMembersAdmin::addNotice("<pre>".print_r($list,1)."</pre>", 'Member Data');
+            glmMembersAdmin::addNotice($stats, 'DataBlock', 'Member Data');
         }
 
         // If we have list entries - even if it's an empty list
index c9bbaa5..0ea9c57 100644 (file)
@@ -103,7 +103,7 @@ class GlmMembersAdmin_members_list extends GlmDataMembers
         $list = $this->getList();
 
         if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE) {
-            glmMembersAdmin::addNotice("<pre>".print_r($list,1)."</pre>", 'Member Data');
+            glmMembersAdmin::addNotice($list, 'DataBlock', 'Member Data');
         }
 
         // If we have list entries - even if it's an empty list
index 059590b..168bbdd 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 
 /**
- * Gaslight Media Members Database
+ * Gaslight Media Members Database Plugin
  * Uninstall Plugin
  *
  * PHP version 5.5
diff --git a/views/admin/configure/cities.html b/views/admin/configure/cities.html
new file mode 100644 (file)
index 0000000..46a5af8
--- /dev/null
@@ -0,0 +1,119 @@
+{include file='admin/configure/header.html'}
+
+    <div id="newCityButton" class="button-primary glm-right">Add a City</div>
+    <div id="newCityDialog" class="glm-dialog-box" title="Enter a New City">
+        <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+            <input type="hidden" name="glm_action" value="cities">
+            <input type="hidden" name="option" value="addNew">
+            
+            <table class="form-table">
+                <tr>
+                    <th class="glm-required">City Name:</th>
+                    <td>
+                        <input type="text" name="name" class="glm-form-text-input">
+                    </td>
+                </tr>
+                <tr>
+                    <th>Description:</th>
+                    <td>
+                        <textarea name="descr" class="glm-form-textarea"></textarea>
+                    </td>
+                </tr>
+                
+                
+            </table>
+            <p><span class="glm-required">*</span> Required</p>
+            <a id="newCityCancel" class="button-primary glm-right">Cancel</a>
+            <input type="submit" value="Add new City">
+            
+        </form>
+    </div>
+    <div id="deleteCityDialog" class="glm-dialog-box" title="Delete City">
+        <center>
+            <p>Are you sure you want to delete this city?</p>
+            <p><div id="deleteCityConfirm" class="button-primary">Yes, delete this city</div></p>
+            <p><div id="deleteCityCancel" class="button-primary">No, I don't want to delete this city</div></p>
+        </center>
+    </div>
+                    
+    
+    <h2>Cities</h2>
+
+    <table class="wp-list-table widefat fixed posts">
+        <thead>
+            <tr>
+                <th>City</th>
+                <th>&nbsp;</th>
+            </tr>
+        </thead>
+        <tfoot>
+            <tr>
+                <th>City</th>
+                <th>&nbsp;</th>
+            </tr>
+        </tfoot>
+        <tbody>
+{if $haveCities}
+    {assign var="i" value="0"}
+    {foreach $cities as $t}
+        {if $i++ is odd by 1} 
+            <tr>
+        {else}
+            <tr class="alternate">
+        {/if}
+                <td>
+                    {$t.name}
+                </td>
+                <td>
+                    <div class="deleteCityButton button-primary glm-right" data-cityID="{$t.id}">Delete</div>
+                </td>
+            </tr>
+    {/foreach}
+{else}
+            <tr class="alternate"><td colspan="2">(no cities listed)</td></tr>
+{/if}
+        </tbody>
+    </table>
+
+    <script type="text/javascript">
+        jQuery(document).ready(function($) {
+               
+            $("#newCityDialog").dialog({
+               autoOpen: false,
+               minWidth: 400,
+                dialogClass: "glm-dialog-no-close"
+            });
+            $("#deleteCityDialog").dialog({
+                autoOpen: false,
+                minWidth: 400,
+                dialogClass: "glm-dialog-no-close"
+            });
+
+            $('#newCityButton').click( function() {
+                $("#newCityDialog").dialog("open");
+            });
+            $('#newCityConfirm').click( function() {
+                $("#newCityDialog").dialog("close");
+                window.location.href = "{$thisURL}?page={$thisPage}&glm_action=cities&option=addNew";
+            });
+            $('#newCityCancel').click( function() {
+                $("#newCityDialog").dialog("close");
+            });
+
+            var id = false;
+            $('.deleteCityButton').click( function() {
+                id = $(this).attr('data-cityID');
+                $("#deleteCityDialog").dialog("open");
+            });
+            $('#deleteCityConfirm').click( function() {
+                $("#deleteCityDialog").dialog("close");
+                window.location.href = "{$thisURL}?page={$thisPage}&glm_action=cities&option=delete&cityID=" + id;
+            });
+            $('#deleteCityCancel').click( function() {
+                $("#deleteCityDialog").dialog("close");
+            });
+
+        });
+    </script>
+            
+{include file='admin/footer.html'}
index 6d9eff3..a44cbb4 100644 (file)
@@ -4,10 +4,9 @@
        
     <h2 class="nav-tab-wrapper">
         <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index}-active{/if}">General Options</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=cities" class="nav-tab{if $thisAction==cities}-active{/if}">Cities List</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=states" class="nav-tab{if $thisAction==add}-active{/if}">States List</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=countries" class="nav-tab{if $thisAction==edit}-active{/if}">Countries List</a>
-        <a href="{$thisURL}?page={$thisPage}&glm_action=Regions" class="nav-tab{if $thisAction==edit}-active{/if}">Regions List</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=memberTypes" class="nav-tab{if $thisAction==memberTypes}-active{/if}">Member Types</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=cities" class="nav-tab{if $thisAction==cities}-active{/if}">Cities</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=regions" class="nav-tab{if $thisAction==regions}-active{/if}">Regions</a>
     </h2>
     <div id="glm-admin-content-container">
     
\ No newline at end of file
diff --git a/views/admin/configure/memberTypes.html b/views/admin/configure/memberTypes.html
new file mode 100644 (file)
index 0000000..a702086
--- /dev/null
@@ -0,0 +1,124 @@
+{include file='admin/configure/header.html'}
+
+    <div id="newMemberTypeButton" class="button-primary glm-right">Add a Member Type</div>
+    <div id="newMemberTypeDialog" class="glm-dialog-box" title="Enter New Member Type">
+        <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+            <input type="hidden" name="glm_action" value="memberTypes">
+            <input type="hidden" name="option" value="addNew">
+            
+            <table class="form-table">
+                <tr>
+                    <th class="glm-required">Member Type Name:</th>
+                    <td>
+                        <input type="text" name="name" class="glm-form-text-input">
+                    </td>
+                </tr>
+                <tr>
+                    <th>Description:</th>
+                    <td>
+                        <textarea name="descr" class="glm-form-textarea"></textarea>
+                    </td>
+                </tr>
+                
+                
+            </table>
+            <p><span class="glm-required">*</span> Required</p>
+            <a id="newMemberTypeCancel" class="button-primary glm-right">Cancel</a>
+            <input type="submit" value="Add new member type">
+            
+        </form>
+    </div>
+    <div id="deleteMemberTypeDialog" class="glm-dialog-box" title="Delete Member Type">
+        <center>
+            <p>Are you sure you want to delete this member type?</p>
+            <p><div id="deleteMemberTypeConfirm" class="button-primary">Yes, delete this member type</div></p>
+            <p><div id="deleteMemberTypeCancel" class="button-primary">No, I don't want to delete this member type</div></p>
+        </center>
+    </div>
+                    
+    
+    <h2>Member Types</h2>
+
+    <table class="wp-list-table widefat fixed posts">
+        <thead>
+            <tr>
+                <th>Member Type</th>
+                <th>Description</th>
+                <th>&nbsp;</th>
+            </tr>
+        </thead>
+        <tfoot>
+            <tr>
+                <th>Member Type</th>
+                <th>Description</th>
+                <th>&nbsp;</th>
+            </tr>
+        </tfoot>
+        <tbody>
+{if $haveMemberTypes}
+    {assign var="i" value="0"}
+    {foreach $memberTypes as $t}
+        {if $i++ is odd by 1} 
+            <tr>
+        {else}
+            <tr class="alternate">
+        {/if}
+                <td>
+                    {$t.name}
+                </td>
+                <td>
+                    {$t.descr}
+                </td>
+                <td>
+                    <div class="deleteMemberTypeButton button-primary glm-right" data-memberTypeID="{$t.id}">Delete</div>
+                </td>
+            </tr>
+    {/foreach}
+{else}
+            <tr class="alternate"><td colspan="2">(no member types listed)</td></tr>
+{/if}
+        </tbody>
+    </table>
+
+    <script type="text/javascript">
+        jQuery(document).ready(function($) {
+               
+            $("#newMemberTypeDialog").dialog({
+               autoOpen: false,
+               minWidth: 400,
+                dialogClass: "glm-dialog-no-close"
+            });
+            $("#deleteMemberTypeDialog").dialog({
+                autoOpen: false,
+                minWidth: 400,
+                dialogClass: "glm-dialog-no-close"
+            });
+
+            $('#newMemberTypeButton').click( function() {
+                $("#newMemberTypeDialog").dialog("open");
+            });
+            $('#newMemberTypeConfirm').click( function() {
+                $("#newMemberTypeDialog").dialog("close");
+                window.location.href = "{$thisURL}?page={$thisPage}&glm_action=memberTypes&option=addNew";
+            });
+            $('#newMemberTypeCancel').click( function() {
+                $("#newMemberTypeDialog").dialog("close");
+            });
+
+            var id = false;
+            $('.deleteMemberTypeButton').click( function() {
+                id = $(this).attr('data-memberTypeID');
+                $("#deleteMemberTypeDialog").dialog("open");
+            });
+            $('#deleteMemberTypeConfirm').click( function() {
+                $("#deleteMemberTypeDialog").dialog("close");
+                window.location.href = "{$thisURL}?page={$thisPage}&glm_action=memberTypes&option=delete&memberTypeID=" + id;
+            });
+            $('#deleteMemberTypeCancel').click( function() {
+                $("#deleteMemberTypeDialog").dialog("close");
+            });
+
+        });
+    </script>
+            
+{include file='admin/footer.html'}
diff --git a/views/admin/configure/regions.html b/views/admin/configure/regions.html
new file mode 100644 (file)
index 0000000..aa82f21
--- /dev/null
@@ -0,0 +1,129 @@
+{include file='admin/configure/header.html'}
+
+    <div id="newRegionButton" class="button-primary glm-right">Add a Region</div>
+    <div id="newRegionDialog" class="glm-dialog-box" title="Enter a New Region">
+        <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+            <input type="hidden" name="glm_action" value="regions">
+            <input type="hidden" name="option" value="addNew">
+            
+            <table class="form-table">
+                <tr>
+                    <th class="glm-required">Region Name:</th>
+                    <td>
+                        <input type="text" name="name" class="glm-form-text-input">
+                    </td>
+                </tr>
+                <tr>
+                    <th>Description:</th>
+                    <td>
+                        <textarea name="descr" class="glm-form-textarea"></textarea>
+                    </td>
+                </tr>
+                
+                
+            </table>
+            <p><span class="glm-required">*</span> Required</p>
+            <a id="newRegionCancel" class="button-primary glm-right">Cancel</a>
+            <input type="submit" value="Add new Region">
+            
+        </form>
+    </div>
+    <div id="deleteRegionDialog" class="glm-dialog-box" title="Delete Region">
+        <center>
+            <p>Are you sure you want to delete this region?</p>
+            <p><div id="deleteRegionConfirm" class="button-primary">Yes, delete this region</div></p>
+            <p><div id="deleteRegionCancel" class="button-primary">No, I don't want to delete this region</div></p>
+        </center>
+    </div>
+                    
+    
+    <h2>Cities</h2>
+
+    <table class="wp-list-table widefat fixed posts">
+        <thead>
+            <tr>
+                <th>Region</th>
+                <th>Description</th>
+                <th>Short Description</th>
+                <th>&nbsp;</th>
+            </tr>
+        </thead>
+        <tfoot>
+            <tr>
+                <th>Region</th>
+                <th>Description</th>
+                <th>Short Description</th>
+                <th>&nbsp;</th>
+            </tr>
+        </tfoot>
+        <tbody>
+{if $haveCities}
+    {assign var="i" value="0"}
+    {foreach $regions as $t}
+        {if $i++ is odd by 1} 
+            <tr>
+        {else}
+            <tr class="alternate">
+        {/if}
+                <td>
+                    {$t.name}
+                </td>
+                <td>
+                    {$t.descr}
+                </td>
+                <td>
+                    {$t.short_descr}
+                </td>
+                <td>
+                    <div class="deleteRegionButton button-primary glm-right" data-regionID="{$t.id}">Delete</div>
+                </td>
+            </tr>
+    {/foreach}
+{else}
+            <tr class="alternate"><td colspan="2">(no regions listed)</td></tr>
+{/if}
+        </tbody>
+    </table>
+
+    <script type="text/javascript">
+        jQuery(document).ready(function($) {
+               
+            $("#newRegionDialog").dialog({
+               autoOpen: false,
+               minWidth: 400,
+                dialogClass: "glm-dialog-no-close"
+            });
+            $("#deleteRegionDialog").dialog({
+                autoOpen: false,
+                minWidth: 400,
+                dialogClass: "glm-dialog-no-close"
+            });
+
+            $('#newRegionButton').click( function() {
+                $("#newRegionDialog").dialog("open");
+            });
+            $('#newRegionConfirm').click( function() {
+                $("#newRegionDialog").dialog("close");
+                window.location.href = "{$thisURL}?page={$thisPage}&glm_action=regions&option=addNew";
+            });
+            $('#newRegionCancel').click( function() {
+                $("#newRegionDialog").dialog("close");
+            });
+
+            var id = false;
+            $('.deleteRegionButton').click( function() {
+                id = $(this).attr('data-regionID');
+                $("#deleteRegionDialog").dialog("open");
+            });
+            $('#deleteRegionConfirm').click( function() {
+                $("#deleteRegionDialog").dialog("close");
+                window.location.href = "{$thisURL}?page={$thisPage}&glm_action=regions&option=delete&regionID=" + id;
+            });
+            $('#deleteRegionCancel').click( function() {
+                $("#deleteRegionDialog").dialog("close");
+            });
+
+        });
+    </script>
+            
+{include file='admin/footer.html'}
index 6c97c42..a2dc6e5 100644 (file)
@@ -2,7 +2,7 @@
 
   {if !$deleted}
     <div id="deleteMemberButton" class="button-primary glm-right">Delete this Member</div>
-    <div id="deleteMemberDialog" class="glm-dialog-box">
+    <div id="deleteMemberDialog" class="glm-dialog-box" title="Delete Member">
         <center>
             <p>Are you sure you want to delete this member?</p>
             <p><div id="deleteMemberConfirm" class="button-primary">Yes, delete this member</div></p>
     
     <h2>{$member.name}</h2>
 
-  {if $deleted}
-        <h3 class="glm-notice">Member Has Been Deleted!</h3>
-  {else}
-    {if $member.active.value}
-        <p>This member is active.</p>
-    {else}
-        <h3 class="glm-notice">Member Not Active</h3>
-    {/if}
-  {/if}
+    <h3 class="glm-notice"></h3>
     
     <table>
+        <tr>
+            <th class="glm-table-fieldname">Status</th>
+            <td{if $member.status.name == 'Pending Review'} class="glm-notice"{elseif $member.status.name == 'Active'} class="glm-active"{/if}>
+                {$member.status.name}
+            </td>
+        </tr>
         <tr><th class="glm-table-fieldname">Member Name:</th><td>{$member.name}</td></tr>
         <tr><th class="glm-table-fieldname">Description:</th><td>{$member.descr}</td></tr>
         <tr><th class="glm-table-fieldname">Short Description:</th><td>{$member.short_descr}</td></tr>
@@ -33,6 +31,7 @@
         jQuery(document).ready(function($) {
                $("#deleteMemberDialog").dialog({
                        autoOpen: false,
+                       minWidth: 400,
                        dialogClass: "glm-dialog-no-close"
                });
                $('#deleteMemberButton').click( function() {
index 337a09a..06704f8 100644 (file)
             <tr>
                 <th>Active:</th>
                 <td>
-                    <input type="checkbox" name="active" {if $member.fieldData.active.value}checked="checked"{/if}">
-                    {if $member.fieldFail.name}<p>{$member.fieldFail.name}</p>{/if}
+                    <select name="status">
+        {foreach from=$member.fieldData.status.list item=v}
+                        <option value="{$v.value}"{if $v.default} selected{/if}>{$v.name}</option>
+        {/foreach}
+                    </select>
+                    {if $member.fieldFail.status}<p>{$member.fieldFail.status}</p>{/if}
                 </td>
             </tr>
             <tr>
                 <th>Member Type:</th>
                 <td>
-                    Need to add "enum" type to data abstract.
+                    <select name="member_type">
+        {foreach from=$member.fieldData.member_type.list item=v}
+                        <option value="{$v.value}"{if $v.default} selected{/if}>{$v.name}</option>
+        {/foreach}
+                    </select>
+                    {if $member.fieldFail.member_type}<p>{$member.fieldFail.member_type}</p>{/if}
                 </td>
             </tr>            
             <tr>