Revert "Events nearly ready, menu restructure"
authorChuck Scott <cscott@gaslightmedia.com>
Wed, 20 Apr 2016 21:09:30 +0000 (17:09 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Mon, 25 Apr 2016 17:06:08 +0000 (13:06 -0400)
This reverts commit cf7e68e3b778fd847327402d0b7711c1cad9606d.

24 files changed:
classes/data/dataContacts.php
defines.php
glm-member-db-contacts.php [new file with mode: 0644]
index.php
models/admin/contacts/index.php [deleted file]
models/admin/management/contacts.php [deleted file]
models/admin/member/contacts.php
models/admin/members/contacts.php [new file with mode: 0644]
models/admin/profile/index.php
models/admin/sample/index.php [new file with mode: 0644]
setup/adminMenus.php
setup/adminTabs.php
setup/databaseScripts/create_database_V0.0.1.sql [deleted file]
setup/databaseScripts/dbVersions.php [deleted file]
setup/databaseScripts/drop_database_V0.0.1.sql [deleted file]
setup/databaseScripts/readme.txt [deleted file]
setup/validActions.php
views/admin/contacts/header.html [deleted file]
views/admin/contacts/index.html [deleted file]
views/admin/management/contacts.html [deleted file]
views/admin/member/contacts.html
views/admin/members/contacts.html [new file with mode: 0644]
views/admin/profile/header.html
views/admin/profile/index.html

index a1acb0e..b46800d 100644 (file)
@@ -528,12 +528,12 @@ class GlmDataContacts extends GlmDataAbstract
         }
 
         // Check Contacts
-        $contact = $this->wpdb->get_row("SELECT * FROM ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . "contacts WHERE email = '$email';", ARRAY_A);
+        $contact = $this->wpdb->get_row("SELECT * FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "contacts WHERE email = '$email';", ARRAY_A);
         if ($contact !== null) {
             $r['contactsEmail'] = true;
             $r['active'] = ($r['active'] > 0);
         }
-        $contact = $this->wpdb->get_row("SELECT * FROM ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . "contacts WHERE username = '$username';", ARRAY_A);
+        $contact = $this->wpdb->get_row("SELECT * FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "contacts WHERE username = '$username';", ARRAY_A);
         if ($contact !== null) {
             $r['contactsUsername'] = true;
             $r['active'] = ($r['active'] > 0);
index 0b125be..770948c 100644 (file)
@@ -13,8 +13,7 @@ define('GLM_MEMBERS_CONTACTS_PLUGIN_SLUG', 'glm-member-db-contacts');
 
 // Database table prefixes
 global $wpdb;
-define('GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX', $wpdb->prefix.'glm_membersContacts_');
-define('GLM_MEMBERS_CONTACTS_PLUGIN_ACTIVE_DB_OPTION', 'glmMembersContactsDbVersion');
+define('GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX', $wpdb->prefix.'glm_members_');
 
 
 // Determine which system we're running on - If not provided, assume PRODUCTION
diff --git a/glm-member-db-contacts.php b/glm-member-db-contacts.php
new file mode 100644 (file)
index 0000000..c9c2ee3
--- /dev/null
@@ -0,0 +1,251 @@
+<?php
+/**
+ * Plugin Name: GLM Members Database Contacts
+ * Plugin URI: http://www.gaslightmedia.com/
+ * Description: Gaslight Media Members Database.
+ * Version: 1.0.7
+ * Author: Chuck Scott
+ * Author URI: http://www.gaslightmedia.com/
+ * License: GPL2
+ */
+
+/**
+ * Gaslight Media Members Database Contacts
+ * Index
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPluginChild
+ * @package glmMembersDatabaseContacts
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 1.0.4
+ */
+
+/*
+ *  Plugin and Database Versions
+ *
+ *  Note that the database version matches the version of the last
+ *  plugin version where there was a change in the database.
+ *
+ *  Updates to checkDatabase() in glmPluginSupport.php must be
+ *  made together with the DB_VERSION below. ONLY bump the DB
+ *  version when there's a change in the database!! Use the
+ *  version nunmber of that release for the DB version.
+ */
+define('GLM_MEMBERS_CONTACTS_PLUGIN_VERSION', '1.0.7');
+define('GLM_MEMBERS_CONTACTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.44');
+define('REQUIRED_GLM_MEMBERS_PLUGIN_MIN_DB_VERSION', '1.0.41');
+
+/*
+ * Copyright 2014 Charles Scott (email : cscott@gaslightmedia.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+    die("Please do not call this code directly!");
+}
+
+/*
+* Some initial setup and tests
+*/
+
+$startupNotices = '';
+
+// Get standard defined parameters
+require_once('defines.php');
+
+// Required to be able to get user capabilities when being called as a filter from the main plugin
+require_once(ABSPATH . 'wp-includes/pluggable.php');
+
+/*
+ * Do some checks to make sure the main GLM Member DB is active and of a recceint enough version
+ */
+
+// Function to generate message regarding main GLM Member DB plugin not installed and active
+function glmMembersPluginRequired() {
+    echo '
+        <div class="error">
+            <p>The '.GLM_MEMBERS_CONTACTS_PLUGIN_NAME.' add-on requires the base GLM Member DB plugin to be installed and active!</p>
+            <p>The '.GLM_MEMBERS_CONTACTS_PLUGIN_NAME.' plugin has been de-activated.</p>
+        </div>
+    ';
+}
+
+/*
+ * Check installation, activation, and version of main Member DB plugin
+ */
+include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
+$plugin_name = 'glm-member-db/glm-member-db.php';
+$is_active = is_plugin_active($plugin_name);
+
+// If it's not active, then warn user and deactivate this add-on plugin
+if ($is_active != '1') {
+    add_action( 'admin_notices', 'glmMembersPluginRequired' );
+    deactivate_plugins('/'.GLM_MEMBERS_CONTACTS_PLUGIN_SLUG.'/'.GLM_MEMBERS_CONTACTS_PLUGIN_SLUG.'.php');
+}
+
+// Function to generate message regarding main GLM Member DB plugin version is not receint enought to run this add-on
+function glmMembersContactsMembersMinVerRequired() {
+    $curVer = get_option('glmMembersDatabasePluginVersion');
+    echo '
+        <div class="error">
+            <p>The '.GLM_MEMBERS_CONTACTS_PLUGIN_NAME.' requires that the main GLM Member DB plugin version be no older than '
+                    .GLM_MEMBERS_CONTACTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION.' but the current verssion is '.$curVer.'!</p>
+            <p>The '.GLM_MEMBERS_CONTACTS_PLUGIN_NAME.' plugin has been de-activated.</p>
+        </div>
+    ';
+}
+
+/*
+ * Check for Minimum DB version for main Member DB
+ */
+$glmMembersDatabasePluginVersion = get_option('glmMembersDatabasePluginVersion');
+if (version_compare($glmMembersDatabasePluginVersion, GLM_MEMBERS_CONTACTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION) < 0) {
+    add_action( 'admin_notices', 'glmMembersContactsMembersMinVerRequired');
+    deactivate_plugins('/'.GLM_MEMBERS_CONTACTS_PLUGIN_SLUG.'/'.GLM_MEMBERS_CONTACTS_PLUGIN_SLUG.'.php');
+}
+
+/*
+ * Register this add-on with the main GLM Member DB plugin and get information on all add-ons loaded.
+ */
+require_once(GLM_MEMBERS_CONTACTS_PLUGIN_SETUP_PATH.'/validActions.php');
+// require_once(GLM_MEMBERS_CONTACTS_PLUGIN_DB_SCRIPTS.'/dbVersions.php');
+function glmMembersRegisterContacts($addOns) {
+
+    // Add this add-on to the add-ons array
+    $addOns[GLM_MEMBERS_CONTACTS_PLUGIN_SLUG] =  array(
+            'dir' => GLM_MEMBERS_CONTACTS_PLUGIN_PATH,
+            'name' =>  GLM_MEMBERS_CONTACTS_PLUGIN_NAME,
+            'short_name' => GLM_MEMBERS_CONTACTS_PLUGIN_SHORT_NAME,
+            'slug' => GLM_MEMBERS_CONTACTS_PLUGIN_SLUG,
+            'actions' => $GLOBALS['glmMembersContactsAddOnValidActions'],
+            'database' => false
+    );
+
+    // Return the array with our data added
+    return $addOns;
+}
+add_filter('glm-member-db-register-addon','glmMembersRegisterContacts', 10, 1);
+
+ /*
+  *
+  * Activate and Deactivate hooks
+  *
+ */
+
+ // Activate
+ function glmMembersContactsPluginActivate ()
+ {
+     global $wpdb, $config;
+     require_once (GLM_MEMBERS_CONTACTS_PLUGIN_PATH . '/activate.php');
+     new glmMembersContactsPluginActivate($wpdb, $config);
+ }
+ register_activation_hook(__FILE__, 'glmMembersContactsPluginActivate');
+
+ // Deactivate
+ function glmMembersContactsPluginDeactivate ()
+ {
+     global $wpdb, $config;
+     require_once (GLM_MEMBERS_CONTACTS_PLUGIN_PATH . '/deactivate.php');
+     $x = new glmMembersContactsPluginDeactivate($wpdb, $config);
+     return false;
+ }
+ register_deactivation_hook(__FILE__, 'glmMembersContactsPluginDeactivate');
+
+/*
+ * Hooks for testing capabilities provided by this add-on
+ */
+require_once(GLM_MEMBERS_CONTACTS_PLUGIN_SETUP_PATH.'/permissions.php');
+
+/*
+ * Login Checks and Messages
+ */
+
+$wpUserID = get_current_user_id();
+
+// Message to display on Login page after a forced logout detection
+function glmMembersContactsNoLoginMessage( $message ) {
+        $message .= "
+            <div style=\"border-left:4px solid #dd3d36;background:#fff;box-shadow:0 1px 1px 0 rgba(0,0,0,.1);padding-left: .5em;\">
+                <p><b>NOTE:</b> You are trying to log into a contact account that is for informational purposes only
+                    or has been temporarily dissabled.</p>
+                <p>You are not permitted to log in with that contact account at this time.</p>
+            </div>
+        ";
+        return $message;
+}
+
+// If login is from user who was logged out due to restriction or being flagged inactive - Display login message
+if (isset($_COOKIE['glmMembersForcedLogout'])) {
+    add_filter('login_message', 'glmMembersContactsNoLoginMessage');
+    setcookie ("glmMembersForcedLogout", "", time() - 3600);
+}
+
+if ($wpUserID) {
+
+    // Check if user's only role is as a restricted contact
+    $userRoles = get_userdata($wpUserID)->roles;
+    if (in_array('glm_members_restricted_contact', $userRoles) && count($userRoles) == 1) {
+        setcookie ("glmMembersForcedLogout", "Forced Logout", time() + 3600, '/');
+        wp_logout();
+    }
+
+    // Check for a contact user that's inactive and send them back to login also
+    $contactUser = get_user_meta($wpUserID, 'glmMembersContactID', true);
+    $contactActive = get_user_meta($wpUserID, 'glmMembersContactActive', true);
+    if ($contactUser && !$contactActive) {
+        setcookie ("glmMembersForcedLogout", "Forced Logout", time() + 3600, '/');
+        wp_logout();
+    }
+
+}
+
+/*
+ * Add filter to redirect user to a particular destination on
+ * login based on their roles.
+ */
+
+function my_login_redirect( $redirect_to, $request, $user ) {
+
+    global $user;
+
+    // Do we have a logged in user
+    if ( isset( $user->roles ) && is_array( $user->roles ) ) {
+
+        // If this is a non-contact user or one with a pre-existing non-contact login
+        foreach ($user->roles as $r) {
+            if (substr($r,0,12) != 'glm_members_') {
+                // Go to normal destination for this user
+                return $redirect_to;
+            }
+        }
+
+        // If we get here, this is a pure contact user, start them at their profile
+
+        return '/wp-admin/admin.php?page=glm-members-admin-menu-member';
+
+    }
+
+    // No logged in user - So why is the "login_redirect" filter triggered anyway?
+    return $redirect_to;
+
+}
+add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );
+
+
+?>
\ No newline at end of file
index eda15a1..7e91415 100644 (file)
--- a/index.php
+++ b/index.php
@@ -1,260 +1,2 @@
 <?php
-/**
- * Plugin Name: GLM Members Database Contacts
- * Plugin URI: http://www.gaslightmedia.com/
- * Description: Gaslight Media Members Database.
- * Version: 1.0.7
- * Author: Chuck Scott
- * Author URI: http://www.gaslightmedia.com/
- * License: GPL2
- */
-
-/**
- * Gaslight Media Members Database Contacts
- * Index
- *
- * PHP version 5.5
- *
- * @category glmWordPressPluginChild
- * @package glmMembersDatabaseContacts
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- * @version 1.0.4
- */
-
-/*
- *  Plugin and Database Versions
- *
- *  Note that the database version matches the version of the last
- *  plugin version where there was a change in the database.
- *
- *  Updates to checkDatabase() in glmPluginSupport.php must be
- *  made together with the DB_VERSION below. ONLY bump the DB
- *  version when there's a change in the database!! Use the
- *  version nunmber of that release for the DB version.
- */
-define('GLM_MEMBERS_CONTACTS_PLUGIN_VERSION', '1.0.7');
-define('GLM_MEMBERS_CONTACTS_PLUGIN_DB_VERSION', '0.0.1');
-
-// This is the minimum version of the GLM Members DB plugin require for this plugin.
-define('GLM_MEMBERS_CONTACTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.58');
-define('REQUIRED_GLM_MEMBERS_PLUGIN_MIN_DB_VERSION', '1.0.41');
-
-/*
- * Copyright 2014 Charles Scott (email : cscott@gaslightmedia.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License, version 2, as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-
-// Check that we're being called by WordPress.
-if (!defined('ABSPATH')) {
-    die("Please do not call this code directly!");
-}
-
-/*
-* Some initial setup and tests
-*/
-
-$startupNotices = '';
-
-// Get standard defined parameters
-require_once('defines.php');
-
-// Required to be able to get user capabilities when being called as a filter from the main plugin
-require_once(ABSPATH . 'wp-includes/pluggable.php');
-
-/*
- * Do some checks to make sure the main GLM Member DB is active and of a recceint enough version
- */
-
-// Function to generate message regarding main GLM Member DB plugin not installed and active
-function glmMembersPluginRequired() {
-    echo '
-        <div class="error">
-            <p>The '.GLM_MEMBERS_CONTACTS_PLUGIN_NAME.' add-on requires the base GLM Member DB plugin to be installed and active!</p>
-            <p>The '.GLM_MEMBERS_CONTACTS_PLUGIN_NAME.' plugin has been de-activated.</p>
-        </div>
-    ';
-}
-
-/*
- * Check installation, activation, and version of main Member DB plugin
- */
-include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
-$plugin_name = 'glm-member-db/index.php';
-$is_active = is_plugin_active($plugin_name);
-
-// If it's not active, then warn user and deactivate this add-on plugin
-if ($is_active != '1') {
-    add_action( 'admin_notices', 'glmMembersPluginRequired' );
-    deactivate_plugins('/'.GLM_MEMBERS_CONTACTS_PLUGIN_SLUG.'/'.GLM_MEMBERS_CONTACTS_PLUGIN_SLUG.'.php');
-}
-
-// Function to generate message regarding main GLM Member DB plugin version is not receint enought to run this add-on
-function glmMembersContactsMembersMinVerRequired() {
-    $curVer = get_option('glmMembersDatabasePluginVersion');
-    echo '
-        <div class="error">
-            <p>The '.GLM_MEMBERS_CONTACTS_PLUGIN_NAME.' requires that the main GLM Member DB plugin version be no older than '
-                    .GLM_MEMBERS_CONTACTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION.' but the current verssion is '.$curVer.'!</p>
-            <p>The '.GLM_MEMBERS_CONTACTS_PLUGIN_NAME.' plugin has been de-activated.</p>
-        </div>
-    ';
-}
-
-/*
- * Check for Minimum DB version for main Member DB
- */
-$glmMembersDatabasePluginVersion = get_option('glmMembersDatabasePluginVersion');
-if (version_compare($glmMembersDatabasePluginVersion, GLM_MEMBERS_CONTACTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION) < 0) {
-    add_action( 'admin_notices', 'glmMembersContactsMembersMinVerRequired');
-    deactivate_plugins('/'.GLM_MEMBERS_CONTACTS_PLUGIN_SLUG.'/'.GLM_MEMBERS_CONTACTS_PLUGIN_SLUG.'.php');
-}
-
-/*
- * Register this add-on with the main GLM Member DB plugin and get information on all add-ons loaded.
- */
-require_once(GLM_MEMBERS_CONTACTS_PLUGIN_SETUP_PATH.'/validActions.php');
-require_once(GLM_MEMBERS_CONTACTS_PLUGIN_DB_SCRIPTS.'/dbVersions.php');
-function glmMembersRegisterContacts($addOns) {
-
-    // Add this add-on to the add-ons array
-    $addOns[GLM_MEMBERS_CONTACTS_PLUGIN_SLUG] =  array(
-            'dir' => GLM_MEMBERS_CONTACTS_PLUGIN_PATH,
-            'name' =>  GLM_MEMBERS_CONTACTS_PLUGIN_NAME,
-            'short_name' => GLM_MEMBERS_CONTACTS_PLUGIN_SHORT_NAME,
-            'slug' => GLM_MEMBERS_CONTACTS_PLUGIN_SLUG,
-            'actions' => $GLOBALS['glmMembersContactsAddOnValidActions'],
-            'database' => array(
-                'dbPrefix' => GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX,
-                'dbCurrentVersion' => GLM_MEMBERS_CONTACTS_PLUGIN_DB_VERSION,
-                'dbActiveVersionOption' => GLM_MEMBERS_CONTACTS_PLUGIN_ACTIVE_DB_OPTION,
-                'dbScriptPath' => GLM_MEMBERS_CONTACTS_PLUGIN_DB_SCRIPTS,
-                'dbVersions' => $GLOBALS['glmMembersContactsDbVersions']
-            )
-    );
-
-    // Return the array with our data added
-    return $addOns;
-}
-add_filter('glm-member-db-register-addon','glmMembersRegisterContacts', 10, 1);
-
- /*
-  *
-  * Activate and Deactivate hooks
-  *
- */
-
- // Activate
- function glmMembersContactsPluginActivate ()
- {
-     global $wpdb, $config;
-     require_once (GLM_MEMBERS_CONTACTS_PLUGIN_PATH . '/activate.php');
-     new glmMembersContactsPluginActivate($wpdb, $config);
- }
- register_activation_hook(__FILE__, 'glmMembersContactsPluginActivate');
-
- // Deactivate
- function glmMembersContactsPluginDeactivate ()
- {
-     global $wpdb, $config;
-     require_once (GLM_MEMBERS_CONTACTS_PLUGIN_PATH . '/deactivate.php');
-     $x = new glmMembersContactsPluginDeactivate($wpdb, $config);
-     return false;
- }
- register_deactivation_hook(__FILE__, 'glmMembersContactsPluginDeactivate');
-
-/*
- * Hooks for testing capabilities provided by this add-on
- */
-require_once(GLM_MEMBERS_CONTACTS_PLUGIN_SETUP_PATH.'/permissions.php');
-
-/*
- * Login Checks and Messages
- */
-
-$wpUserID = get_current_user_id();
-
-// Message to display on Login page after a forced logout detection
-function glmMembersContactsNoLoginMessage( $message ) {
-        $message .= "
-            <div style=\"border-left:4px solid #dd3d36;background:#fff;box-shadow:0 1px 1px 0 rgba(0,0,0,.1);padding-left: .5em;\">
-                <p><b>NOTE:</b> You are trying to log into a contact account that is for informational purposes only
-                    or has been temporarily dissabled.</p>
-                <p>You are not permitted to log in with that contact account at this time.</p>
-            </div>
-        ";
-        return $message;
-}
-
-// If login is from user who was logged out due to restriction or being flagged inactive - Display login message
-if (isset($_COOKIE['glmMembersForcedLogout'])) {
-    add_filter('login_message', 'glmMembersContactsNoLoginMessage');
-    setcookie ("glmMembersForcedLogout", "", time() - 3600);
-}
-
-if ($wpUserID) {
-
-    // Check if user's only role is as a restricted contact
-    $userRoles = get_userdata($wpUserID)->roles;
-    if (in_array('glm_members_restricted_contact', $userRoles) && count($userRoles) == 1) {
-        setcookie ("glmMembersForcedLogout", "Forced Logout", time() + 3600, '/');
-        wp_logout();
-    }
-
-    // Check for a contact user that's inactive and send them back to login also
-    $contactUser = get_user_meta($wpUserID, 'glmMembersContactID', true);
-    $contactActive = get_user_meta($wpUserID, 'glmMembersContactActive', true);
-    if ($contactUser && !$contactActive) {
-        setcookie ("glmMembersForcedLogout", "Forced Logout", time() + 3600, '/');
-        wp_logout();
-    }
-
-}
-
-/*
- * Add filter to redirect user to a particular destination on
- * login based on their roles.
- */
-
-function my_login_redirect( $redirect_to, $request, $user ) {
-
-    global $user;
-
-    // Do we have a logged in user
-    if ( isset( $user->roles ) && is_array( $user->roles ) ) {
-
-        // If this is a non-contact user or one with a pre-existing non-contact login
-        foreach ($user->roles as $r) {
-            if (substr($r,0,12) != 'glm_members_') {
-                // Go to normal destination for this user
-                return $redirect_to;
-            }
-        }
-
-        // If we get here, this is a pure contact user, start them at their profile
-
-        return '/wp-admin/admin.php?page=glm-members-admin-menu-member';
-
-    }
-
-    // No logged in user - So why is the "login_redirect" filter triggered anyway?
-    return $redirect_to;
-
-}
-add_filter( 'login_redirect', 'my_login_redirect', 10, 3 );
-
-
-?>
\ No newline at end of file
+// Silence is golden.
\ No newline at end of file
diff --git a/models/admin/contacts/index.php b/models/admin/contacts/index.php
deleted file mode 100644 (file)
index 8a02df3..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-<?php
-
-/**
- * Gaslight Media Members Database
- * Admin Full Contacts List
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Chuck Scott <cscott@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link     http://dev.gaslightmedia.com/
- */
-
-// Load Contacts data abstract
-require_once(GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php');
-
-/*
- * This model is called when the "Shortcodes" menu is selected
- *
- */
-class GlmMembersAdmin_contacts_index extends GlmDataContacts
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * Plugin Configuration Data
-     *
-     * @var $config
-     * @access public
-     */
-    public $config;
-    /**
-     * Contacts List
-     *
-     * @var $contacts
-     * @access public
-     */
-    public $contacts;
-
-    /*
-     * Constructor
-     *
-     * This contructor performs the work for this model. This model returns
-     * an array containing the following.
-     *
-     * 'status'
-     *
-     * True if successfull and false if there was a fatal failure.
-     *
-     * '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.
-     *
-     * @wpdb object WordPress database object
-     *
-     * @return array Array containing status, suggested view, and any data
-     */
-    public function __construct ($wpdb, $config)
-    {
-
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
-
-        // Save plugin configuration object
-        $this->config = $config;
-
-        // Run constructor for contacts data class
-        parent::__construct(false, false);
-
-    }
-
-    public function modelAction($actionData = false) {
-
-        $haveContacts = false;
-        $filterArchived = false;
-        $filterText = false;
-        $haveFilter = false;
-
-            // Only list member contacts for the selected member
-        $where = "true";
-
-        // Filter by text string supplied
-        if (isset($_REQUEST['filterText'])) {
-            $filterText = esc_sql($_REQUEST['filterText']);
-            $where .= " AND (
-                T.lname LIKE '%$filterText%' OR
-                T.fname LIKE '%$filterText%' OR
-                T.org LIKE '%$filterText%' OR
-                T.descr LIKE '%$filterText%'
-            )";
-            $haveFilter = true;
-        }
-
-        // Check if this is a request to show archived contacts
-        if (!isset($_REQUEST['filterArchived'])) {
-            $where .= " AND T.access != ".$this->config['access_numb']['Archived'];
-            $filterArchived = false;
-        } else {
-            $filterArchived = true;
-            $haveFilter = true;
-        }
-
-        // Get list of contacts
-        $this->contacts = $this->getList($where);
-
-        if ($this->contacts !== false) {
-            if (count($this->contacts) > 0) {
-                $haveContacts = true;
-            }
-        }
-
-        // Compile template data
-        $templateData = array(
-            'haveContacts' => $haveContacts,
-            'contacts' => $this->contacts,
-            'filterArchived' => $filterArchived,
-            'filterText' => $filterText,
-            'haveFilter' => $haveFilter
-        );
-
-        // Return status, any suggested view, and any data to controller
-        return array(
-                'status' => true,
-                'modelRedirect' => false,
-                'view' => 'admin/contacts/index.html',
-                'data' => $templateData
-        );
-
-    }
-}
-
-?>
\ No newline at end of file
diff --git a/models/admin/management/contacts.php b/models/admin/management/contacts.php
deleted file mode 100644 (file)
index a9b8d13..0000000
+++ /dev/null
@@ -1,709 +0,0 @@
-<?php
-/**
- * Gaslight Media Members Database
- * GLM Members DB - Contacts Add-on - Management Contacts Tab
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Chuck Scott <cscott@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @release  contacts.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link     http://dev.gaslightmedia.com/
- */
-
-require_once(GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php');
-
-/**
- * GlmMembersAdmin_management_contacts
- *
- * PHP version 5
- *
- * @category Model
- * @package GLM Member DB
- * @author  Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- *          @release SVN: $Id: packaging.php,v 1.0 2011/01/25 19:31:47 cscott
- *          Exp $
- */
-class GlmMembersAdmin_management_contacts extends GlmDataContacts
-{
-
-    /**
-     * WordPress Database Object
-     *
-     * @var $wpdb
-     * @access public
-     */
-    public $wpdb;
-    /**
-     * dbh Postgres database connection
-     *
-     * @var mixed
-     * @access public
-     */
-    public $dbh;
-    /**
-     * settings used for the schema and tablenames
-     *
-     * @var mixed
-     * @access public
-     */
-    public $settings = array();
-    /**
-     * contacts
-     *
-     * @var bool
-     * @access public
-     */
-    public $contacts = array();
-
-    /**
-     * Constructor
-     *
-     * This contructor performs the work for this model. This model returns
-     * an array containing the following.
-     *
-     * 'status'
-     *
-     * True if successfull and false if there was a fatal failure.
-     *
-     * '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.
-     *
-     * @wpdb object WordPress database object
-     *
-     * @return array Array containing status, suggested view, and any data
-     */
-    public function __construct ($wpdb, $config)
-    {
-
-        // Save WordPress Database object
-        $this->wpdb = $wpdb;
-
-        // Save plugin configuration object
-        $this->config = $config;
-
-        // Run constructor for members data class
-        parent::__construct(false, false);
-
-    }
-
-/*
-    public function importContactImages()
-    {
-        require_once(GLM_MEMBERS_PLUGIN_PATH.'/models/admin/ajax/imageUpload.php');
-        $ImageUpload = new GlmMembersAdmin_ajax_imageUpload($this->wpdb, $this->config);
-        // get all events with images
-        $sql = "
-        SELECT id,image,old_event_id
-          FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX. "events
-         WHERE image != '' AND image IS NOT NULL";
-        $results = $this->wpdb->get_results($sql, ARRAY_A);
-        echo '<pre>$results: ' . print_r($results, true) . '</pre>';
-        $imgUrl = 'http://is0.gaslightmedia.com/discoverkalamazoo/CKImage/';
-        foreach ( $results as $event ) {
-            $imageFullUrl = $imgUrl . $event['image'];
-            $res = $ImageUpload->storeImage($imageFullUrl);
-
-            if ( $res['newFileName'] ) {
-                $this->wpdb->update(
-                    GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events',
-                    array(
-                        'image' => $res['newFileName']
-                    ),
-                    array( 'id' => $event['id'] ),
-                    array( '%s' ),
-                    array( '%d' )
-                );
-            }
-        }
-    }
-*/
-
-    /**
-     * modelAction
-     *
-     * @param bool $actionData
-     * @access public
-     * @return void
-     */
-    public function modelAction($actionData = false)
-    {
-
-/*
-        $option              = false;
-        $testResult          = false;
-        $importResult        = false;
-        $settingsUpdated     = false;
-        $settingsUpdateError = false;
-        $eventsSettings      = false;
-
-        if (isset($_REQUEST['option'])) {
-            $option = $_REQUEST['option'];
-        }
-
-        switch ($option) {
-
-            case 'tests':
-
-                $test = false;
-                if (isset($_REQUEST['test'])) {
-                    $test = $_REQUEST['test'];
-                }
-
-                switch ($test) {
-
-                    case 'recurrence':
-
-                        $testResult = $this->testRecurrence();
-
-                        break;
-
-                    default:
-                        break;
-                }
-
-                break;
-
-            case 'eventImagesImport':
-
-                $this->importEventImages();
-
-                break;
-
-            case 'eventimport':
-
-                $import = false;
-                if (isset($_REQUEST['import'])) {
-                    $import = filter_var( $_REQUEST['import'], FILTER_VALIDATE_BOOLEAN );
-                }
-                switch ($import) {
-                    case 'true':
-                        $importResult = '<pre>$_REQUEST: ' . print_r( $_REQUEST, true ) . '</pre>';
-                        $db_host      = filter_var( $_REQUEST['db_host'], FILTER_SANITIZE_STRING );
-                        $db_name      = filter_var( $_REQUEST['db_name'], FILTER_SANITIZE_STRING );
-                        $db_user      = filter_var( $_REQUEST['db_user'], FILTER_SANITIZE_STRING );
-                        $db_password  = filter_var( $_REQUEST['db_password'], FILTER_SANITIZE_STRING );
-                        $this->connectPostgresDb($db_host, $db_name, $db_user, $db_password);
-
-                        $this->settings = filter_var_array(
-                            $_REQUEST,
-                            array(
-                                'schema'       => FILTER_SANITIZE_STRING,
-                                'cattablename' => FILTER_SANITIZE_STRING,
-                                'tablename'    => FILTER_SANITIZE_STRING,
-                                'sdate'        => array(
-                                    'filter'  => FILTER_VALIDATE_REGEXP,
-                                    'options' => array(
-                                        'regexp' => '%[0-9]{2}/[0-9]{2}/[0-9]{4}%'
-                                    )
-                                )
-
-                            )
-                        );
-                        $importResult .= '<pre>$this->settings: ' . print_r($this->settings, true) . '</pre>';
-                        $this->addCategories();
-                        $importResult .= $this->addEvents();
-
-                        $importResult .= '<pre>$this->categories: ' . print_r($this->categories, true) . '</pre>';
-
-
-                        break;
-                    default:
-                        break;
-                }
-                break;
-
-            case 'settings':
-
-            default:
-
-                // Make sure option is set if default
-                $option = 'settings';
-
-                // Determine if current user can edit configurations
-                if (!current_user_can('glm_members_management')) {
-                    return array(
-                        'status'           => false,
-                        'menuItemRedirect' => 'error',
-                        'modelRedirect'    => 'index',
-                        'view'             => 'admin/error/index.html',
-                        'data'             => array(
-                            'reason' => 'User does not have rights to make configuration changes.'
-                        )
-                    );
-                }
-
-                // Check for submission option
-                $option2 = '';
-                if (isset($_REQUEST['option2'])) {
-                    $option2 = $_REQUEST['option2'];
-                }
-
-                switch($option2) {
-
-                    // Update the settings and redisplay the form
-                    case 'submit':
-
-                        // Update the event management settings
-                        $eventsSettings = $this->updateEntry(1);
-                        if ($eventsSettings['status']) {
-                            $settingsUpdated = true;
-                        } else {
-                            $settingsUpdateError = true;
-                        }
-
-                        break;
-
-                    // Default is to get the current settings and display the form
-                    default:
-
-                        // Try to get the first (should be only) entry for general settings.
-                        $eventsSettings = $this->editEntry(1);
-
-                        if ($eventsSettings === false) {
-
-                            if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
-                                glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;/models/admin/management/events.php: Unable to load events management settings.", 'Alert');
-                            }
-
-                        }
-
-                        break;
-
-                }
-
-                break;
-
-        }
-*/
-
-        // Compile template data
-        $templateData = array(
-/*
-            'option'              => $option,
-            'testResult'          => $testResult,
-            'importResult'        => $importResult,
-            'settingsUpdated'     => $settingsUpdated,
-            'settingsUpdateError' => $settingsUpdateError,
-            'eventsSettings'      => $eventsSettings
-*/
-        );
-
-        // Return status, suggested view, and data to controller
-        return array(
-            'status'           => true,
-            'menuItemRedirect' => false,
-            'modelRedirect'    => false,
-            'view'             => 'admin/management/contacts.html',
-            'data'             => $templateData
-        );
-
-
-    }
-
-    /**
-     * connectPostgresDb
-     *
-     * Make a connection to the given database for the site. (postgres)
-     * Sets the $this->dbh with the postgers database connection
-     *
-     * @param mixed $db_host
-     * @param mixed $db_name
-     * @param mixed $db_user
-     * @param mixed $db_password
-     * @access public
-     * @return void
-     */
-    public function connectPostgresDb($db_host, $db_name, $db_user, $db_password)
-    {
-        $connStr      = "pgsql:";
-        if ( $db_host ) {
-            $connPart[] = "host={$db_host}";
-        }
-        if ( $db_name ) {
-            $connPart[] = "dbname={$db_name}";
-        }
-        if ( $db_user ) {
-            $connPart[] = "user={$db_user}";
-        }
-        if ( $db_password ) {
-            $connPart[] = "password={$db_password}";
-        }
-        if ( !empty($connPart) ) {
-             $connStr .= implode( " ", $connPart );
-        }
-        $driverOptions = array(
-            PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_BOTH,
-        );
-        try {
-            $this->dbh = new PDO($connStr, null, null, $driverOptions);
-            $this->dbh->setAttribute(
-                PDO::ATTR_ERRMODE,
-                PDO::ERRMODE_EXCEPTION
-            );
-        } catch(PDOException $e) {
-            echo '<pre>$e: ' . print_r($e, true) . '</pre>';
-            wp_die();
-        }
-    }
-
-    /**
-     * addContacts
-     *
-     * Start with contacts tables. ( delete all contact data )
-     * Grab all contacts
-     * Enter them into the new contact tables and as WordPress users as required.
-     *
-     * @access public
-     * @return void
-     */
-    public function addContacts()
-    {
-        return false;
-
-        // clear the contactss tables first
-        $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events" );
-        $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "recurrences" );
-        $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "times" );
-        $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "event_categories" );
-        $this->wpdb->query( "DELETE FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "locations" );
-        $Recurrences = new GlmDataEventsRecurrences($this->wpdb, $this->config);
-        $return      = '';
-        $sql         = "
-        SELECT *
-          FROM {$this->settings['schema']}.{$this->settings['tablename']}
-         WHERE edate >= '{$this->settings['sdate']}'::DATE";
-        //$sql .=" AND reacur ";
-        try {
-            $events = $this->dbh->query($sql)->fetchAll(PDO::FETCH_ASSOC);
-            $return .= '<pre>$events: ' . print_r($events, true) . '</pre>';
-            foreach ( $events as $event ) {
-                $foundMemberId = $refType = null;
-                if ( $event['member_id'] ) {
-                    // get the new member id
-                    $sql = "
-                    SELECT id
-                      FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "members
-                     WHERE old_member_id = '" . esc_sql( trim($event['member_id']) ) . "'";
-                    $foundMemberId = $this->wpdb->get_row($sql, ARRAY_A);
-                    if ( $foundMemberId ) {
-                        $foundMemberId = $foundMemberId['id'];
-                        $refType = $this->config['ref_type_numb']['Member'];
-                    }
-                }
-                var_dump($foundMemberId);
-                // see if event is in there by old_event_id
-                $sql = "
-                SELECT id
-                  FROM " . GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . "events
-                 WHERE old_event_id = '" . esc_sql( trim($event['id']) ) . "'";
-                $found = $this->wpdb->get_row($sql, ARRAY_A);
-                //echo '<pre>$found: ' . print_r($found, true) . '</pre>';
-                $intro = substr(strip_tags($event['descr']), 0, 250);
-                if ( isset($found) ) {
-                    $this->wpdb->update(
-                        GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events',
-                        array(
-                            'status'   => (($event['visable'])
-                                ? $this->config['status_numb']['Active']
-                                : $this->config['status_numb']['Inactive']),
-                            'created'       => $event['create_date'],
-                            'updated'       => $event['create_date'],
-                            'approved'      => $event['approved_date'],
-                            'name'          => $event['header'],
-                            'intro'         => $intro,
-                            'descr'         => $event['descr'],
-                            'image'         => $event['img'],
-                            'cost'          => $event['cost'],
-                            'url'           => $event['url'],
-                            'ref_type'      => $refType,
-                            'ref_dest'      => $foundMemberId,
-                            'admin_name'    => $event['admin_contact_name'],
-                            'admin_org'     => $event['admin_org_name'],
-                            'admin_email'   => $event['admin_email'],
-                            'admin_phone'   => $event['admin_phone'],
-                            'contact_email' => $event['email'],
-                            'contact_name'  => $event['contact'],
-                            'contact_phone' => $event['phone'],
-                            'notes'         => $event['notes'],
-                            'hide_address'  => $event['notes'],
-                        ),
-                        array( 'old_event_id' => $event['id'] ),
-                        array(
-                             '%d',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%d',
-                             '%d',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                        ),
-                        array( '%d' )
-                    );
-                    $eventId  = $found['id'];
-                } else {
-                    $eventData = array(
-                            'status'   => (($event['visable'] == '1')
-                                ? $this->config['status_numb']['Active']
-                                : $this->config['status_numb']['Inactive']),
-                            'created'       => $event['create_date'],
-                            'updated'       => $event['create_date'],
-                            'approved'      => $event['approved_date'],
-                            'name'          => $event['header'],
-                            'intro'         => $intro,
-                            'descr'         => $event['descr'],
-                            'image'         => $event['img'],
-                            'cost'          => $event['cost'],
-                            'url'           => $event['url'],
-                            'old_event_id'  => $event['id'],
-                            'ref_type'      => $refType,
-                            'ref_dest'      => $foundMemberId,
-                            'admin_name'    => $event['admin_contact_name'],
-                            'admin_org'     => $event['admin_org_name'],
-                            'admin_email'   => $event['admin_email'],
-                            'admin_phone'   => $event['admin_phone'],
-                            'contact_email' => $event['email'],
-                            'contact_name'  => $event['contact'],
-                            'contact_phone' => $event['phone'],
-                            'notes'         => $event['notes'],
-                            'hide_address'  => $event['notes'],
-                        );
-                    echo '<pre>$eventData: ' . print_r($eventData, true) . '</pre>';
-                    echo '</pre>';
-                    $this->wpdb->insert(
-                        GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events',
-                        $eventData,
-                        array(
-                             '%d',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%d',
-                             '%d',
-                             '%d',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                             '%s',
-                        )
-                    );
-                    $eventId  = $this->wpdb->insert_id;
-                    //var_dump( $eventId );
-                    //echo '<pre>$eventId: from insert ' . print_r($eventId, true) . '</pre>';
-                    if ( !$eventId ) {
-                        echo '<pre>SQL Error: ' . $this->wpdb->last_error . '</pre>';
-                    }
-                }
-                // checking for $eventId
-                //echo '<pre>$eventId: ' . print_r($eventId, true) . '</pre>';
-                if (!$eventId) {
-                    die('something is wrong no eventId');
-                }
-                // generate the slug name for this new event
-                $eventAbstract = new GlmDataEvents($this->wpdb, $this->config);
-                $eventAbstract->updateSlug($eventId);
-                // category for event
-                if ( $event['topicid'] ) {
-                    $this->wpdb->insert(
-                        GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'event_categories',
-                        array(
-                            'event'    => $eventId,
-                            'category' => $this->oldCatMap[$event['topicid']]
-                        ),
-                        array(
-                            '%d',
-                            '%d'
-                        )
-                    );
-                }
-                // recurrences for the event
-                $allDates  = $event['reacur'];
-                if ( $allDates && ( $event['bdate'] == $event['edate'] ) ) {
-                    $allDates = 0;
-                }
-                $allDay    = $event['all_day'];
-                $dayOfWeek =
-                $monthOfYear =
-                $weekOfMonth =
-                $byDayOfMonth =
-                $lastDayOfMonth = null;
-                if ( $allDates ) {
-                    if ( $event['daysow'] ) {
-                        $dayOfWeek = $event['daysow'];
-                    }
-                    if ( $event['weekom'] ) {
-                        switch ($event['weekom']) {
-                        case '1':
-                            $weekOfMonth = 1;
-                            break;
-                        case '2':
-                            $weekOfMonth = 2;
-                            break;
-                        case '3':
-                            $weekOfMonth = 4;
-                            break;
-                        case '4':
-                            $weekOfMonth = 8;
-                            break;
-                        case '5':
-                            $weekOfMonth = 16;
-                            break;
-                        }
-                    } else {
-                        $weekOfMonth = 63;
-                    }
-                    $monthOfYear = 4095;
-                }
-                $btime = $this->getTime($event['btime']);
-                $etime = $this->getTime($event['etime']);
-                $recurData =array(
-                    'event'             => $eventId,
-                    'start_time'        => $btime,
-                    'end_time'          => $etime,
-                    'from_date'         => $event['bdate'],
-                    'to_date'           => $event['edate'],
-                    'all_day'           => $allDay,
-                    'recurring'         => $allDates,
-                    'month_of_year'     => $monthOfYear,
-                    'week_of_month'     => $weekOfMonth,
-                    'day_of_week'       => $dayOfWeek,
-                    'by_day_of_month'   => $byDayOfMonth,
-                    'last_day_of_month' => $lastDayOfMonth
-                );
-                //echo '<pre>' . print_r( $recurData, true) . '</pre>';
-                echo '<pre>$recurData: ' . print_r($recurData, true) . '</pre>';
-                $this->wpdb->insert(
-                    GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'recurrences',
-                    $recurData,
-                    array(
-                         '%d',
-                         '%s',
-                         '%s',
-                         '%s',
-                         '%s',
-                         '%d',
-                         '%d',
-                         '%d',
-                         '%d',
-                         '%d',
-                         '%d',
-                         '%d',
-                    )
-                );
-                $recurId    = $this->wpdb->insert_id;
-                $Recurrences->createRecurrenceTimesEntries( $recurId, true, true );
-                // location for the event
-                $hasLocation = (
-                    ($event['loc'])
-                    || ($event['contact'])
-                    || ($event['phone'])
-                    || ($event['url'])
-                    || ($event['email'])
-                );
-                if ( $hasLocation ) {
-                    $locationData = $locationFormat = array();
-                    $locationData['event'] = $eventId;
-                    $locationFormat[] = '%d';
-                    if ($event['loc']) {
-                        $locationData['name'] = $event['loc'];
-                        $locationFormat[] = '%s';
-                    }
-                    if ($event['address']) {
-                        $locationData['address'] = $event['address'];
-                        $locationFormat[] = '%s';
-                    }
-                    if ($event['city']) {
-                        $locationData['city'] = $this->getCityId( $event['city'] );
-                        $locationFormat[] = '%s';
-                    }
-                    if ($event['state']) {
-                        $locationData['state'] = $event['state'];
-                        $locationFormat[] = '%s';
-                    }
-                    if ($event['zip']) {
-                        $locationData['zip'] = $event['zip'];
-                        $locationFormat[] = '%s';
-                    }
-                    if ($event['lat']) {
-                        $locationData['lat'] = $event['lat'];
-                        $locationFormat[] = '%s';
-                    }
-                    if ($event['lon']) {
-                        $locationData['lon'] = $event['lon'];
-                        $locationFormat[] = '%s';
-                    }
-                    if ($event['contact']) {
-                        // break up the contact name db is expecting first and
-                        // last name separately
-                        list( $firstName, $lastName ) = explode( ' ', $event['contact'], 2 );
-                        $locationData['contact_fname'] = $firstName;
-                        $locationFormat[] = '%s';
-                        $locationData['contact_lname'] = $lastName;
-                        $locationFormat[] = '%s';
-                    }
-                    if ($event['phone']) {
-                        $locationData['contact_phone'] = $event['phone'];
-                        $locationFormat[] = '%s';
-                    }
-                    if ($event['email']) {
-                        $locationData['contact_email'] = $event['email'];
-                        $locationFormat[] = '%s';
-                    }
-                    $this->wpdb->insert(
-                        GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'locations',
-                        $locationData,
-                        $locationFormat
-                    );
-                    $locationId = $this->wpdb->insert_id;
-                    if ( !$locationId ) {
-                        echo '<pre>$locationData: ' . print_r($locationData, true) . '</pre>';
-                        die('no return id for location');
-                    }
-                }
-            }
-        } catch(PDOException $e) {
-            echo '<pre>$e: ' . print_r($e, true) . '</pre>';
-            die('end here');
-        }
-        return $return;
-    }
-
-}
-
-?>
index e016716..d98f99f 100644 (file)
@@ -173,6 +173,9 @@ class GlmMembersAdmin_member_contacts extends GlmDataContacts
 
                 case 'addNew':
 
+                    // Check for new cities being submitted
+                    $this->checkNewCities();
+
                     // Check for existing contact in Wordpress and Contacts
                     $contactCheck = $this->checkContact($_REQUEST['email'], $_REQUEST['username']);
 
@@ -202,7 +205,7 @@ class GlmMembersAdmin_member_contacts extends GlmDataContacts
 
                             // Change the contact username to match the Wordpress username
                             $this->wpdb->query("
-                                UPDATE ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . "contacts
+                                UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX . "contacts
                                    SET username = '".$contactCheck['wpUserEmail']->data->user_login."'
                                  WHERE id = ".$this->contactInfo['fieldData']['id'].";
                             ");
@@ -245,18 +248,12 @@ class GlmMembersAdmin_member_contacts extends GlmDataContacts
                         // Get the updated user information
                         $this->contactInfo = $this->editEntry($this->contactInfo['fieldData']['id']);
 
-                        // Save the contact ID
-                        $this->contactID = $this->contactInfo['fieldData']['id'];
-
                         $newContactCreated = true;
 
                         // Store the contact ID and active status into user meta data
                         update_user_meta($userID, 'glmMembersContactID', $this->contactInfo['fieldData']['id']);
                         update_user_meta($userID, 'glmMembersContactActive', $this->contactInfo['fieldData']['active']['value']);
 
-                        // Check for new cities being submitted
-                        $this->checkNewCities();
-
                         break;
                     }
 
@@ -288,12 +285,12 @@ class GlmMembersAdmin_member_contacts extends GlmDataContacts
 
                 case 'submit':
 
-                    // Get current role set in the contacts record along with the matching WP role slug
-                    $this->contactID = ($_REQUEST['contact']-0);
-
                     // Check for new cities being submitted
                     $this->checkNewCities();
 
+                    // Get current role set in the contacts record along with the matching WP role slug
+                    $this->contactID = ($_REQUEST['contact']-0);
+
                     $savedContactRole = $this->getWpRole($this->contactID);
 
                     $this->contactInfo = $this->updateEntry($this->contactID);
@@ -431,10 +428,6 @@ class GlmMembersAdmin_member_contacts extends GlmDataContacts
 
             }
 
-            // Also save the mmeber ID in a WordPress "option" in case someone clicks the "Member" sub-menu
-            update_option('glmMembersDatabaseMemberID', $this->memberID);
-
-
         } // if haveMember
 
 
@@ -482,23 +475,23 @@ class GlmMembersAdmin_member_contacts extends GlmDataContacts
     public function checkNewCities()
     {
 
-        // If we have a contact ID and this was a submission with a new city (id < 0)
+        // If we have a member ID and this was a submission with a new city (id < 0)
         if ($this->contactID && isset($_REQUEST['city']) && $_REQUEST['city'] == -1 && isset($_REQUEST['newCityName']) && trim($_REQUEST['newCityName']) != '') {
 
             // Clean up city name
             $cName = trim(filter_var($_REQUEST['newCityName']));
 
             // Try to add the city
-            require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php');
+            require_once(GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataCities.php');
             $Cities = new GlmDataCities($this->wpdb, $this->config);
             $cID = $Cities->addCity($cName);
 
             // If we got a city id back
             if (is_int($cID) && $cID > 0) {
 
-                // Update the city selected for this contact record
+                // Update the city selected for this memberInfo record
                 $sql = "
-                        UPDATE ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX."contacts
+                        UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."contacts
                             SET city = $cID
                             WHERE id = ".$this->contactID."
                             ;";
diff --git a/models/admin/members/contacts.php b/models/admin/members/contacts.php
new file mode 100644 (file)
index 0000000..35d82f3
--- /dev/null
@@ -0,0 +1,148 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Full Contacts List
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Load Contacts data abstract
+require_once(GLM_MEMBERS_CONTACTS_PLUGIN_CLASS_PATH.'/data/dataContacts.php');
+
+/*
+ * This model is called when the "Shortcodes" menu is selected
+ *
+ */
+class GlmMembersAdmin_members_contacts extends GlmDataContacts
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Contacts List
+     *
+     * @var $contacts
+     * @access public
+     */
+    public $contacts;
+
+    /*
+     * Constructor
+     *
+     * This contructor performs the work for this model. This model returns
+     * an array containing the following.
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * '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.
+     *
+     * @wpdb object WordPress database object
+     *
+     * @return array Array containing status, suggested view, and any data
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        // Run constructor for members data class
+        parent::__construct(false, false);
+
+    }
+
+    public function modelAction($actionData = false) {
+
+        $haveContacts = false;
+        $filterArchived = false;
+        $filterText = false;
+        $haveFilter = false;
+
+            // Only list member contacts for the selected member
+        $where = "true";
+
+        // Filter by text string supplied
+        if (isset($_REQUEST['filterText'])) {
+            $filterText = esc_sql($_REQUEST['filterText']);
+            $where .= " AND (
+                T.lname LIKE '%$filterText%' OR
+                T.fname LIKE '%$filterText%' OR
+                T.org LIKE '%$filterText%' OR
+                T.descr LIKE '%$filterText%'
+            )";
+            $haveFilter = true;
+        }
+
+        // Check if this is a request to show archived contacts
+        if (!isset($_REQUEST['filterArchived'])) {
+            $where .= " AND T.access != ".$this->config['access_numb']['Archived'];
+            $filterArchived = false;
+        } else {
+            $filterArchived = true;
+            $haveFilter = true;
+        }
+
+        // Get list of contacts
+        $this->contacts = $this->getList($where);
+
+        if ($this->contacts !== false) {
+            if (count($this->contacts) > 0) {
+                $haveContacts = true;
+            }
+        }
+
+        // Compile template data
+        $templateData = array(
+            'haveContacts' => $haveContacts,
+            'contacts' => $this->contacts,
+            'filterArchived' => $filterArchived,
+            'filterText' => $filterText,
+            'haveFilter' => $haveFilter
+        );
+
+        // Return status, any suggested view, and any data to controller
+        return array(
+                'status' => true,
+                'modelRedirect' => false,
+                'view' => 'admin/members/contacts.html',
+                'data' => $templateData
+        );
+
+    }
+}
+
+?>
\ No newline at end of file
index 26ab246..1564bfd 100644 (file)
@@ -222,7 +222,7 @@ class GlmMembersAdmin_profile_index extends GlmDataContacts
 
                 // Update the city selected for this memberInfo record
                 $sql = "
-                        UPDATE ".GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX."contacts
+                        UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."contacts
                             SET city = $cID
                             WHERE id = ".$this->contactID."
                             ;";
diff --git a/models/admin/sample/index.php b/models/admin/sample/index.php
new file mode 100644 (file)
index 0000000..86289ad
--- /dev/null
@@ -0,0 +1,81 @@
+<?php
+
+/**
+ * Gaslight Media Members Database
+ * Admin Sample
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * This model is called when the "Shortcodes" menu is selected
+ *
+ */
+class GlmMembersAdmin_sample_index
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+
+    /*
+     * Constructor
+     *
+     * This contructor performs the work for this model. This model returns
+     * an array containing the following.
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * '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.
+     *
+     * @wpdb object WordPress database object
+     *
+     * @return array Array containing status, suggested view, and any data
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+    }
+
+    public function modelAction($actionData = false) {
+
+        // Return status, any suggested view, and any data to controller
+        return array(
+                'status' => true,
+                'modelRedirect' => false,
+                'view' => 'admin/sample/index.html',
+                'data' => false
+        );
+
+    }
+}
+
+?>
\ No newline at end of file
index 83d0a5f..358802b 100644 (file)
  *
  */
 
-add_submenu_page(
-    'glm-members-admin-menu-members',                   // Parent slug
-    'Contacts',                                         // Page title
-    'Contacts',                                         // Menu Title
-    'glm_members_members',                              // Capability required
-    'glm-members-admin-menu-contacts-index',            // Menu slug
-    function() {$this->controller('contacts');}
-);
-
 // If a contact is logged in (ownEntity isn't false), add Contact Profile menu item
 if ($this->config['loggedInUser']['contactUser']) {
     add_submenu_page(
index 8bc578f..410389f 100644 (file)
@@ -33,8 +33,6 @@
  *
  */
 
-// Admin Members Contacts Tab
-/*
 add_filter('glm-member-db-add-tab-for-members',
     function($addOnTabs) {
         $newTabs = array(
@@ -48,9 +46,7 @@ add_filter('glm-member-db-add-tab-for-members',
         return $addOnTabs;
     }
 );
-*/
 
-// Admin Member Contacts Tab
 if (apply_filters('glm_members_permit_admin_member_contacts_tab', true)) {
     add_filter('glm-member-db-add-tab-for-member',
         function($addOnTabs) {
@@ -67,23 +63,4 @@ if (apply_filters('glm_members_permit_admin_member_contacts_tab', true)) {
     );
 }
 
-// Admin Management Contacts Tab
-if (apply_filters('glm_members_permit_admin_members_contacts_tab', true)) {
-    add_filter('glm-member-db-add-tab-for-management',
-        function($addOnTabs) {
-            $newTabs = array(
-                array(
-                    'text' => 'Contacts',
-                    'menu' => 'management',
-                    'action' => 'contacts'
-                )
-            );
-            $addOnTabs = array_merge($addOnTabs, $newTabs);
-            return $addOnTabs;
-        }
-    );
-}
-
-
-
 ?>
\ No newline at end of file
diff --git a/setup/databaseScripts/create_database_V0.0.1.sql b/setup/databaseScripts/create_database_V0.0.1.sql
deleted file mode 100644 (file)
index a80e516..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
--- Gaslight Media Members Database 
--- File Created: 12/09/14 15:27:15
--- Database Version: 1.0.0
--- Database Creation Script - Contacts Add-On
--- 
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
--- 
--- **** BE SURE TO ALSO UPDATE drop_database_Vxxx.sql FILE WHEN CHANGING TABLES ****
--- 
-
--- Contacts - used by various entities
-CREATE TABLE {prefix}contacts (
-  id INT NOT NULL AUTO_INCREMENT,
-  active BOOLEAN NULL,                      -- Contact is active flag
-  access INT NULL,                          -- Access type - See access table in plugin.ini
-  fname TINYTEXT NULL,                      -- First name of contact
-  lname TINYTEXT NULL,                      -- Last name of contact
-  contact_type INT NULL,                    -- Contact type - see contact_type table (individual, role, ...)
-  contact_role INT NULL,                    -- Contact WordPress user Role
-  org TINYTEXT NULL,                        -- Organization name
-  title TINYTEXT NULL,                      -- Title/Position
-  descr TEXT NULL,                          -- Description of position/responsibilities - Displayed
-  image TINYTEXT NULL,                      -- Image
-  addr1 TINYTEXT NULL,                      -- Address line 1 - Address is for contact, not necessarily for organization
-  addr2 TINYTEXT NULL,                      -- Address line 2 
-  city INT NULL,                            -- Pointer to city in cities table
-  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
-  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries 
-  zip TINYTEXT NULL,                        -- ZIP/Postal Code     
-  lat FLOAT NULL,                           -- Latitude of contact location
-  lon FLOAT NULL,                           -- Longitude of contact location
-  url TINYTEXT NULL,                        -- URL to information regarding this contact
-  office_phone TINYTEXT NULL,               -- Office phone number
-  home_phone TINYTEXT NULL,                 -- Home phone number - or after-hours phone number
-  mobile_phone TINYTEXT NULL,               -- Mobile phone number
-  alt_phone TINYTEXT NULL,                  -- An alternate phone number
-  fax TINYTEXT NULL,                        -- FAX number (do people still use these?) 
-  email TINYTEXT NULL,                      -- E-Mail address
-  alt_email TINYTEXT NULL,                  -- Alternate E-Mail address - Also used to log-in 
-  username TINYTEXT NULL,                   -- Optional username to use for login
-  password TINYTEXT NULL,                   -- Encrypted password
-  notes TEXT NULL,                          -- Notes - Not displayed on front-end
-  create_time TIMESTAMP NULL,               -- Create date/time
-  modify_time TIMESTAMP NULL,               -- Last modified date/time
-  ref_type INT NULL,                        -- Type of entity this contact is associated with                        
-  ref_dest INT NULL,                        -- Pointer to the specific entity of ref_type this contact is associated with
-  PRIMARY KEY (id),
-  INDEX(fname(20)),
-  INDEX(lname(20)),
-  INDEX(city),
-  INDEX(zip(10)),
-  INDEX(lat),
-  INDEX(lon),
-  INDEX(email(20))
-);
diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php
deleted file mode 100644 (file)
index 7009d41..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-/**
- * Gaslight Media Members Database
- * GLM Members Contacts DB Versions
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package  glmMembersDatabase
- * @author   Chuck Scott <cscott@gaslightmedia.com>
- * @license  http://www.gaslightmedia.com Gaslightmedia
- * @release  dbVersions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link     http://dev.gaslightmedia.com/
- */
-
-/**
- * Database Versions
- *
- * *** PLEASE NOW INCLUDE A DATE FOR EACH DATABASE VERSION ***
- *  '1.1.2' => array('version' => '1.1.2', 'tables' => 14, 'date' => '4/11/16')
- *
- * An array of past and current Member Database versions.
- *
- * Each entry below uses a key so code can find data on
- * a specific version and in the values are the version
- * again and the proper number of tables that should
- * exist with that version.
- */
-$glmMembersContactsDbVersions = array(
-    '0.0.1' => array('version' => '0.0.1', 'tables' => 1, 'date' => '4/15/2016'),
-);
-
-
diff --git a/setup/databaseScripts/drop_database_V0.0.1.sql b/setup/databaseScripts/drop_database_V0.0.1.sql
deleted file mode 100644 (file)
index 78bacb5..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
--- Gaslight Media Members Database 
--- File Created: 12/09/14 15:27:15
--- Database Version: 1.1.1
--- Database Deletion Script
--- Note: Tables with DELETE CASCADE must appear before referenced table
-
-DROP TABLE IF EXISTS
-    {prefix}amenities,
-    {prefix}amenity_ref,
-    {prefix}category_member_info,
-    {prefix}cities,
-    {prefix}contacts,
-    {prefix}images,
-    {prefix}files,
-    {prefix}members,
-    {prefix}member_info,
-    {prefix}member_type,
-    {prefix}regions,
-    {prefix}settings_general,
-    {prefix}settings_terms,
-    {prefix}categories
-;
-
diff --git a/setup/databaseScripts/readme.txt b/setup/databaseScripts/readme.txt
deleted file mode 100644 (file)
index 141d8b5..0000000
+++ /dev/null
@@ -1,41 +0,0 @@
-This directory contains database creation and update scripts for this add-on.
-
-The files in this directory are checked by the checkDatabase() function in the
-main plugin classes/glmPluginSupport.php file.
-
-This directory is optional. If there are no data tables that need to be created
-for this add-on, there should be no files in this directory. The directory may
-also be deleted. 
-
-See the "examples" directory for a sample of what can go in this directory.
-Procedure to update database
------------------------------
-
-0) Make a backup copy of the site's database.
-
-1) Rename "create_database_Vx.x.x.sql" to new version number.
-    example: create_database_V0.0.9.sql -> create_database_V0.0.10.sql
-
-2) Edit renamed create database file and make desired changes
-
-3) Add a new "update_database_Vx.x.x.sql" named with the correct version #.
-
-4) Edit new update database files with SQL script to make the necessary changes
-   from the previous version to the new version. (i.e. to add new fields,
-   rename fields, insert records, ...)
-
-5) Optionally add an "update_database_Vx.x.x.php" file if PHP scripting is
-   needed to update database content. (i.e. to make changes to database content)
-
-6) Edit the "dbVersions.php" file and add a new line for the new version.
-   *** Now please be sure to add a date for each entry ***
-   i.e. '1.1.2' => array('version' => '1.1.2', 'tables' => 14, 'date' => '4/11/16')
-
-7) When this is all done, edit the index.php file for the plugin/add-on and 
-   change "GLM_MEMBERS_{addon}_PLUGIN_DB_VERSION" defined parameter where
-   {addon} is the add-on name.
-
-8) Go to an admin menu item for the main member db plugin or any add-on. If all
-   goes well, the main plugin should have detected the change and updated the
-   database. If not, restore the database and try again.
-9) Check the database to make sure the changes to fields and data are correct.
index 458862c..8af4d47 100644 (file)
@@ -40,12 +40,6 @@ $glmMembersContactsAddOnValidActions = array(
         ),
         'profile' => array(
             'index' => GLM_MEMBERS_CONTACTS_PLUGIN_SLUG
-        ),
-        'contacts' => array(
-            'index' => GLM_MEMBERS_CONTACTS_PLUGIN_SLUG
-        ),
-        'management' => array(
-            'contacts' => GLM_MEMBERS_CONTACTS_PLUGIN_SLUG
         )
     ),
     'frontActions' => array(
diff --git a/views/admin/contacts/header.html b/views/admin/contacts/header.html
deleted file mode 100644 (file)
index 3be1c2f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-<div class="wrap">
-    <h2>All Contacts</h2>
-    <h2 class="nav-tab-wrapper">
-        <a href="{$thisUrl}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index} nav-tab-active{/if}">Contacts List</a>
-    </h2>
-    <div id="glm-admin-content-container">
-    
-    
\ No newline at end of file
diff --git a/views/admin/contacts/index.html b/views/admin/contacts/index.html
deleted file mode 100644 (file)
index 78058f7..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-{include file='admin/contacts/header.html'}
-
-    <form class="glm-right" onSubmit="return false;">
-       <span{if $haveFilter} class="glm-notice"{/if}><b>List Filters:</b>&nbsp;&nbsp;</span> 
-       <input type="checkbox" id="filterArchived" class="listFilter"{if $filterArchived} checked{/if}>Show Archived&nbsp;&nbsp;
-       &nbsp;&nbsp;
-       <input type="text" id="filterText" class="listFilter" value="{$filterText}"> Search
-    </form>
-    <h2 class="glm-left">Contacts</h2>
-
-    <table class="wp-list-table striped glm-admin-table">
-        <thead>
-            <tr>
-                <th>Name</th>
-                <th>Active</th>
-                <th>Type</th>
-                <th>Access</th>
-                <th>User</th>
-                <th>Entity</th>
-                <th>Organization</th>
-                <th>Location</th>
-            </tr>
-        </thead>
-        <tbody>
-{if $haveContacts}
-    {foreach $contacts as $c}
-            <tr>
-                <td class="glm-shrink"><a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=contacts&option=edit&member={$c.ref_dest}&contact={$c.id}">{$c.lname}, {$c.fname}</a></td>
-                <td class="glm-shrink">{$c.active.name}</td>
-                <td>{$c.contact_type.name}</td>
-                <td class="glm-shrink">{$c.access.name}</td>
-                <td class="glm-nowrap">{$c.contact_role_short.name}</td>
-                <td class="glm-nowrap">
-                    {$c.ref_type.name}: 
-                    <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=index&member={$c.ref_dest}">{$c.ref_dest_name}</a>
-                </td>
-                <td class="glm-shrink">{$c.org}</td>
-                <td class="glm-shrink">{$c.city.name}, {$c.state.name}</td>
-            </tr>
-    {/foreach}
-{else}
-            <tr class="alternate"><td colspan="2">(no contacts listed)</td></tr>
-{/if}
-        </tbody>
-    </table>
-
-    <script type="text/javascript">
-        jQuery(document).ready(function($) {
-            
-            // Filter triggers
-            $(".listFilter" ).change( function() {
-                
-                var filter = '';
-                
-                // Check for archived filter
-                if ($("#filterArchived").attr('checked')) {
-                    filter += '&filterArchived=true';
-                }
-                
-                // Check for text filter
-                var filterText = $("#filterText").val();
-                if (filterText != '') {
-                    filter += '&filterText=' + encodeURIComponent(filterText).replace(/%20/g,'+');
-                }
-                
-                window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=index" + filter;
-                
-                return false;
-            });
-        });
-    </script>
-            
-
-
-{include file='admin/footer.html'}
diff --git a/views/admin/management/contacts.html b/views/admin/management/contacts.html
deleted file mode 100644 (file)
index 7b9146f..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-{include file='admin/management/header.html'}
-
-    <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
-        <a data-show-table="glm-table-contactImport" class="glm-settings-tab nav-tab{if $option=='contactImport' || $option==''} nav-tab-active{/if}">Import</a>
-    </h2>
-    
-    <!-- Import -->
-    
-    <table id="glm-table-contactImport" class="glm-admin-table glm-settings-table{if $option!='contactImport' && $option!=''} glm-hidden{/if}">
-  {if $importResult}
-        <tr><td><a href="{$thisUrl}?page={$thisPage}&glm_action=events&option=eventimport">Return to Import Events</a></td></tr>
-        <tr>
-            <td colspan="2">
-                {$importResult}
-            </td>
-        </tr>
-  {else}
-        <tr>
-            <td colspan="2">
-                <form action="{$thisUrl}">
-                    <input type="hidden" name="page" value="{$thisPage}">
-                    <input type="hidden" name="glm_action" value="events">
-                    <input type="hidden" name="option" value="eventimport">
-                    <input type="hidden" name="import" value="true">
-                    <div style="float:left;width: 200px;">
-                        <fieldset>
-                            <legend>Database to import from:</legend>
-                            <label for="db_host">DB Host</label>
-                            <input id="db_host" name="db_host" />
-                            <label for="db_name">DB Name</label>
-                            <input id="db_name" name="db_name" />
-                            <label for="db_user">DB User</label>
-                            <input id="db_user" name="db_user" />
-                            <label for="db_password">DB Password</label>
-                            <input id="db_password" name="db_password" />
-                        <fieldset>
-                        <input type="submit" value="Import Contacts" />
-                    </div>
-                </form>
-            </td>
-        </tr>
-  {/if}
-    </table>
-        
-    <script type="text/javascript">
-        
-        jQuery(document).ready(function($) {
-            
-            /*
-             * Edit area tabs
-             */
-            $('.glm-settings-tab').click( function() {
-
-                // Clear tabl highlights and hide all tables
-                $('.glm-settings-tab').removeClass('nav-tab-active');
-                $('.glm-settings-table').addClass('glm-hidden');
-                
-                // Highlight selected tab
-                $(this).addClass('nav-tab-active');
-                
-                // Show selected table
-                var table = $(this).attr('data-show-table');
-                $('#' + table).removeClass('glm-hidden');
-                                
-            });
-
-            // Flash certain elements for a short time after display      
-            $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
-                    
-        });
-    </script>
index 35ef661..126facc 100644 (file)
@@ -44,7 +44,7 @@
             <tr>
                 <td class="glm-shrink">
         {if apply_filters('glm_members_permit_admin_member_contacts_view_contact', true)}
-                    <a href="{$thisUrl}?page=glm-members-admin-menu-member&glm_action=contacts&option=edit&member={$c.ref_dest}&contact={$c.id}">{$c.lname}, {$c.fname}</a>
+                    <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=contacts&option=edit&member={$c.ref_dest}&contact={$c.id}">{$c.lname}, {$c.fname}</a>
         {else}
                     {$c.lname}, {$c.fname}
         {/if}                    
 
     {if $option == 'create' || $option == 'edit'}
 
-         <a href="{$thisUrl}?page={$thisPage}&glm_action=contacts&member={$memberID}" class="button button-primary glm-button glm-right">Return to Contact List</a>
+         <a href="{$thisURL}?page={$thisPage}&glm_action=contacts&member={$memberID}" class="button button-primary glm-button glm-right">Return to Contact List</a>
             
       {if $option == 'create'}
         <h2 class="glm-left">Add New Contact</h2>   
       {/if}
         
       
-        <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+        <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
             <input type="hidden" name="glm_action" value="contacts">
             <input type="hidden" name="member" value="{$memberData.id}">
         {if $option == 'create'}
                     <td {if $contactInfo.fieldFail.image}class="glm-form-bad-input"{/if}>
             {if $contactInfo.fieldData.image}
                         <div id="largeImageDialog" class="glm-dialog-box" title="Large sized image">
-                            <img src="{$glmPluginMediaUrl}/images/large/{$contactInfo.fieldData.image}">
+                            <img src="{$glmPluginMediaURL}/images/large/{$contactInfo.fieldData.image}">
                             <a id="largeImageCancel" class="button button-primary glm-right">Close</a><br>
                         </div>
                         <table class="glm-admin-image-edit-table">
                             <tr>
-                                <td><img src="{$glmPluginMediaUrl}/images/thumb/{$contactInfo.fieldData.image}"></td> 
+                                <td><img src="{$glmPluginMediaURL}/images/thumb/{$contactInfo.fieldData.image}"></td> 
                                 <td>
                                     <input type="checkbox" name="image_delete"> Delete Image<br>
                                     {$contactInfo.fieldData.image}<br>
                 </tr>
             </table>
             <p><span class="glm-required">*</span> Required</p>
-            <input id="updateContact" type="submit" value="{if $contactID && $contactInfo}Update contact{else}Add new contact{/if}">
+            <input type="submit" name="Add new member">
         </form>  
         
     {/if}
                     <th>Image:</th>
                     <td>
             {if $contactInfo.fieldData.image}
-                        <img src="{$glmPluginMediaUrl}/images/thumb/{$contactInfo.fieldData.image}">
+                        <img src="{$glmPluginMediaURL}/images/thumb/{$contactInfo.fieldData.image}">
             {/if} 
                     </td>
                 </tr>
                     filter += '&filterText=' + encodeURIComponent(filterText).replace(/%20/g,'+');
                 }
                 
-                window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=contacts&member={$memberID}" + filter;
+                window.location.href = "{$thisURL}?page={$thisPage}&glm_action=contacts&member={$memberID}" + filter;
                 
                 return false;
             });
                 $("#deleteContactDialog").dialog("close");
             });            
             $('#deleteContactSubmit').click( function() {
-                window.location.replace("{$thisUrl}?page={$thisPage}&glm_action=contacts&member={$memberID}&option=delete&contact={$contactID}");
+                window.location.replace("{$thisURL}?page={$thisPage}&glm_action=contacts&member={$memberID}&option=delete&contact={$contactID}");
             });
 
             // Flash certain elements for a short time after display      
diff --git a/views/admin/members/contacts.html b/views/admin/members/contacts.html
new file mode 100644 (file)
index 0000000..ae8d06c
--- /dev/null
@@ -0,0 +1,75 @@
+{include file='admin/members/header.html'}
+
+    <form class="glm-right" onSubmit="return false;">
+       <span{if $haveFilter} class="glm-notice"{/if}><b>List Filters:</b>&nbsp;&nbsp;</span> 
+       <input type="checkbox" id="filterArchived" class="listFilter"{if $filterArchived} checked{/if}>Show Archived&nbsp;&nbsp;
+       &nbsp;&nbsp;
+       <input type="text" id="filterText" class="listFilter" value="{$filterText}"> Search
+    </form>
+    <h2 class="glm-left">Contacts</h2>
+
+    <table class="wp-list-table striped glm-admin-table">
+        <thead>
+            <tr>
+                <th>Name</th>
+                <th>Active</th>
+                <th>Type</th>
+                <th>Access</th>
+                <th>User</th>
+                <th>Entity</th>
+                <th>Organization</th>
+                <th>Location</th>
+            </tr>
+        </thead>
+        <tbody>
+{if $haveContacts}
+    {foreach $contacts as $c}
+            <tr>
+                <td class="glm-shrink"><a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=contacts&option=edit&member={$c.ref_dest}&contact={$c.id}">{$c.lname}, {$c.fname}</a></td>
+                <td class="glm-shrink">{$c.active.name}</td>
+                <td>{$c.contact_type.name}</td>
+                <td class="glm-shrink">{$c.access.name}</td>
+                <td class="glm-nowrap">{$c.contact_role_short.name}</td>
+                <td class="glm-nowrap">
+                    {$c.ref_type.name}: 
+                    <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=index&member={$c.ref_dest}">{$c.ref_dest_name}</a>
+                </td>
+                <td class="glm-shrink">{$c.org}</td>
+                <td class="glm-shrink">{$c.city.name}, {$c.state.name}</td>
+            </tr>
+    {/foreach}
+{else}
+            <tr class="alternate"><td colspan="2">(no contacts listed)</td></tr>
+{/if}
+        </tbody>
+    </table>
+
+    <script type="text/javascript">
+        jQuery(document).ready(function($) {
+            
+            // Filter triggers
+            $(".listFilter" ).change( function() {
+                
+                var filter = '';
+                
+                // Check for archived filter
+                if ($("#filterArchived").attr('checked')) {
+                    filter += '&filterArchived=true';
+                }
+                
+                // Check for text filter
+                var filterText = $("#filterText").val();
+                if (filterText != '') {
+                    filter += '&filterText=' + encodeURIComponent(filterText).replace(/%20/g,'+');
+                }
+                
+                window.location.href = "{$thisURL}?page={$thisPage}&glm_action=contacts" + filter;
+                
+                return false;
+            });
+        });
+    </script>
+            
+
+
+{include file='admin/footer.html'}
index 7717c57..1186e17 100644 (file)
@@ -1,9 +1,9 @@
 <div class="wrap">
     <h2>Your Contact and Log-in Profile</h2>
     <h2 class="nav-tab-wrapper">
-        <a href="{$thisUrl}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index} nav-tab-active{/if}">User Profile</a>
+        <a href="{$thisURL}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index} nav-tab-active{/if}">User Profile</a>
 {foreach $addOnTabs as $a}
-        <a href="{$thisUrl}?page=glm-members-admin-menu-{$a.menu}&glm_action={$a.action}" class="nav-tab{if $thisAction==$a.action} nav-tab-active{/if}">{$a.text}</a>
+        <a href="{$thisURL}?page=glm-members-admin-menu-{$a.menu}&glm_action={$a.action}" class="nav-tab{if $thisAction==$a.action} nav-tab-active{/if}">{$a.text}</a>
 {/foreach}        
     </h2>
     <div id="glm-admin-content-container">
index ffbd49f..0a46df8 100644 (file)
@@ -9,7 +9,7 @@
         </p>
         
         {if $contactUpdated}<h2 class="glm-notice glm-flash-updated">Contact Updated</h2>{/if}
-        <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+        <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
             <input type="hidden" name="glm_action" value="index">
             <input type="hidden" name="option" value="submit">
             <input type="hidden" name="contact" value="{$contactInfo.fieldData.id}">
                             <tr>
                                 <td>
                                     <div class="glm-galleryImage" data-id="image">
-                                        <img src="{$glmPluginMediaUrl}/images/small/{$contactInfo.fieldData.image}">
+                                        <img src="{$glmPluginMediaURL}/images/small/{$contactInfo.fieldData.image}">
                                     </div>
                                 </td>
                                 <td>
             {/if}
                             <tr><td colspan="2"><b>New image:</b> <input type="file" name="image_new"></td></tr>
                         </table>
-                        <div id="glm-galleryImageLarger_image" class="glm-imageDialog"><img src="{$glmPluginMediaUrl}/images/large/{$contactInfo.fieldData.image}"></div>
+                        <div id="glm-galleryImageLarger_image" class="glm-imageDialog"><img src="{$glmPluginMediaURL}/images/large/{$contactInfo.fieldData.image}"></div>
                         {if $contactInfo.fieldFail.image}<p>{$contactInfo.fieldFail.image}</p>{/if}
                     </td>
                 </tr>
                 <th>Image:</th>
                 <td>
         {if $contactInfo.fieldData.image}
-                    <img src="{$glmPluginMediaUrl}/images/thumb/{$contactInfo.fieldData.image}">
+                    <img src="{$glmPluginMediaURL}/images/thumb/{$contactInfo.fieldData.image}">
         {/if} 
                 </td>
             </tr>