Reorganized again
authorChuck Scott <cscott@gaslightmedia.com>
Fri, 19 Feb 2016 19:52:21 +0000 (14:52 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Fri, 19 Feb 2016 19:52:21 +0000 (14:52 -0500)
23 files changed:
classes/data/dataMemberInfo.php
classes/data/dataMembers.php
classes/glmPluginSupport.php
controllers/admin.php
controllers/front.php
glm-member-db.php
lib/GlmDataAbstract/DataAbstract.php
models/admin/dashboardWidget/index.php
models/admin/member/memberEdit.php
models/admin/member/memberInfo.php
models/admin/members/index.php
models/front/members/detail.php
models/front/members/list.php
setup/databaseScripts/create_database_V1.1.0.sql
setup/databaseScripts/update_database_V1.1.0.sql
views/admin/dashboardWidget/index.html
views/admin/footer.html
views/admin/member/index.html
views/admin/member/memberEdit.html
views/admin/member/memberInfo.html
views/admin/members/index.html
views/admin/members/list.html
views/front/footer.html

index c04b98d..cd290c4 100644 (file)
@@ -178,6 +178,127 @@ class GlmDataMemberInfo extends GlmDataAbstract
                 'use' => 'a'
             ),
 
+            // Address Line 1
+            'addr1' => array (
+                'field' => 'addr1',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+
+            // Address Line 2
+            'addr2' => array (
+                'field' => 'addr2',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+
+            // City
+            'city' => array (
+                'field' => 'city',
+                'type' => 'pointer',
+                    'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'cities',
+                    'p_field' => 'name',
+                    'p_orderby' => 'name',
+                'use' => 'a'
+            ),
+
+            // State
+            'state' => array (
+                'field' => 'state',
+                'type' => 'list',
+                'list' => $this->config['states'],
+                'default' => 'MI',
+                'use' => 'a'
+            ),
+
+            // ZIP / Postal Code
+            'zip' => array (
+                'field' => 'zip',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+
+            // Country
+            'country' => array (
+                'field' => 'country',
+                'type' => 'list',
+                'list' => $this->config['countries'],
+                'default' => 'US',
+                'use' => 'a'
+            ),
+
+            // Latitude
+            'lat' => array(
+                'field'    => 'lat',
+                'type'     => 'float',
+                'default'  => $this->config['settings']['maps_default_lat'],
+                'use'      => 'a'
+            ),
+
+            // Longitude
+            'lon' => array(
+                'field'    => 'lon',
+                'type'     => 'float',
+                'default'  => $this->config['settings']['maps_default_lon'],
+                'use'      => 'a'
+            ),
+
+            // Region
+            'region' => array (
+                'field' => 'region',
+                'type' => 'pointer',
+                    'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'regions',
+                    'p_field' => 'name',
+                    'p_orderby' => 'name',
+                    'p_blank' => true,
+                //  'force_list' => true,
+                'use' => 'a'
+            ),
+
+            // Phone
+            'phone' => array(
+                'field'    => 'phone',
+                'type'     => 'phone',
+                'use'      => 'a'
+            ),
+
+            // Toll Free
+            'toll_free' => array(
+                'field'    => 'toll_free',
+                'type'     => 'phone',
+                'use'      => 'a'
+            ),
+
+            // E-Mail Address
+            'email' => array(
+                'field'    => 'email',
+                'type'     => 'email',
+                'use'      => 'a'
+            ),
+
+            // URL
+            'url' => array(
+                'field'    => 'url',
+                'type'     => 'text',
+                'use'      => 'a'
+            ),
+
+            // Logo
+            'logo' => array(
+                    'field'    => 'logo',
+                    'type'     => 'image',
+                    'use'      => 'a'
+            ),
+
+            // Credit Cards Accepted - multi-pick
+            'cc_type' => array(
+                    'field'    => 'cc_type',
+                    'type'     => 'bitmap',
+                    'bitmap'    => $this->config['credit_card'],
+                    'default'  => 0, // no cards selected
+                    'use'      => 'a'
+            ),
+
             // Description
             'descr' => array(
                 'field' => 'descr',
@@ -238,6 +359,12 @@ class GlmDataMemberInfo extends GlmDataAbstract
     public function entryPostProcessing($r, $a)
     {
 
+        // Set flag if Lat or Lon are 0
+        $r['bad_lat_lon'] = false;
+        if ($r['lat'] == 0 || $r['lon'] == 0) {
+            $r['bad_lat_lon'] = true;
+        }
+
         // Only run these tests for 'l' (getList), 'g' (getEntry), 'e' (editEntry)
         if (!$this->doPostProcessing || ($a != 'l' && $a != 'g' && $a != 'e')) {
             return $r;
@@ -255,18 +382,35 @@ class GlmDataMemberInfo extends GlmDataAbstract
 
         $r['amenities'] = $this->wpdb->get_results($sql, ARRAY_A);
 
+        // Get Member Category data for this entry
+        $sql = "
+            SELECT CMI.member_info AS member_info_id, C.id, C.name, C.descr, C.short_descr,
+                   COALESCE (
+                        (
+                        SELECT name
+                          FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories
+                         WHERE id = C.parent
+                        ), ''
+                   ) AS parent_name
+              FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories AS C,
+                   ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "category_member_info AS CMI
+             WHERE C.id = CMI.category
+               AND CMI.member_info = ".$r['id']."
+        ;";
+        $r['categories'] = $this->wpdb->get_results($sql, ARRAY_A);
+
         return $r;
     }
 
        /*
-        * Find the active member info record for a specific member ID
+        * Find the active member info record ID for a specific member ID
         *
         * @param integer $member ID of the member name
         * @param string $where Optional WHERE clause for query
         *
         * @return integer Member info record ID or false if not found
         */
-       public function getActiveInfoForMember($member, $where = 'true') {
+       public function getActiveInfoIdForMember($member, $where = 'true') {
 
            $memberID = $member - 0;
 
@@ -276,7 +420,16 @@ class GlmDataMemberInfo extends GlmDataAbstract
              WHERE $where
                AND member = $memberID
                AND status = ".$this->config['status_numb']['Active']."
-           ;";
+                  AND  (
+                        SELECT access
+                        FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."members
+                        WHERE id = T.member
+                    ) IN (
+                        ".$this->config['access_numb']['NoAccess'].",
+                        ".$this->config['access_numb']['Moderated'].",
+                        ".$this->config['access_numb']['Full']."
+                    )
+        ";
         $memberInfo = $this->wpdb->get_row($sql, ARRAY_A);
 
         if ($memberInfo) {
@@ -297,9 +450,8 @@ class GlmDataMemberInfo extends GlmDataAbstract
         */
        public function getActiveInfoSimplified($member) {
 
-echo "******************* CHECK ON THIS getActiveInfoSimplified() *******************";exit;
            // Get the ID for the current info record for this member
-           $mInfoID = $this->getActiveInfoForMember($member);
+           $mInfoID = $this->getActiveInfoIdForMember($member);
            if (!$mInfoID) {
                return false;
            }
@@ -332,6 +484,7 @@ echo "******************* CHECK ON THIS getActiveInfoSimplified() **************
 
     }
 
+
     /*
      * Get Apha list of first characters in member name
      * for those members that have active info.
@@ -378,6 +531,8 @@ echo "******************* CHECK ON THIS getActiveInfoSimplified() **************
     public function getSimpleMemberInfoList($where = '')
     {
 
+        $this->doPostProcessing = false;
+
         // Save current list of fields
         $f = $this->fields;
 
@@ -391,7 +546,9 @@ echo "******************* CHECK ON THIS getActiveInfoSimplified() **************
             'reference_name' => $f['reference_name'],
             'status' => $f['status'],
             'create_time' => $f['create_time'],
-            'modify_time' => $f['modify_time']
+            'modify_time' => $f['modify_time'],
+            'lat' => $f['lat'],
+            'lon' => $f['lon']
         );
 
         // Get the simplified list
@@ -404,55 +561,7 @@ echo "******************* CHECK ON THIS getActiveInfoSimplified() **************
     }
 
     /*
-     * Get Member Info List with Member Data
-     *
-     * @param string $where Where clause
-     * @param string $sort Sort field
-     *
-     * @return object Class object
-     *
-     */
-    public function getListWithMemberData($where = '', $sort = '')
-    {
-
-        // Member data
-        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php');
-        $Members = new GlmDataMembers($this->wpdb, $this->config);
-
-        // Get list of memberInfo data
-        $list = $this->getList($where, $sort);
-
-        // For each member info record bet base member data
-        while (list($key, $val) = each($list)) {
-
-            $mData = $Members->getEntry($val['member_pointer']);
-
-            $list[$key] = array_merge($val, array(
-                'logo' => $mData['logo'],
-                'addr1' => $mData['addr1'],
-                'addr2' => $mData['addr2'],
-                'city' => $mData['city'],
-                'state' => $mData['state'],
-                'zip' => $mData['zip'],
-                'country' => $mData['country'],
-                'phone' => $mData['phone'],
-                'toll_free' => $mData['toll_free'],
-                'region' => $mData['region'],
-                'url' => $mData['url'],
-                'email' => $mData['email'],
-                'categories' => $mData['categories'],
-                'cc_type' => $mData['cc_type'],
-                'lat' => $mData['lat'],
-                'lon' => $mData['lon']
-            ));
-
-        }
-
-        return $list;
-    }
-
-    /*
-     * Get Member Info For a Member with Member Data
+     * Get Member Info For a Member
      *
      * @param integer $member Member ID
      * @param string $where Where clause
@@ -460,46 +569,21 @@ echo "******************* CHECK ON THIS getActiveInfoSimplified() **************
      * @return object Class object
      *
      */
-    public function getActiveInfoForMemberWithMemberData($member, $where = 'true')
+    public function getActiveInfoForMember($member)
     {
 
-        // Member data
-        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php');
-        $Members = new GlmDataMembers($this->wpdb, $this->config);
-
-        $memberInfoID = $this->getActiveInfoForMember($member, $where);
+        // Get the active member info id for an active member
+        $memberInfoID = $this->getActiveInfoIdForMember($member);
 
-        $memberInfo = $this->getEntry($memberInfoID);
-
-        if ($memberInfo) {
-
-            $mData = $Members->getEntry($member);
-
-            $memberInfo = array_merge($memberInfo, array(
-                'logo' => $mData['logo'],
-                'addr1' => $mData['addr1'],
-                'addr2' => $mData['addr2'],
-                'city' => $mData['city'],
-                'state' => $mData['state'],
-                'zip' => $mData['zip'],
-                'country' => $mData['country'],
-                'phone' => $mData['phone'],
-                'toll_free' => $mData['toll_free'],
-                'region' => $mData['region'],
-                'url' => $mData['url'],
-                'email' => $mData['email'],
-                'categories' => $mData['categories'],
-                'cc_type' => $mData['cc_type'],
-                'lat' => $mData['lat'],
-                'lon' => $mData['lon']
-            ));
-
-        } else {
+        // If not found then return failure
+        if ($memberInfoID == false) {
             return false;
         }
 
+        // Get the member info data
+        $memberInfo = $this->getEntry($memberInfoID);
+
         return $memberInfo;
     }
 
-
 }
index 4575770..6a73c1d 100644 (file)
@@ -192,127 +192,6 @@ class GlmDataMembers extends GlmDataAbstract {
                 'use' => 'gle'
             ),
 
-            // Address Line 1
-            'addr1' => array (
-                'field' => 'addr1',
-                'type' => 'text',
-                'use' => 'a'
-            ),
-
-            // Address Line 2
-            'addr2' => array (
-                'field' => 'addr2',
-                'type' => 'text',
-                'use' => 'a'
-            ),
-
-            // City
-            'city' => array (
-                'field' => 'city',
-                'type' => 'pointer',
-                    'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'cities',
-                    'p_field' => 'name',
-                    'p_orderby' => 'name',
-                'use' => 'a'
-            ),
-
-            // State
-            'state' => array (
-                'field' => 'state',
-                'type' => 'list',
-                'list' => $this->config['states'],
-                'default' => 'MI',
-                'use' => 'a'
-            ),
-
-            // ZIP / Postal Code
-            'zip' => array (
-                'field' => 'zip',
-                'type' => 'text',
-                'use' => 'a'
-            ),
-
-            // Country
-            'country' => array (
-                'field' => 'country',
-                'type' => 'list',
-                'list' => $this->config['countries'],
-                'default' => 'US',
-                'use' => 'a'
-            ),
-
-            // Latitude
-            'lat' => array(
-                'field'    => 'lat',
-                'type'     => 'float',
-                'default'  => $this->config['settings']['maps_default_lat'],
-                'use'      => 'a'
-            ),
-
-            // Longitude
-            'lon' => array(
-                'field'    => 'lon',
-                'type'     => 'float',
-                'default'  => $this->config['settings']['maps_default_lon'],
-                'use'      => 'a'
-            ),
-
-            // Region
-            'region' => array (
-                'field' => 'region',
-                'type' => 'pointer',
-                    'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'regions',
-                    'p_field' => 'name',
-                    'p_orderby' => 'name',
-                    'p_blank' => true,
-                //  'force_list' => true,
-                'use' => 'a'
-            ),
-
-            // Phone
-            'phone' => array(
-                'field'    => 'phone',
-                'type'     => 'phone',
-                'use'      => 'a'
-            ),
-
-            // Toll Free
-            'toll_free' => array(
-                'field'    => 'toll_free',
-                'type'     => 'phone',
-                'use'      => 'a'
-            ),
-
-            // E-Mail Address
-            'email' => array(
-                'field'    => 'email',
-                'type'     => 'email',
-                'use'      => 'a'
-            ),
-
-            // URL
-            'url' => array(
-                'field'    => 'url',
-                'type'     => 'text',
-                'use'      => 'a'
-            ),
-
-            // Logo
-            'logo' => array(
-                    'field'    => 'logo',
-                    'type'     => 'image',
-                    'use'      => 'a'
-            ),
-
-            // Credit Cards Accepted - multi-pick
-            'cc_type' => array(
-                    'field'    => 'cc_type',
-                    'type'     => 'bitmap',
-                    'bitmap'    => $this->config['credit_card'],
-                    'default'  => 0, // no cards selected
-                    'use'      => 'a'
-            ),
-
             // Notes
             'notes' => array (
                     'field' => 'notes',
@@ -370,9 +249,6 @@ class GlmDataMembers extends GlmDataAbstract {
      *
      * Perform post-processing for all result entries.
      *
-     * In this case we're using it to append an array of category
-     * data to each member result and also sort by member name.
-     *
      * @param array $r Array of field result data for a single entry
      * @param string $a Action being performed (l, i, g, ...)
      *
@@ -381,29 +257,6 @@ class GlmDataMembers extends GlmDataAbstract {
      */
     public function entryPostProcessing($r, $a)
     {
-
-        // Only run these tests for 'l' (getList), 'g' (getEntry), 'e' (editEntry)
-        if (!$this->doPostProcessing || ($a != 'l' && $a != 'g' && $a != 'e')) {
-            return $r;
-        }
-
-        // Get Member Category data for this entry
-        $sql = "
-            SELECT CMI.member_info AS member_info_id, C.id, C.name, C.descr, C.short_descr,
-                   COALESCE (
-                        (
-                        SELECT name
-                          FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories
-                         WHERE id = C.parent
-                        ), ''
-                   ) AS parent_name
-              FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "categories AS C,
-                   ".GLM_MEMBERS_PLUGIN_DB_PREFIX. "category_member_info AS CMI
-             WHERE C.id = CMI.category
-               AND CMI.member_info = ".$r['id']."
-        ;";
-        $r['categories'] = $this->wpdb->get_results($sql, ARRAY_A);
-
         return $r;
     }
 
index c06d73f..545d8f6 100644 (file)
@@ -42,6 +42,8 @@ class GlmPluginSupport
     public static function addNotice ($message, $type = false, $title = false)
     {
 
+        update_option('glmMembersAdminHaveNotices', true);
+
         switch($type) {
 
             case 'Alert';
@@ -182,6 +184,23 @@ class GlmPluginSupport
 
                 $dbVersion = get_option($a['database']['dbActiveVersionOption']);
 
+/*
+                // Do a sanity check on the database version
+                if (!preg_match('^(\d+\.)?(\d+\.)?(\*|\d+)$', $dbVersion)) {
+
+                    // If there's a current version then try to set that in the WordPress option
+                    if (isset($a['database']['dbCurrentVersion']) && $a['database']['dbCurrentVersion'] != '') {
+                        update_option($a['database']['dbActiveVersionOption'], $a['database']['dbCurrentVersion']);
+                        $dbVersion = $a['database']['dbCurrentVersion'];
+
+                    // Not much we can do here....
+                    } else {
+                        return false;
+                    }
+
+                }
+*/
+
                 // Do a quick check for there being a database version but not all the required tables for that version
                 if ($dbVersion) {
 
@@ -240,7 +259,7 @@ class GlmPluginSupport
                     // Replace {prefix} with table name prefix
                     $sql = str_replace('{prefix}', $a['database']['dbPrefix'], $sql);
 
-                    // Split script into separate queries by looking for lines with only "---"
+                    // Split script into separate queries by looking for lines with only "----"
                     $queries = preg_split('/^----$/m', $sql);
 
                     // Try executing all queries to build database
@@ -379,3 +398,124 @@ class GlmPluginSupport
     }
 
 }
+
+/*
+ * Stand alone functions that are needed globally for these plugins/add-ons
+ */
+
+/*
+ * Function to display admin notices.
+ *
+ * This function is only called using the add_action('admin_notices','...') function
+ * in the code below this function.
+ *
+ * @return void
+ * @access public
+ */
+function glmMembersAdminNotices($windowed = true)
+{
+
+    $output  = '';
+
+    // If windowed for debug, also include HTML header and stylesheet
+    if ($windowed) {
+
+        $output .= '
+            <html>
+                <head>
+                    <link rel="stylesheet" href="'.GLM_MEMBERS_PLUGIN_URL.'/css/admin.css">
+                <head>
+                <body>
+                    <a name="top"></a>
+                    <div id="glm-debug-timestamp">'.date('m/d/Y G:i:s A').'</div>
+                    <div id="glm-debug-header">'.GLM_MEMBERS_PLUGIN_NAME.' - Debug Data</div>
+           ';
+
+        // Display alerts
+           $alerts = get_option('glmMembersAdminNoticeAlerts');
+           if(is_array($alerts)) {
+              $output .= '<div id="glm-debug-alerts" class="glm-error"><h2>Alerts</h2>';
+               foreach($alerts as $a) {
+               $output .= $a.'<br>';
+           }
+           } else {
+               $output .= '<div id="glm-debug-alerts"><h2>Alerts</h2>';
+           }
+        $output .= '</div><hr>';
+        delete_option('glmMembersAdminNoticeAlerts');
+
+           // Display process messages
+        $process = get_option('glmMembersAdminNoticeProcess');
+        $output .= '<div id="glm-debug-process"><h2>Processing</h2>';
+        if(is_array($process)) {
+            foreach($process as $p) {
+                $output .= $p.'<br>';
+            }
+        }
+        $output .= '</div><hr>';
+        delete_option('glmMembersAdminNoticeProcess');
+
+           // Display data blocks table of contents then the data blocks
+        $dataBlocks = get_option('glmMembersAdminNoticeDataBlocks');
+        $output .= '<div id="glm-debug-contents"><h2>Data Blocks</h2><ul>';
+        $n = 0;
+        if (is_array($dataBlocks)) {
+            foreach($dataBlocks as $d) {
+                $output .= '<li><a href="#'.++$n.'">'.$d['title'].'</a></li>';
+            }
+        }
+
+        $output .= '</ul></div><hr>';
+        if (is_array($dataBlocks)) {
+            reset($dataBlocks);
+            $n = 0;
+            foreach($dataBlocks as $d) {
+                $output .= '
+                    <div  style="margin-top: 2em;">
+                        <div style="float: right;"><a href="#top">[Top]</a></div>
+                        <div class="glm-debug-section-title"><a name="'.++$n.'"><h4>'.$d['title'].'</h4></a></div>
+                        <div class="glm-debug-section-body"><pre>'.print_r($d['data'],1).'</pre></div>
+                    </div>
+                ';
+            }
+        }
+
+        echo $output.'
+                </body>
+            </html>
+        ';
+
+    // Otherwise we're outputting data to the message block in the WordPress admin area
+    } else {
+
+        // Start with div class to output in standard admin notice block
+        $output .= '<div class="updated"><p>';
+
+        // Get the notice texts
+        $notices = get_option('glmMembersAdminNotices');
+
+        if (is_array($notices) && count($notices) > 0) {
+
+            // For each notice retrieved
+            $br = '';
+            foreach($notices as $n) {
+
+                // Add the notice to the output
+                $output .= $br.$n;
+                $br = '<br>';
+            }
+
+        }
+
+        echo $output.'</p></div>';
+
+
+    }
+
+    delete_option('glmMembersAdminNoticeAlerts');
+    delete_option('glmMembersAdminNotices');
+    delete_option('glmMembersAdminNoticeProcess');
+    delete_option('glmMembersAdminNoticeDataBlocks');
+
+}
+
index a678765..216bcef 100644 (file)
  * @link     http://dev.gaslightmedia.com/
  */
 
-// Load glmPluginSupport class
-require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
-
-// Load Smarty Template Support
-require_once (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php');
-
 /**
  * Admin Controller Class
  *
@@ -943,6 +937,15 @@ class glmMembersAdmin extends GlmPluginSupport
         // Generate output from model data and view
         $smarty->template->display($view);
 
+        // If debug is requested, create debug window
+        if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+            echo "
+                <script>
+                    window.open('".admin_url()."admin.php?page=glm-members-admin-menu-members&glmDebugWindow=true','GLM_Plugin_Debug','width=800,height=800,left=50,top=50,resizable=yes,scrollbars=yes');
+                </script>
+            ";
+        }
+
         // Restore timezone that was set before our code was called
         date_default_timezone_set($defaultTimeZone);
 
index d3367ce..4d5f875 100644 (file)
  * @link     http://dev.gaslightmedia.com/
  */
 
-// Load glmPluginSupport class
-require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
-
-// Load Smarty Template Support
-require_once (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php');
-
 /*
  * This class controls which models are use for front-end functionality
  * of this plugin.
@@ -485,6 +479,15 @@ class glmMembersFront extends GlmPluginSupport
         // Generate output from model data and view
         $out = $smarty->template->fetch($view);
 
+        // If debug is requested, create debug window
+        if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
+            echo "
+                <script>
+                    window.open('".admin_url()."admin.php?page=glm-members-admin-menu-members&glmDebugWindow=true','GLM_Plugin_Debug','width=800,height=800,left=50,top=50,resizable=yes,scrollbars=yes');
+                </script>
+            ";
+        }
+
         // Restore timezone that was set before our code was called
         date_default_timezone_set($defaultTimeZone);
 
index 4fb66e2..3f00020 100644 (file)
@@ -366,6 +366,12 @@ register_deactivation_hook(__FILE__, 'glmMembersPluginDeactivate');
 // Load data abstract
 require_once(GLM_MEMBERS_PLUGIN_LIB_PATH.'/GlmDataAbstract/DataAbstract.php');
 
+// Load glmPluginSupport class
+require_once (GLM_MEMBERS_PLUGIN_PATH . '/classes/glmPluginSupport.php');
+
+// Load Smarty Template Support
+require_once (GLM_MEMBERS_PLUGIN_PATH . '/lib/smartyTemplateSupport.php');
+
 /*
  *  Hook through which an add-on may supply additional logged in user information and
  *  have that data stored in the config array. Typically it would be the
@@ -413,154 +419,19 @@ if (isset($_REQUEST['glmDebugWindow']) && $_REQUEST['glmDebugWindow'] == true) {
 }
 
 /*
- * Function to display admin notices.
- *
- * This function is only called using the add_action('admin_notices','...') function
- * in the code below this function.
- *
- * @return void
- * @access public
+ * Display any notices?
  */
-function glmMembersAdminNotices($windowed = true)
-{
-
-    $output  = '';
-
-    // If windowed for debug, also include HTML header and stylesheet
-    if ($windowed) {
-
-        $output .= '
-            <html>
-                <head>
-                    <link rel="stylesheet" href="'.GLM_MEMBERS_PLUGIN_URL.'/css/admin.css">
-                <head>
-                <body>
-                    <a name="top"></a>
-                    <div id="glm-debug-timestamp">'.date('m/d/Y G:i:s A').'</div>
-                    <div id="glm-debug-header">'.GLM_MEMBERS_PLUGIN_NAME.' - Debug Data</div>
-           ';
-
-        // Display alerts
-           $alerts = get_option('glmMembersAdminNoticeAlerts');
-           if(is_array($alerts)) {
-              $output .= '<div id="glm-debug-alerts" class="glm-error"><h2>Alerts</h2>';
-               foreach($alerts as $a) {
-               $output .= $a.'<br>';
-           }
-           } else {
-               $output .= '<div id="glm-debug-alerts"><h2>Alerts</h2>';
-           }
-        $output .= '</div><hr>';
-        delete_option('glmMembersAdminNoticeAlerts');
-
-           // Display process messages
-        $process = get_option('glmMembersAdminNoticeProcess');
-        $output .= '<div id="glm-debug-process"><h2>Processing</h2>';
-        if(is_array($process)) {
-            foreach($process as $p) {
-                $output .= $p.'<br>';
-            }
-        }
-        $output .= '</div><hr>';
-        delete_option('glmMembersAdminNoticeProcess');
-
-           // Display data blocks table of contents then the data blocks
-        $dataBlocks = get_option('glmMembersAdminNoticeDataBlocks');
-        $output .= '<div id="glm-debug-contents"><h2>Data Blocks</h2><ul>';
-        $n = 0;
-        if (is_array($dataBlocks)) {
-            foreach($dataBlocks as $d) {
-                $output .= '<li><a href="#'.++$n.'">'.$d['title'].'</a></li>';
-            }
-        }
-
-        $output .= '</ul></div><hr>';
-        if (is_array($dataBlocks)) {
-            reset($dataBlocks);
-            $n = 0;
-            foreach($dataBlocks as $d) {
-                $output .= '
-                    <div  style="margin-top: 2em;">
-                        <div style="float: right;"><a href="#top">[Top]</a></div>
-                        <div class="glm-debug-section-title"><a name="'.++$n.'"><h4>'.$d['title'].'</h4></a></div>
-                        <div class="glm-debug-section-body"><pre>'.print_r($d['data'],1).'</pre></div>
-                    </div>
-                ';
-            }
-        }
-
-        echo $output.'
-                </body>
-            </html>
-        ';
-
-    // Otherwise we're outputting data to the message block in the WordPress admin area
-    } else {
-
-        // Start with div class to output in standard admin notice block
-        $output .= '<div class="updated"><p>';
-
-        // Get the notice texts
-        $notices = get_option('glmMembersAdminNotices');
-
-        if (is_array($notices) && count($notices) > 0) {
-
-            // For each notice retrieved
-            $br = '';
-            foreach($notices as $n) {
-
-                // Add the notice to the output
-                $output .= $br.$n;
-                $br = '<br>';
-            }
-
-        }
-
-        echo $output.'</p></div>';
-
 
-    }
-
-    delete_option('glmMembersAdminNoticeAlerts');
-    delete_option('glmMembersAdminNotices');
-    delete_option('glmMembersAdminNoticeProcess');
-    delete_option('glmMembersAdminNoticeDataBlocks');
-
-}
-
-/*
- * Check if there's any startup notices in this file. (stuff that happens before we get all setup)
- *
- * If there is, have the message displayed at the top of the wp-admin content area.
- */
-function glmMembersStartupNotices() {
+// Display any notices that need to be displayed at the top of the admin content area
+function glmMembersWordpressAdminNotices() {
     global $startupNotices;
     echo '<div class="updated"><h3>'.GLM_MEMBERS_PLUGIN_NAME.' Plugin Warning</h3><p>'.$startupNotices.'</p></div>';
 }
 if ($startupNotices != '') {
-    add_action('admin_notices','glmMembersStartupNotices');
-}
-
-/*
- * Check if there's any debug information or other notices that need to be displayed
- *
- * If there is, display as a separate window.
- *
- * NOTE: Need to break out notices that should be displayed in the wp-admin content area. To
- * do that I need to modify the glmMembersAdminNotices function above and the
- * addNotice() function in the classes/glmPluginSupport.php file. Should have addNotice()
- * function be able to add to another option specifically for doing this.
- */
-
-// Check for any notices that need to display at the top of an admin screen
-$notices = get_option('glmMembersAdminNotices');
-if (is_admin() && $notices) {
-    add_action('admin_notices','glmMembersAdminNotices');
+    add_action('admin_notices','glmMembersWordpressAdminNotices');
 }
 
-/*
- * If not doing debug, then just keep all of the debug messages cleared
- */
+// If not doing debug, then clear all of the debug messages
 if (!GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
     delete_option('glmMembersAdminNoticeAlerts');
     delete_option('glmMembersAdminNotices');
index 60896c1..c04f6ec 100755 (executable)
@@ -608,7 +608,7 @@ abstract class GlmDataAbstract
                 $res = $this->wpdb->get_row($sql, ARRAY_A);
 
                 if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-                    glmMembersAdmin::addNotice($sql, 'DataBlock', "pointerOutput() value data query ".$f['field'].(isset($f['as']) ? ' as '.$f['as'] : ''));
+                    $this->addDataAbstractNotice($sql, 'DataBlock', "pointerOutput() value data query ".$f['field'].(isset($f['as']) ? ' as '.$f['as'] : ''));
                 }
 
                 return $res['p_sum'];
@@ -625,7 +625,7 @@ abstract class GlmDataAbstract
                 $p_list = $this->wpdb->get_results($sql, ARRAY_A);
 
                 if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-                    glmMembersAdmin::addNotice($sql, 'DataBlock', "pointerOutput() value data query ".$f['field'].(isset($f['as']) ? ' as '.$f['as'] : ''));
+                    $this->addDataAbstractNotice($sql, 'DataBlock', "pointerOutput() value data query ".$f['field'].(isset($f['as']) ? ' as '.$f['as'] : ''));
                 }
 
                 // Build pick select table
@@ -699,7 +699,7 @@ abstract class GlmDataAbstract
 
 
             if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-                glmMembersAdmin::addNotice($sql, 'DataBlock', "pointerOutput() value data query ".$f['field'].(isset($f['as']) ? ' as '.$f['as'] : ''));
+                $this->addDataAbstractNotice($sql, 'DataBlock', "pointerOutput() value data query ".$f['field'].(isset($f['as']) ? ' as '.$f['as'] : ''));
             }
 
             return $res[$f['p_field']];
@@ -2384,7 +2384,7 @@ abstract class GlmDataAbstract
             } else {
 
                 if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-                    glmMembersAdmin::addNotice($newImage, 'DataBlock', "DataAbstract - imageInput() wp_get_image_editor($tmpFile) Error");
+                    $this->addDataAbstractNotice($newImage, 'DataBlock', "DataAbstract - imageInput() wp_get_image_editor($tmpFile) Error");
                 }
 
             }
@@ -2731,7 +2731,7 @@ abstract class GlmDataAbstract
         }
 
         if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-            glmMembersAdmin::addNotice($this->fieldData, 'DataBlock', "buildFieldsList() data");
+            $this->addDataAbstractNotice($this->fieldData, 'DataBlock', "buildFieldsList() data");
         }
 
         return;
@@ -2924,8 +2924,8 @@ abstract class GlmDataAbstract
         $stats = $this->wpdb->get_row($sql, ARRAY_A);
 
         if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-            glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getStats() query");
-            glmMembersAdmin::addNotice($stats, 'DataBlock', "Stats Data");
+            $this->addDataAbstractNotice($sql, 'DataBlock', "DataAbstract - getStats() query");
+            $this->addDataAbstractNotice($stats, 'DataBlock', "Stats Data");
         }
 
         return $stats['count'];
@@ -2971,7 +2971,7 @@ abstract class GlmDataAbstract
         }
 // echo "<pre>".print_r($sql,1)."</pre>";
         if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-            glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getList() query");
+            $this->addDataAbstractNotice($sql, 'DataBlock', "DataAbstract - getList() query");
         }
         $list = $this->wpdb->get_results($sql, ARRAY_A);
 
@@ -2986,7 +2986,7 @@ abstract class GlmDataAbstract
         }
 
         if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-            glmMembersAdmin::addNotice($newList, 'DataBlock', "getList() data");
+            $this->addDataAbstractNotice($newList, 'DataBlock', "getList() data");
         }
 
         return $newList;
@@ -3015,6 +3015,8 @@ abstract class GlmDataAbstract
                 ;";
         $detail = $this->wpdb->get_row($sql, ARRAY_A);
 
+        $this->addDataAbstractNotice($sql, 'DataBlock', "DataAbstract - getEntry() query");
+
         // If nothing was found, simply return false
                if ($detail == false) {
                        return false;
@@ -3023,11 +3025,7 @@ abstract class GlmDataAbstract
         // Process individual fields
         $detail = $this->processOutputData($detail, 'g', $fieldVals);
 
-
-        if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-            glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - getEntry() query");
-            glmMembersAdmin::addNotice($detail, 'DataBlock', "getEntry() data");
-        }
+        $this->addDataAbstractNotice($detail, 'DataBlock', "getEntry() data");
 
         return $detail;
     }
@@ -3156,7 +3154,7 @@ abstract class GlmDataAbstract
         $r = $this->checkOther($r, 'n');
 
         if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-            glmMembersAdmin::addNotice($r, 'DataBlock', "newEntry() data");
+            $this->addDataAbstractNotice($r, 'DataBlock', "newEntry() data");
         }
 
         return $r;
@@ -3234,7 +3232,7 @@ abstract class GlmDataAbstract
                 ";
 
                 if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-                    glmMembersAdmin::addNotice($sql, 'DataBlock', "insertEntry() Query");
+                    $this->addDataAbstractNotice($sql, 'DataBlock', "insertEntry() Query");
                 }
 
                 // Now store the field data
@@ -3244,7 +3242,7 @@ abstract class GlmDataAbstract
                 if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
                     $queryError = $this->wpdb->last_error;
                     if (trim($queryError) != '') {
-                        glmMembersAdmin::addNotice(
+                        $this->addDataAbstractNotice(
                             '<b>insertEntry() Query Failure</b><br>'
                             .'&nbsp;&nbsp;Error Message: '.$queryError.'<br>'
                             .'&nbsp;&nbsp;Table: '.$this->table, 'Alert');
@@ -3256,18 +3254,18 @@ abstract class GlmDataAbstract
 
             } else {
                 if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-                    glmMembersAdmin::addNotice('&nbsp;&nbsp;insertEntry() requested to NOT store new entry!', 'Process');
+                    $this->addDataAbstractNotice('&nbsp;&nbsp;insertEntry() requested to NOT store new entry!', 'Process');
                 }
             }
 
         } else {
             if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-                glmMembersAdmin::addNotice('&nbsp;&nbspcheckOther() returned bad status.', 'Process');
+                $this->addDataAbstractNotice('&nbsp;&nbspcheckOther() returned bad status.', 'Process');
             }
         }
 
         if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-            glmMembersAdmin::addNotice($r, 'DataBlock', "DataAbstract - insertEntry() data");
+            $this->addDataAbstractNotice($r, 'DataBlock', "DataAbstract - insertEntry() data");
         }
 
         return $r;
@@ -3293,7 +3291,7 @@ abstract class GlmDataAbstract
         if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
             $queryError = $this->wpdb->last_error;
             if (trim($queryError) != '') {
-                glmMembersAdmin::addNotice(
+                $this->addDataAbstractNotice(
                         '<b>editEntry() Query Failure</b><br>'
                         .'&nbsp;&nbsp;Error Message: '.$queryError.'<br>'
                         .'&nbsp;&nbsp;Table: '.$this->table, 'Alert');
@@ -3309,8 +3307,8 @@ abstract class GlmDataAbstract
         $detail = $this->processOutputData($detail, 'e', true, $id, $idField);
 
         if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-            glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - editEntry() query");
-            glmMembersAdmin::addNotice($detail, 'DataBlock', "editEntry() data");
+            $this->addDataAbstractNotice($sql, 'DataBlock', "DataAbstract - editEntry() query");
+            $this->addDataAbstractNotice($detail, 'DataBlock', "editEntry() data");
         }
 
 
@@ -3386,7 +3384,7 @@ abstract class GlmDataAbstract
             if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
                 $queryError = $this->wpdb->last_error;
                 if (trim($queryError) != '') {
-                    glmMembersAdmin::addNotice(
+                    $this->addDataAbstractNotice(
                             '<b>updateEntry() Query Failure</b><br>'
                             .'&nbsp;&nbsp;Error Message: '.$queryError.'<br>'
                             .'&nbsp;&nbsp;Table: '.$this->table, 'Alert');
@@ -3399,7 +3397,7 @@ abstract class GlmDataAbstract
         }
 
         if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-            glmMembersAdmin::addNotice($r, 'DataBlock', "updateEntry() data");
+            $this->addDataAbstractNotice($r, 'DataBlock', "updateEntry() data");
         }
 
         return $r;
@@ -3454,7 +3452,7 @@ abstract class GlmDataAbstract
                 ";
 
                 if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-                    glmMembersAdmin::addNotice($sql, 'DataBlock', "DataAbstract - deleteEntry() query");
+                    $this->addDataAbstractNotice($sql, 'DataBlock', "DataAbstract - deleteEntry() query");
                 }
 
                 // Assume things will go fine
@@ -3469,7 +3467,7 @@ abstract class GlmDataAbstract
         }
 
         if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE && class_exists('glmMembersAdmin')) {
-            glmMembersAdmin::addNotice($detail, 'DataBlock', "deleteEntry() data");
+            $this->addDataAbstractNotice($detail, 'DataBlock', "deleteEntry() data");
         }
 
         return $detail;
@@ -3637,6 +3635,24 @@ abstract class GlmDataAbstract
         return $date_list;
     }
 
+    /*
+     * Send notices to Admin or Front addNotice()
+     *
+     * @param (variable) $d1
+     * @param (variable) $d2
+     * @param (variable) $d3
+     *
+     * @return object Class object
+     *
+     */
+    public function addDataAbstractNotice ( $d1, $d2 = false, $d3 = false)
+    {
 
+        if (is_admin() && GLM_MEMBERS_PLUGIN_ADMIN_DEBUG_VERBOSE ) {
+            glmMembersAdmin::addNotice($d1, $d2, $d3);
+        } elseif (!is_admin() && GLM_MEMBERS_PLUGIN_FRONT_DEBUG_VERBOSE) {
+            glmMembersFront::addNotice($d1, $d2, $d3);
+        }
+    }
 }
 ?>
\ No newline at end of file
index f80e318..5a17e71 100644 (file)
@@ -143,8 +143,8 @@ class GlmMembersAdmin_dashboardWidget_index extends GlmDataMembers
         $membersPending = $MemberInfo->getStats('status = '.$this->config['status_numb']['Pending']);
 
         // Get member records with bad or no lat/lon
-        $hideArchived = " T.access != ".$this->config['access_numb']['Archived'];
-        $badLatLonList = $this->getSimpleMembersList($hideArchived.' AND (T.lat = 0 OR T.lon = 0)');
+        $hideArchived = " T.status != ".$this->config['status_numb']['Archived'];
+        $badLatLonList = $MemberInfo->getSimpleMemberInfoList($hideArchived.' AND (T.lat = 0 OR T.lon = 0)');
         $haveBadLatLon = (is_array($badLatLonList) && count($badLatLonList) > 0);
 
         // If there's members with pending information, list them
index 2dc9d82..ec47320 100644 (file)
@@ -109,7 +109,6 @@ class GlmMembersAdmin_member_memberEdit extends GlmDataMembers
         $success = true;
         $option = false;
         $haveMemberTypes = false;
-        $categories = false;
         $this->memberID = false;
         $memberUpdated = false;
         $memberUpdateError = false;
@@ -118,6 +117,12 @@ class GlmMembersAdmin_member_memberEdit extends GlmDataMembers
         $memberName = false;
         $addingMember = false;
 
+        // Check for action option - Should be one of the values in the "switch" statement below
+        $option = false;
+        if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+            $option = $_REQUEST['option'];
+        }
+
         /*
          * Get some data we're going to need
          */
@@ -128,20 +133,6 @@ class GlmMembersAdmin_member_memberEdit extends GlmDataMembers
         $memberTypesStats = $MemberTypes->getStats();
         $haveMemberTypes = ($memberTypesStats > 0);
 
-        /*
-         * Get a sorted list of categories to use for picklists.
-         * These will be sorted so sub-categories fall under their
-         * respective category.
-         */
-        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
-        $Categories = new GlmDataCategories($this->wpdb, $this->config);
-        $categories = $Categories->getListSortedParentChild();
-
-        // Check for action option - Should be one of the values in the "switch" statement below
-        if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
-            $option = $_REQUEST['option'];
-        }
-
         /*
          * Determine member ID to use
          */
@@ -211,12 +202,6 @@ class GlmMembersAdmin_member_memberEdit extends GlmDataMembers
             // Submit a member update
             case 'submit':
 
-                // Check for new cities being submitted
-                $this->checkNewCities();
-
-                // Update submitted categories
-                $this->updateCategories();
-
                 $memberData = $this->updateEntry($this->memberID);
 
                 if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
@@ -252,11 +237,6 @@ class GlmMembersAdmin_member_memberEdit extends GlmDataMembers
             // Add the new member
             case 'addNew':
 
-                    // Check for new cities being submitted
-                    $this->checkNewCities();
-
-                    // Update submitted categories
-                    $this->updateCategories();
                     $memberData = $this->insertEntry();
 
                     // If update was successful then use editEntry() to setup for the edit again.
@@ -309,7 +289,6 @@ class GlmMembersAdmin_member_memberEdit extends GlmDataMembers
         $templateData = array(
             'success' => $success,
             'haveMemberTypes' => $haveMemberTypes,
-            'availableCategories' => $categories,
             'memberID' => $this->memberID,
             'haveMember' => $haveMember,
             'member' => $memberData,
@@ -330,133 +309,6 @@ class GlmMembersAdmin_member_memberEdit extends GlmDataMembers
 
     }
 
-    /*
-     * Check for new Cities being submitted
-     *
-     * @return void
-     */
-    public function checkNewCities()
-    {
-
-        // If we have a member ID and this was a submission with a new city (id < 0)
-        if ($this->memberID && isset($_REQUEST['city']) && $_REQUEST['city'] == -1 && isset($_REQUEST['newCityName']) && trim($_REQUEST['newCityName']) != '') {
-
-            // Clean up city name
-            $cName = trim(filter_var($_REQUEST['newCityName']));
-
-            // Try to add the city
-            require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php');
-            $Cities = new GlmDataCities($this->wpdb, $this->config);
-            $cID = $Cities->addCity($cName);
-
-            // If we got a city id back
-            if (is_int($cID) && $cID > 0) {
-
-                // Update the city selected for this member record
-                $sql = "
-                        UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member
-                            SET city = $cID
-                            WHERE id = ".$this->memberID."
-                            ;";
-                $this->wpdb->query($sql);
-
-                // Update submitted city value to use the new ID
-                $_REQUEST['city'] = $cID;
-
-            }
-        }
-    }
-
-    /*
-     * Update categories for the current submission
-     *
-     * @return void
-     */
-    public function updateCategories()
-    {
-
-        // Instatiate the dataCategories class
-        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
-        $Categories = new GlmDataCategories($this->wpdb, $this->config);
-
-        // Instatiate categoryMemberInfo class
-        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategoryMemberInfo.php');
-        $CategoryMemberInfo = new GlmDataCategoryMemberInfo($this->wpdb, $this->config);
-
-        // Get any selected categories
-        $selectedCategories = array();
-        $newCategory = false;
-        if (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && count($_REQUEST['category']) > 0) {
-
-            /*
-             *  For each selected category
-             *
-             *  Note that categories are submitted with either a positive key, which indicates
-             *  that it represents an existing category, or a negative key, which indicates
-             *  that the user is trying to add it to the list of categories.
-             *
-             */
-            foreach ($_REQUEST['category'] as $key) {
-
-                // Make sure key is an integer
-                $key = intval($key -0);
-
-                // If negative, this is a new category that needs to be added to the category table
-                if ($key < 0) {
-
-                    $newCategory = true;
-
-                    // Check if a parent is specified
-                    $parent = 0;
-                    if ($_REQUEST['newCatParent'][$key] != '') {
-                        $parent = $_REQUEST['newCatParent'][$key] -0;
-                    } elseif ($_REQUEST['newCatParentName'][$key]) {
-                        $parent = $_REQUEST['newCatParentName'][$key];
-                    }
-
-                    // Clean up the category name
-                    $category = filter_var($_REQUEST['newCategory'][$key]);
-
-                    // Add it to the category table and get the new category ID
-                    $categoryID = $Categories->addCategory($category, $parent);
-
-                    // If we got a new category ID, add it to the array of currently selected categoryMember records
-                    if ($categoryID) {
-                        $selectedCategories[$categoryID] = $categoryID;
-                    }
-
-                    // Otherwise if it's positive, the category is an existing one
-                } else if ($key > 0) {
-
-                    $selectedCategories[$key] = $key;
-
-                }
-
-                // If there's selected categories
-                if (count($selectedCategories) > 0) {
-
-                    // Update the selected categories for this member information record, returns new list
-                    $CategoryMemberInfo->setMemberInfoCategories($this->memberID, $selectedCategories);
-
-                }
-
-                // If there's been a new category
-                if ($newCategory) {
-
-                    // Get the full category list again
-                    $this->categories = $Categories->getListSortedParentChild();
-
-                }
-
-            } // For each category being submitted
-
-            // Otherwise if this is a submission and there's no categories submitted, so make sure there's none stored
-        } elseif (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
-            $CategoryMemberInfo->clearMemberInfoCategories($this->memberID);
-        }
-
-    }
-
 }
 
 ?>
\ No newline at end of file
index a2524d6..f04f3e5 100644 (file)
@@ -200,6 +200,7 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
         $this->optionIncludeSelectListData = true;
         $memberUpdated = false;
         $memberUpdateError = false;
+        $categories = false;
 
         // Check for action option - Should be one of the values in the "switch" statement below
         $option = false;
@@ -266,6 +267,20 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
             glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;Option specified:</b> $option", 'Process');
         }
 
+        /*
+         * Get a sorted list of categories to use for picklists.
+         * These will be sorted so sub-categories fall under their
+         * respective category.
+         */
+        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
+        $Categories = new GlmDataCategories($this->wpdb, $this->config);
+        $categories = $Categories->getListSortedParentChild();
+
+        // Check for action option - Should be one of the values in the "switch" statement below
+        if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+            $option = $_REQUEST['option'];
+        }
+
         /*
          * Perform requested action
          */
@@ -281,9 +296,23 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
             // Process submission of a member information record update
             case 'submit':
 
+                // Check for new cities being submitted
+                $this->checkNewCities();
+
+                // Update submitted categories
+                $this->updateCategories();
+
                 // Update submitted amenities
                 $this->updateAmenities();
 
+                // Load Image data class
+                require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataImages.php');
+                $Images = new GlmDataImages($this->wpdb, $this->config);
+
+                // Update image gallery titles, descriptions, and image positions then return current image gallery
+                $this->imageGallery = $Images->galleryImageDataUpdate($this->config['ref_type_numb']['MemberInfo'], $this->memberInfoID, 'galleryPositionOrder');
+                $this->haveImageGallery = ($this->imageGallery != false);
+
                 if ($this->haveMemberInfo) {
 
                     // Update the member Info data
@@ -309,6 +338,12 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
             // Add the new member information record
             case 'addNew':
 
+                // Check for new cities being submitted
+                $this->checkNewCities();
+
+                // Update submitted categories
+                $this->updateCategories();
+
                 // Insert the new member info into the database
                 $this->memberName = $this->memberData['name'];
                 $this->memberInfo = $this->insertEntry();
@@ -433,6 +468,7 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
         // Compile template data
         $templateData = array(
             'haveMember' => $this->haveMember,
+            'availableCategories' => $categories,
             'memberID' => $this->memberID,
             'member' => $this->memberData,
             'memberName' => $memberName,
@@ -459,6 +495,132 @@ class GlmMembersAdmin_member_memberInfo extends GlmDataMemberInfo
     }
 
 
+    /*
+     * Check for new Cities being submitted
+     *
+     * @return void
+     */
+    public function checkNewCities()
+    {
+
+        // If we have a member ID and this was a submission with a new city (id < 0)
+        if ($this->memberID && isset($_REQUEST['city']) && $_REQUEST['city'] == -1 && isset($_REQUEST['newCityName']) && trim($_REQUEST['newCityName']) != '') {
+
+            // Clean up city name
+            $cName = trim(filter_var($_REQUEST['newCityName']));
+
+            // Try to add the city
+            require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php');
+            $Cities = new GlmDataCities($this->wpdb, $this->config);
+            $cID = $Cities->addCity($cName);
+
+            // If we got a city id back
+            if (is_int($cID) && $cID > 0) {
+
+                // Update the city selected for this member record
+                $sql = "
+                        UPDATE ".GLM_MEMBERS_PLUGIN_DB_PREFIX."member
+                            SET city = $cID
+                            WHERE id = ".$this->memberID."
+                            ;";
+                $this->wpdb->query($sql);
+
+                // Update submitted city value to use the new ID
+                $_REQUEST['city'] = $cID;
+
+            }
+        }
+    }
+
+    /*
+     * Update categories for the current submission
+     *
+     * @return void
+     */
+    public function updateCategories()
+    {
+
+        // Instatiate the dataCategories class
+        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategories.php');
+        $Categories = new GlmDataCategories($this->wpdb, $this->config);
+
+        // Instatiate categoryMemberInfo class
+        require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCategoryMemberInfo.php');
+        $CategoryMemberInfo = new GlmDataCategoryMemberInfo($this->wpdb, $this->config);
+
+        // Get any selected categories
+        $selectedCategories = array();
+        $newCategory = false;
+        if (isset($_REQUEST['category']) && is_array($_REQUEST['category']) && count($_REQUEST['category']) > 0) {
+
+            /*
+             *  For each selected category
+             *
+             *  Note that categories are submitted with either a positive key, which indicates
+             *  that it represents an existing category, or a negative key, which indicates
+             *  that the user is trying to add it to the list of categories.
+             *
+             */
+            foreach ($_REQUEST['category'] as $key) {
+
+                // Make sure key is an integer
+                $key = intval($key -0);
+
+                // If negative, this is a new category that needs to be added to the category table
+                if ($key < 0) {
+
+                    $newCategory = true;
+
+                    // Check if a parent is specified
+                    $parent = 0;
+                    if ($_REQUEST['newCatParent'][$key] != '') {
+                        $parent = $_REQUEST['newCatParent'][$key] -0;
+                    } elseif ($_REQUEST['newCatParentName'][$key]) {
+                        $parent = $_REQUEST['newCatParentName'][$key];
+                    }
+
+                    // Clean up the category name
+                    $category = filter_var($_REQUEST['newCategory'][$key]);
+
+                    // Add it to the category table and get the new category ID
+                    $categoryID = $Categories->addCategory($category, $parent);
+
+                    // If we got a new category ID, add it to the array of currently selected categoryMember records
+                    if ($categoryID) {
+                        $selectedCategories[$categoryID] = $categoryID;
+                    }
+
+                    // Otherwise if it's positive, the category is an existing one
+                } else if ($key > 0) {
+
+                    $selectedCategories[$key] = $key;
+
+                }
+
+                // If there's selected categories
+                if (count($selectedCategories) > 0) {
+
+                    // Update the selected categories for this member information record, returns new list
+                    $CategoryMemberInfo->setMemberInfoCategories($this->memberInfoID, $selectedCategories);
+
+                }
+
+                // If there's been a new category
+                if ($newCategory) {
+
+                    // Get the full category list again
+                    $this->categories = $Categories->getListSortedParentChild();
+
+                }
+
+            } // For each category being submitted
+
+            // Otherwise if this is a submission and there's no categories submitted, so make sure there's none stored
+        } elseif (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
+            $CategoryMemberInfo->clearMemberInfoCategories($this->memberID);
+        }
+
+    }
 
     /*
      * Check it there's no active information record
index 3d82ee3..51da337 100644 (file)
@@ -136,16 +136,16 @@ class GlmMembersAdmin_members_index extends GlmDataMembers
         $regionsStats = $Regions->getStats();
         $haveRegions = ($regionsStats > 0);
 
-        // Get member records with bad or no lat/lon
-        $hideArchived = " T.access != ".$this->config['access_numb']['Archived'];
-        $badLatLonList = $this->getSimpleMembersList($hideArchived.' AND (T.lat = 0 OR T.lon = 0)');
-        $haveBadLatLon = (is_array($badLatLonList) && count($badLatLonList) > 0);
-
         // Get number of member information records with pending updates
         require_once(GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMemberInfo.php');
         $MemberInfo = new GlmDataMemberInfo($this->wpdb, $this->config);
         $membersPending = $MemberInfo->getStats('status = '.$this->config['status_numb']['Pending']);
 
+        // Get member information records with bad or no lat/lon
+        $hideArchived = " T.status != ".$this->config['status_numb']['Archived'];
+        $badLatLonList = $MemberInfo->getSimpleMemberInfoList($hideArchived.' AND (T.lat = 0 OR T.lon = 0)');
+        $haveBadLatLon = (is_array($badLatLonList) && count($badLatLonList) > 0);
+
         // If there's members with pending information, list them
         $pendingList = false;
         if ($membersPending > 0) {
index a15dfef..250ecc4 100644 (file)
@@ -139,6 +139,7 @@ class GlmMembersFront_members_detail extends GlmDataMemberInfo
         $where = '';
         $haveMember = false;
         $haveImageGallery = false;
+        $success = false;
 
         // Check for "show" shortcode parameter
         $settings = array();
@@ -246,18 +247,7 @@ class GlmMembersFront_members_detail extends GlmDataMemberInfo
         $imageGallery = false;
 
         // Find the active member info record and get it with main member data
-        $where = "
-            (
-                SELECT access
-                 FROM ".GLM_MEMBERS_PLUGIN_DB_PREFIX."members
-                WHERE id = T.member
-            ) IN (
-                 ".$this->config['access_numb']['NoAccess'].",
-                 ".$this->config['access_numb']['Moderated'].",
-                 ".$this->config['access_numb']['Full']."
-                 )
-        ";
-        $memberData = $this->getActiveInfoForMemberWithMemberData($id, $where);
+        $memberData = $this->getActiveInfoForMember($id);
 
         if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
             glmMembersFront::addNotice($memberData, 'DataBlock', 'Member Info with Member Data');
@@ -282,9 +272,7 @@ class GlmMembersFront_members_detail extends GlmDataMemberInfo
             'haveMember' => $haveMember,
             'member' => $memberData,
             'haveImageGallery' => $haveImageGallery,
-            'imageGallery' => $imageGallery,
-            'havePackages' => false,
-            'packages' => false
+            'imageGallery' => $imageGallery
 
         );
 
index 6b6c71f..f42bf87 100644 (file)
@@ -435,7 +435,7 @@ class GlmMembersFront_members_list extends GlmDataMemberInfo
          */
 
         // Get member list and sort
-        $list = $this->getListWithMemberData($where.$alphaWhere, 'member_name');
+        $list = $this->getList($where.$alphaWhere, 'member_name');
 
         if (GLM_MEMBERS_PLUGIN_FRONT_DEBUG) {
             glmMembersFront::addNotice($list, 'DataBlock', 'Member Data');
index a14a337..af11b7c 100644 (file)
@@ -150,21 +150,6 @@ CREATE TABLE {prefix}members (
   created DATE NULL,                        -- Date member record was created
   name TINYTEXT NULL,                       -- Member name
   member_slug TINYTEXT NULL,                -- Member name slug for canonical URLs (lowercase, "-" for spaces, no punctuation)
-  addr1 TINYTEXT NULL,                      -- Main member location address line 1
-  addr2 TINYTEXT NULL,                      -- Address line 2
-  city INT NULL,                            -- Pointer to City in cities table
-  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
-  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries
-  zip TINYTEXT NULL,                        -- ZIP/Postal code
-  lat FLOAT NULL,                           -- Latitude of member's location
-  lon FLOAT NULL,                           -- Longitude of member's location
-  region INT NULL,                          -- Pointer to entry in regions table
-  phone TINYTEXT NULL,                      -- Primary phone number
-  toll_free TINYTEXT NULL,                  -- Toll Free phone number
-  url TINYTEXT NULL,                        -- URL with information about this member
-  email TINYTEXT NULL,                      -- Main E-Mail address for this member
-  logo TINYTEXT NULL,                       -- Member logo
-  cc_type INT NULL,                         -- Bitmap of credit card types accepted - See credit_card array in plugin.ini
   notes TEXT NULL,                          -- General notes - Not displayed in front-end
   PRIMARY KEY (id),
   INDEX(name(20)),
@@ -183,6 +168,21 @@ CREATE TABLE {prefix}member_info (
   reference_name TINYTEXT NULL,             -- Refernce name for this member information record - Not displayed on front-end
   descr TEXT NULL,                          -- Description
   short_descr TEXT NULL,                    -- Short description
+  addr1 TINYTEXT NULL,                      -- Main member location address line 1
+  addr2 TINYTEXT NULL,                      -- Address line 2
+  city INT NULL,                            -- Pointer to City in cities table
+  state TINYTEXT NULL,                      -- Two character state code - matches states.ini entries
+  country TINYTEXT NULL,                    -- Two character country code - matches countries.ini entries
+  zip TINYTEXT NULL,                        -- ZIP/Postal code
+  lat FLOAT NULL,                           -- Latitude of member's location
+  lon FLOAT NULL,                           -- Longitude of member's location
+  region INT NULL,                          -- Pointer to entry in regions table
+  phone TINYTEXT NULL,                      -- Primary phone number
+  toll_free TINYTEXT NULL,                  -- Toll Free phone number
+  url TINYTEXT NULL,                        -- URL with information about this member
+  email TINYTEXT NULL,                      -- Main E-Mail address for this member
+  logo TINYTEXT NULL,                       -- Member logo
+  cc_type INT NULL,                         -- Bitmap of credit card types accepted - See credit_card array in plugin.ini
   notes TEXT NULL,                          -- General notes - Not displayed in front-end
   create_time TIMESTAMP NULL,               -- Create date/time
   modify_time TIMESTAMP NULL,               -- Last update date/time
index e6519d8..a20e7c5 100644 (file)
@@ -24,180 +24,5 @@ DROP TABLE IF EXISTS
 
 ----
 
-ALTER TABLE {prefix}members ADD COLUMN addr1 TINYTEXT;
-
-----
-
-UPDATE {prefix}members M SET addr1 = (SELECT addr1 FROM {prefix}member_info WHERE member = M.id  AND addr1 > '' AND status in (30, 20, 10) LIMIT 1);
-
-----
-
-ALTER TABLE {prefix}members ADD COLUMN addr2 TINYTEXT;
-
-----
-
-UPDATE {prefix}members M SET addr2 = (SELECT addr2 FROM {prefix}member_info WHERE member = M.id  AND addr2 > '' AND status in (30, 20, 10) LIMIT 1);
-
-----
-
-ALTER TABLE {prefix}members ADD COLUMN city INT;
-
-----
-
-UPDATE {prefix}members M SET city = (SELECT city FROM {prefix}member_info WHERE member = M.id  AND city > 0 AND status in (30, 20, 10) LIMIT 1);
-
-----
-
-ALTER TABLE {prefix}members ADD COLUMN state TINYTEXT;
-
-----
-
-UPDATE {prefix}members M SET state = (SELECT state FROM {prefix}member_info WHERE member = M.id  AND state > '' AND status in (30, 20, 10) LIMIT 1);
-
-----
-
-ALTER TABLE {prefix}members ADD COLUMN zip TINYTEXT;
-
-----
-
-UPDATE {prefix}members M SET zip = (SELECT zip FROM {prefix}member_info WHERE member = M.id  AND zip > '' AND status in (30, 20, 10) LIMIT 1);
-
-----
-
-ALTER TABLE {prefix}members ADD COLUMN country TINYTEXT;
-
-----
-
-UPDATE {prefix}members M SET country = (SELECT country FROM {prefix}member_info WHERE member = M.id  AND country > '' AND status in (30, 20, 10) LIMIT 1);
-
-----
-
-ALTER TABLE {prefix}members ADD COLUMN lat FLOAT;
-
-----
-
-UPDATE {prefix}members M SET lat = (SELECT lat FROM {prefix}member_info WHERE member = M.id  AND lat != 0 AND status in (30, 20, 10) LIMIT 1);
-
-----
-
-ALTER TABLE {prefix}members ADD COLUMN lon FLOAT;
-
-----
-
-UPDATE {prefix}members M SET lon = (SELECT lon FROM {prefix}member_info WHERE member = M.id  AND lon != 0 AND status in (30, 20, 10) LIMIT 1);
-
-----
-
-ALTER TABLE {prefix}members ADD COLUMN region INT;
-
-----
-
-UPDATE {prefix}members M SET region = (SELECT region FROM {prefix}member_info WHERE member = M.id  AND region > 0 AND status in (30, 20, 10) LIMIT 1);
-
-----
-
-ALTER TABLE {prefix}members ADD COLUMN phone TINYTEXT;
-
-----
-
-UPDATE {prefix}members M SET phone = (SELECT phone FROM {prefix}member_info WHERE member = M.id  AND phone > '' AND status in (30, 20, 10) LIMIT 1);
-
-----
-
-ALTER TABLE {prefix}members ADD COLUMN toll_free TINYTEXT;
-
-----
-
-UPDATE {prefix}members M SET toll_free = (SELECT toll_free FROM {prefix}member_info WHERE member = M.id  AND toll_free > '' AND status in (30, 20, 10) LIMIT 1);
-
-----
-
-ALTER TABLE {prefix}members ADD COLUMN email TINYTEXT;
-
-----
-
-UPDATE {prefix}members M SET email = (SELECT email FROM {prefix}member_info WHERE member = M.id  AND email > '' AND status in (30, 20, 10) LIMIT 1);
-
-----
-
-ALTER TABLE {prefix}members ADD COLUMN url TINYTEXT;
-
-----
-
-UPDATE {prefix}members M SET url = (SELECT url FROM {prefix}member_info WHERE member = M.id  AND url > '' AND status in (30, 20, 10) LIMIT 1);
-
-----
-
-ALTER TABLE {prefix}members ADD COLUMN logo TINYTEXT;
-
-----
-
-UPDATE {prefix}members M SET logo = (SELECT logo FROM {prefix}member_info WHERE member = M.id  AND logo > '' AND status in (30, 20, 10) LIMIT 1);
-
-----
-
-ALTER TABLE {prefix}members ADD COLUMN cc_type INT;
-
-----
-
-UPDATE {prefix}members M SET cc_type = (SELECT cc_type FROM {prefix}member_info WHERE member = M.id  AND cc_type > 0 AND status in (30, 20, 10) LIMIT 1);
-
-----
-
 ALTER TABLE {prefix}members ADD COLUMN notes TEXT;
 
-----
-
-ALTER TABLE {prefix}member_info DROP COLUMN addr1;
-
-----
-
-ALTER TABLE {prefix}member_info DROP COLUMN addr2;
-
-----
-
-ALTER TABLE {prefix}member_info DROP COLUMN city;
-
-----
-
-ALTER TABLE {prefix}member_info DROP COLUMN state;
-
-----
-
-ALTER TABLE {prefix}member_info DROP COLUMN zip;
-
-----
-
-ALTER TABLE {prefix}member_info DROP COLUMN country;
-
-----
-
-ALTER TABLE {prefix}member_info DROP COLUMN lat;
-
-----
-
-ALTER TABLE {prefix}member_info DROP COLUMN lon;
-
-----
-
-ALTER TABLE {prefix}member_info DROP COLUMN region;
-
-----
-
-ALTER TABLE {prefix}member_info DROP COLUMN phone;
-
-----
-
-ALTER TABLE {prefix}member_info DROP COLUMN toll_free;
-
-----
-
-ALTER TABLE {prefix}member_info DROP COLUMN url;
-
-----
-
-ALTER TABLE {prefix}member_info DROP COLUMN logo;
-
-----
-
-ALTER TABLE {prefix}member_info DROP COLUMN cc_type;
index 3d8d7a8..9e524da 100644 (file)
                      select: function( event, ui ) {
                          var memberID = ui.item.id;
                          window.location.replace("{$adminURL}?page=glm-members-admin-menu-member&glm_action=index&member=" + memberID );
+                     },
+                     response: function(event, ui) {
+                         if (!ui.content.length) {
+                             var noResult = { value:"",label:"No results found" };
+                             ui.content.push(noResult);
+                         }
                      }
                  });
                                  
             <tr class="alternate">
         {/if}
                 <td>
-                    <a href="{$adminURL}?page=glm-members-admin-menu-member&glm_action=member&member={$p.id}">{$p.name}</a>
+                    <a href="{$adminURL}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$p.member_pointer}&memberInfo={$p.id}">{$p.member}:</a> {$p.reference_name}
                 </td>
             </tr>
     {/foreach}
         {/if}
                 <td>
                     <span class="glm-admin-table-medium-text">
-                        <a href="{$adminURL}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$p.member_pointer}&id={$p.id}}">{$p.member}</a>:  
+                        <a href="{$adminURL}?page=glm-members-admin-menu-member&glm_action=memberInfo&member={$p.member_pointer}&memberInfo={$p.id}}">{$p.member}</a>:  
                         {$p.reference_name}
                     </span>
                 </td>
index d34194c..6029dc1 100644 (file)
@@ -7,10 +7,5 @@
         <a href="http://www.gaslightmedia.com">http://www.gaslightmedia.com</a>
     </div>
      
-  {if $adminDebug}
-    <script>
-        window.open('{$thisURL}?page={$thisPage}&glmDebugWindow=true','GLM_Plugin_Debug','width=800,height=800,left=50,top=50,resizable=yes,scrollbars=yes');
-    </script>
-  {/if}
   
 </div> <!-- / wrap -->
\ No newline at end of file
index 70f07bd..6f14409 100644 (file)
 
   {if $haveMember}
     <table class="glm-admin-table">
+        <tr><td><span class="glm-admin-table-large-bold-text">{$member.fieldData.name}</span></td></tr>
         <tr>
             <td>
-                <span class="glm-admin-table-large-bold-text">{$member.fieldData.name}</span><br>
-                {if $member.fieldData.addr1}{$member.fieldData.addr1}<br>{/if}
-                {if $member.fieldData.addr2}{$member.fieldData.addr2}<br>{/if}
-                {if $member.fieldData.city.name}{$member.fieldData.city.name}{if $member.fieldData.state.name}, {/if}{/if}
-                {if $member.fieldData.state.name}{$member.fieldData.state.name}{/if}
-                {if $member.fieldData.zip}{$member.fieldData.zip}{/if}
-                {if $member.fieldData.country.name}{$member.fieldData.country.name}{/if}
-                <br>
-                {if $member.fieldData.phone}Phone: {$member.fieldData.phone}<br>{/if}
-                {if $member.fieldData.toll_free}Toll Free: {$member.fieldData.toll_free}<br>{/if}
-                {if $member.fieldData.email}E-Mail Address: {$member.fieldData.email}<br>{/if}
-                {if $member.fieldData.url}<a href="{$member.fieldData.url}" target="_blank">{$member.fieldData.url}</a><br>{/if}
-                
-                
-            </td>
-            <td>      
                 <table class="glm-admin-table">
                     <tr>
                         <th>Member Slug:</th>
                         <td class="glm-nowrap">{$member.fieldData.member_slug}</td>
                     </tr>
+                    <tr><th>Date created:</th><td>{$member.fieldData.created.date}</td></tr>
+                </table>
+            </td>
+            <td>      
+                <table class="glm-admin-table">
                     <tr>
                         <th>Member Display & Access:</th>
                         <td class="glm-nowrap">{$member.fieldData.access.name}</td>
                         <th>Member Type:</th>
                         <td>{$member.fieldData.member_type.name}</td>
                     </tr>            
-                    <tr><th>Date created:</th><td>{$member.fieldData.created.date}</td></tr>
                 </table>
             </td>
             <td class="glm-right">
-                <span class="glm-right"><a href="{$thisURL}?page={$thisPage}&glm_action=memberEdit&member={$memberID}" class="button button-primary glm-button glm-right">Edit Base Member Information</a></span>
+                <span class="glm-right"><a href="{$thisURL}?page={$thisPage}&glm_action=memberEdit&member={$memberID}" class="button button-primary glm-button glm-right">Edit Member Name and Status</a></span>
             </td>
         </tr>            
     </table>
                 <td>{$m.create_time.datetime}</td>
                 <td>{$m.modify_time.datetime}</td>
                 <td>
+                    {if $m.bad_lat_lon}<span class="glm-error">Bad Map Location</span>{/if}
           {if apply_filters('glm_members_permit_admin_member_index_clone_activate_info_version', true)}       
                     <a href="{$thisURL}?page={$thisPage}&glm_action=memberInfo&member={$memberID}&memberInfo={$m.id}&option=clone" class="button button-secondary glm-button-small glm-right">Clone</a>&nbsp;
                     {if $m.status.name != 'Active'}<a href="{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}&activateID={$m.id}" class="button button-secondary glm-button-small glm-right">Activate</a>{/if}
index a0a88cf..d3d9e76 100644 (file)
@@ -1,12 +1,5 @@
 {include file='admin/member/header.html'}
 
-    <script src="http://maps.googleapis.com/maps/api/js?&key={$settings.google_maps_api_key}"></script>
-    <script type="text/javascript">var enableDraggable = true;</script>
-
-    <!--[if lt IE 9]>
-      <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
-    <![endif]-->
-
 {if $haveMember || $addingMember}
  {if $haveMemberTypes}
 
@@ -15,8 +8,12 @@
   {if $addingMember}
         Add New Member
   {else}
-        Edit Member Information
+        Edit Member Name and Status
   {/if}
+        {if $memberUpdated}<span class="glm-notice glm-flash-updated glm-right">Member Updated</span>{/if}
+        {if $memberUpdateError}<span class="glm-error glm-flash-updated glm-right">Member Update Error</span>{/if}
+        
+        
     </h2>
 
   {if apply_filters('glm_members_permit_admin_member_index_edit_member', true)}
         <input type="hidden" name="created" value="{$member.fieldData.created.date}">
       {/if}
         
-        <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
-            <a id="glm-member-general" data-show-table="glm-table-general" class="glm-member-tab nav-tab nav-tab-active">General Settings</a>
-            <a id="glm-member-address" data-show-table="glm-table-address" class="glm-member-tab nav-tab">Address and Location</a>
-            <a id="glm-member-other" data-show-table="glm-table-other" class="glm-member-tab nav-tab">Other Information</a>
-            {if $memberUpdated}<span class="glm-notice glm-flash-updated glm-right">Member Updated</span>{/if}
-            {if $memberUpdateError}<span class="glm-error glm-flash-updated glm-right">Member Update Error</span>{/if}
-        </h2>
-        
         <!-- **** General Settings **** -->
                 
         <table id="glm-table-general" class="glm-admin-table glm-member-table">
                 </td>
             </tr>
         </table>
-        
-        <!-- **** Address and Location **** -->
-        
-        <table id="glm-table-address" class="glm-admin-table glm-hidden glm-member-table">
-            <tr>
-                <th {if $member.fieldRequired.addr1}class="glm-required"{/if}>Address Line 1:</th>
-                <td {if $member.fieldFail.addr1}class="glm-form-bad-input glm-form-bad-input-address"{/if}>
-                    <input type="text" id="addr1" name="addr1" value="{$member.fieldData.addr1}" class="glm-form-text-input">
-                    {if $member.fieldFail.addr1}<p>{$member.fieldFail.addr1}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $member.fieldRequired.addr2}class="glm-required"{/if}>Address Line 2:</th>
-                <td {if $member.fieldFail.addr2}class="glm-form-bad-input glm-form-bad-input-address"{/if}>
-                    <input id="addr2" type="text" name="addr2" value="{$member.fieldData.addr2}" class="glm-form-text-input">
-                    {if $member.fieldFail.addr2}<p>{$member.fieldFail.addr2}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th>City</th>
-                <td class="glm-item-container">
-                    <!--  Add new city dialog -->
-                    <div id="newCityButton" class="button button-secondary glm-right">Add a new City</div>
-                    <div id="newCityDialog" class="glm-dialog-box" title="Enter a New City">
-                        <table class="glm-admin-table">
-                            <tr>
-                                <th class="glm-required">City Name:</th>
-                                <td id="newCityNameTD">
-                                    <input id="newCityName" type="text" name="newCityName" class="glm-form-text-input">
-                                    <div id="newCityNameRequired"></div>
-                                </td>
-                            </tr>
-                        </table>
-                        <p><span class="glm-required">*</span> Required</p>
-                        <a id="newCityCancel" class="button button-primary glm-right">Cancel</a>
-                        <input id="newCitySubmit" type="submit" value="Add new City">
-                    </div>
-                    <!-- City Selection -->
-                    <input id="cityName" type="hidden" name="newCityName" value=""><!-- this field is only used if adding a new city to pass the new name -->
-                    <select name="city" id="city">
-                        <option value="0"></option>
-        {foreach from=$member.fieldData.city.list item=v}
-                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
-                            {$v.name}
-                        </option>
-        {/foreach}
-                    </select>
-                </td>
-            </tr>
-            <tr>
-                <th {if $member.fieldRequired.state}class="glm-required"{/if}>State:</th>
-                <td {if $member.fieldFail.state}class="glm-form-bad-input glm-form-bad-input-address"{/if}>
-                    <select id="state" name="state">
-        {foreach from=$member.fieldData.state.list item=v}
-                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
-                            {$v.name}
-                        </option>
-        {/foreach}
-                    </select>
-                    {if $member.fieldFail.state}<p>{$member.fieldFail.state}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $member.fieldRequired.zip}class="glm-required"{/if}>ZIP / Postal Code:</th>
-                <td {if $member.fieldFail.zip}class="glm-form-bad-input glm-form-bad-input-address"{/if}>
-                    <input id="zip" type="text" name="zip" value="{$member.fieldData.zip}" class="glm-form-text-input-short">
-                    {if $member.fieldFail.zip}<p>{$member.fieldFail.zip}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $member.fieldRequired.country}class="glm-required"{/if}>Country:</th>
-                <td {if $member.fieldFail.country}class="glm-form-bad-input glm-form-bad-input-address"{/if}>
-                    <select id="country" name="country">
-        {foreach from=$member.fieldData.country.list item=v}
-                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
-                            {$v.name} {$v.value}
-                        </option>
-        {/foreach}
-                    </select>
-                    {if $member.fieldFail.country}<p>{$member.fieldFail.country}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                {if $member.fieldRequired.lat}<th class="emRequiredInputField">{else}<th>{/if}Location:</th>
-                <td>
-                    <input id="glmLat" name="lat" type="hidden" value="{$member.fieldData.lat}">
-                    <input id="glmLng" name="lon" type="hidden" value="{$member.fieldData.lon}">
-                    <div id="glm-estimate-location" class="button button-secondary">Map Location Using Above Address</div>
-                    <p>
-                        MAP USE: Drag the pointer to the desired location for this member.
-                        Use + and - buttons or the mouse wheel to zoom in or out.
-                        Click and drag anywhere else on the map to move to another area.
-                    </p>
-                    <div id="locationMap" class="glm-map-edit">(map loads here)</div>
-                    Selected Position: <span id="mapPosition">Lat {$member.fieldData.lat}, Lon {$member.fieldData.lon}</span>
-                </td>
-            </tr>
-        </table>
-        
-        <!-- **** Other Information **** -->
-        
-        <table id="glm-table-other" class="glm-admin-table glm-hidden glm-member-table">
-            <tr>
-                <th>Categories</th>
-                <td class="glm-item-container">
-                    <!--  Add new category dialog -->
-                    <div id="newCategoryButton" class="button button-secondary glm-right">Add a new Category</div>
-                    <div id="newCategoryDialog" class="glm-dialog-box" title="Enter a New Category">
-                            <table class="glm-admin-table">
-                                <tr>
-                                    <th class="glm-required">Category Name:</th>
-                                    <td id="newCatNameTD">
-                                        <input id="newCatName" type="text" name="newCatName" class="glm-form-text-input">
-                                        <div id="newCatNameRequired"></div>
-                                    </td>
-                                </tr>
-                                <tr>
-                                    <th>Parent Category:</th>
-                                    <td>
-                                        <select id="newCatParent" name="newCatParent">
-                            {if $availableCategories}
-                                            <option value=""></option>
-                                {foreach $availableCategories as $t}
-                                    {if !$t.parent.value} <!-- don't show child categories -->
-                                            <option value="{$t.id}" data-parent="{$t.name}">{$t.name}</option>
-                                    {/if}
-                                {/foreach}
-                            {/if}
-                                        </select>
-                                        <br>OR<br>
-                                        <input id="newCatParentName" type="text" name="newCatParentName" placeholder="Enter a new parent name."> 
-                                    </td>
-                                </tr>
-                            </table>
-                            <p><span class="glm-required">*</span> Required</p>
-                            <a id="newCategoryCancel" class="button button-primary glm-right">Cancel</a>
-                            <input id="newCategorySubmit" type="submit" value="Add new Category">
-                    </div>
-                    <!-- Category Selection -->
-                    <select name="categorySelect" id="categorySelect">
-        {if $availableCategories}
-                        <option id="categoryNone" value=""></option>
-            {foreach from=$availableCategories item=v}
-                        <option value="{$v.id}" data-parent="{$v.parent.name}">
-                            {if $v.parent.value}&nbsp;&nbsp;&nbsp;&nbsp;{/if}{$v.name}
-                        </option>
-            {/foreach}
-        {else}
-                        <option id="" value="">(No Categories Listed - Select "Add a new Category" to the right. )</option>  
-        {/if}
-                    </select>&nbsp;&nbsp; Select a category to add to box below.<br>
-                    <div id="activeCategories" class="glm-dynSelect-box">
-                    
-        {if isset($member.fieldData.categories) && $member.fieldData.categories}
-            {foreach from=$member.fieldData.categories item=c}
-                        <div data-id="{$c.id}" class="glm-dynSelect-item glm-members-catgegory"> 
-                            {if $c.parent_name != ''}{$c.parent_name}: {/if}{$c.name} 
-                            <span data-id="{$c.id}" class="glm-dynSelect-delete catDelete">X</span>
-                            <input type="hidden" name="category[{$c.id}]" value="{$c.id}">
-                       </div>                    
-            {/foreach}
-        {/if}                    
-                    </div>
-                </td>
-            </tr>
-            <tr>
-                <th {if $member.fieldRequired.region}class="glm-required"{/if}>Region:</th>
-                <td {if $member.fieldFail.region}class="glm-form-bad-input glm-form-bad-input-other"{/if}>
-                    <select name="region">
-        {foreach from=$member.fieldData.region.list item=v}
-                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>{$v.name}</option>
-        {/foreach}
-                    </select>
-                    {if $member.fieldFail.region}<p>{$member.fieldFail.region}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $member.fieldRequired.phone}class="glm-required"{/if}>Phone #:</th>
-                <td {if $member.fieldFail.phone}class="glm-form-bad-input glm-form-bad-input-other"{/if}>
-                    <input type="text" name="phone" value="{$member.fieldData.phone}" class="glm-form-text-input-short" placeholder="ex: 123-456-7890 ext 123">
-                    {if $member.fieldFail.phone}<p>{$member.fieldFail.phone}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $member.fieldRequired.toll_free}class="glm-required"{/if}>Toll Free #:</th>
-                <td {if $member.fieldFail.toll_free}class="glm-form-bad-input glm-form-bad-input-other"{/if}>
-                    <input type="text" name="toll_free" value="{$member.fieldData.toll_free}" class="glm-form-text-input-short" placeholder="ex: 800-123-4567">
-                    {if $member.fieldFail.toll_free}<p>{$member.fieldFail.toll_free}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $member.fieldRequired.url}class="glm-required"{/if}>Web Address (URL):</th>
-                <td {if $member.fieldFail.url}class="glm-form-bad-input glm-form-bad-input-other"{/if}>
-        {if $member.fieldData.url}
-                    <a class="button button-secondary glm-right" href="{$member.fieldData.url}" target="urlTarget">Test Link</a>
-        {/if}
-                    <input type="text" name="url" value="{$member.fieldData.url}" class="glm-form-text-input-medium" placeholder="ex: http://www.gaslightmedia.com">
-                    {if $member.fieldFail.url}<p>{$member.fieldFail.url}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $member.fieldRequired.cc_type}class="glm-required"{/if}>Credit Cards Accepted:</th>
-                <td {if $member.fieldFail.cc_type}class="glm-form-bad-input glm-form-bad-input-other"{/if}>
-        {foreach from=$member.fieldData.cc_type.bitmap item=v}
-                    <input type="checkbox" name="cc_type[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
-        {/foreach}                    
-                    {if $member.fieldFail.cc_type}<p>{$member.fieldFail.cc_type}</p>{/if}
-                </td>
-            </tr>
-            <tr>
-                <th {if $member.fieldRequired.logo}class="glm-required"{/if}>Logo:</th>
-                <td {if $member.fieldFail.logo}class="glm-form-bad-input"{/if}>
-                    <table class="glm-admin-image-edit-table">
-        {if $member.fieldData.logo}
-                        <tr>
-                            <td>
-                                <div class="glm-galleryImage" data-id="logo">
-                                    <img src="{$glmPluginMediaURL}/images/small/{$member.fieldData.logo}">
-                                </div>
-                            </td>
-                            <td>
-                                <input type="checkbox" name="logo_delete"> Delete Image<br>
-                                {$member.fieldData.logo}<br>
-                            </td>
-                        </tr>
-        {/if}
-                        <tr><td colspan="2"><b>New image:</b> <input type="file" name="logo_new"></td></tr>
-                    </table>
-                    <div id="glm-galleryImageLarger_logo" class="glm-imageDialog"><img src="{$glmPluginMediaURL}/images/large/{$member.fieldData.logo}"></div>
-                    {if $member.fieldFail.logo}<p>{$member.fieldFail.logo}</p>{/if}
-                </td>
-            </tr>
-        </table>
         <p><span class="glm-required">*</span> Required</p>
     {if $addingMember}
         <input id="updateMember" type="submit" value="Add new member">
 
 
     <script type="text/javascript">
-        jQuery(document).ready(function($) {
-            
-            /*
-             * Edit area tabs
-             */
-            $('.glm-member-tab').click( function() {
+        jQuery(document).ready(function($) {            
 
-                // Clear tabl highlights and hide all tables
-                $('.glm-member-tab').removeClass('nav-tab-active');
-                $('.glm-member-table').addClass('glm-hidden');
-                
-                // Highlight selected tab
-                $(this).addClass('nav-tab-active');
-                
-                // Show selected table
-                var table = $(this).attr('data-show-table');
-                $('#' + table).removeClass('glm-hidden');
-                
-                if (table == 'glm-table-address') {
-                    initMap();
-                }
-                
-            });
-            
-            /*
-             * Category Selection
-             */
-             
-            // Action to select a category
-            $('#categorySelect').change( function() {
-                
-                // Get the ID, name, and parent of the category
-                var catValue = $('#categorySelect').val();       
-                var catName = $('#categorySelect').find(':selected').text();
-                var catParent = $('#categorySelect').find(':selected').attr('data-parent');
-                
-                // Check if the category has already been added
-                var found = false;              
-                $(".glm-members-catgegory").each( function() {
-                    var id = $(this).attr('data-id');
-                    if (id == catValue) {
-                        found = true;
-                    }
-                });
-  
-                // Check if there's a parent
-                parentName = '';
-                if (catParent != '') {
-                    parentName = catParent + ': ';
-                }
-                
-                // If not found, Add the category
-                if (!found) {
-                    $('#activeCategories').append('<div data-id="' + catValue 
-                            + '" class="glm-dynSelect-item glm-members-catgegory">' 
-                            + parentName + catName.trim() + ' <span class="glm-dynSelect-delete catDelete">X</span>'
-                            + '<input type="hidden" name="category[' + catValue + ']" value="' + catValue + '"></div>');
-                }
-
-                // Reset picklist
-                $('#categorySelect').val('');
-
-            });
-
-            // Action to de-select a category
-            $('.catDelete').live('click', function() {
-                $(this).parent().remove();
-            });
-
-            /*
-             * New Category Dialog
-             */
-             
-            var newCat = 0;    // Used for new category numbering (new cats are negative numbers)
-            
-            // Setup dialog box for adding a new category
-            $("#newCategoryDialog").dialog({
-                autoOpen: false,
-                minWidth: 400,
-                dialogClass: "glm-dialog-no-close"
-            });
-
-            // Ad a new category button action - pop-up dialog
-            $('#newCategoryButton').click( function() {
-                $("#newCategoryDialog").dialog("open");
-            });
-
-            // Submit new category
-             $('#newCategorySubmit').click( function() {
-                
-                // Assign new cat number
-                newCat--;
-                
-                // Get new category information
-                var newCatName = $('#newCatName').val();
-                var newCatParent = $('#newCatParent').val();
-                var catParent = $('#newCatParent').find(':selected').attr('data-parent');
-                var newCatParentName = $('#newCatParentName').val();
-                
-                // If there's no name, tell the user we need one.
-                if (newCatName == '') {
-                    $('#newCatNameTD').addClass('glm-form-bad-input');
-                    $('#newCatNameRequired').text('A catogory name is required!');
-                    return false;
-                }
-                
-                // Check if there's a parent, get the name - new parent name overrides selected parent
-                parentName = '';
-                if (newCatParentName && newCatParentName != '') {
-                    parentName = newCatParentName + ': ';
-                } else if (catParent && catParent != '') {
-                    parentName = catParent + ': ';
-                }
-                
-                // Add the new category to the active categories list
-                $('#activeCategories').append('<div data-id="' + newCat 
-                        + '" class="glm-dynSelect-item glm-members-catgegory">' 
-                        + parentName + newCatName.trim() + ' <span data-id="' + newCat + '" class="glm-dynSelect-delete catDelete">X</span>'
-                        + '<input type="hidden" name="category[' + newCat + ']" value="' + newCat + '">'
-                        + '<input type="hidden" name="newCategory[' + newCat + ']" value="' + newCatName + '">'
-                        + '<input type="hidden" name="newCatParent[' + newCat + ']" value="' + newCatParent + '">'
-                        + '<input type="hidden" name="newCatParentName[' + newCat + ']" value="' + newCatParentName + '">'
-                        + '</div>');
-
-                // Clear the dialog input fields
-                $('#newCatName').val('');
-                $('#newCatParent').val('');  
-                $('#newCatParentName').val('');  
-
-                $("#newCategoryDialog").dialog("close");
-
-            });
-            $('#newCategoryCancel').click( function() {
-                $("#newCategoryDialog").dialog("close");
-            });
-
-            // Setup dialog box for adding a new category
-            $("#newCategoryDialog").dialog({
-                autoOpen: false,
-                minWidth: 400,
-                dialogClass: "glm-dialog-no-close"
-            });
-            
-            /*
-             * New City Dialog
-             */
-
-            // Setup dialog box for adding a new city
-            $("#newCityDialog").dialog({
-                autoOpen: false,
-                minWidth: 400,
-                dialogClass: "glm-dialog-no-close"
-            });
-            $('#newCityCancel').click( function() {
-                $("#newCityDialog").dialog("close");
-            });
-             
-            // Ad a new city button action - pop-up dialog
-            $('#newCityButton').click( function() {
-                $("#newCityDialog").dialog("open");
-            });
-
-            // Submit new city
-            var newCityAdded = false;
-            $('#newCitySubmit').click( function() {
-                
-                // Get new city name
-                var newCityName = $('#newCityName').val();
-
-                // If no name is supplied, notify used it's required
-                if (newCityName == '') {
-                    $('#newCityNameTD').addClass('glm-form-bad-input');
-                    $('#newCityNameRequired').text('A city name is required!');
-                    return false;
-                }
-
-                // Add new city name to the hidden field that will pass the new name to PHP.
-                $('#cityName').val(newCityName);
-                
-                // Add new city name to picklist and for storing - Only one permitted per submission
-                if (newCityAdded) {
-                    
-                    // New city already added, so just update the name and select that one
-                    $('#city').val(-1);
-                    $('#city option:selected').text(newCityName);
-                    
-                } else {
-                    
-                    // Add the new city name to the city picklist
-                    $('#city').append('<option value="-1">' + newCityName + '</option>');
-                    $('#city').val(-1);
-                    $('#newCityNameTD').append('<input type="hidden" name="newCity" value="' + newCityName + '">');
-                    newCityAdded = true;
-
-                }
-      
-                // Clear new city name from form
-                $('#newCityName').val('');
-                
-                $("#newCityDialog").dialog("close");
-
-                glmGeocode();   
-
-            });
-            
-            /*
-             * Map operations
-             */
-  
-           //show error if location can't be found
-           function showError() {
-               alert("Location can't be found");
-           }
-  
-            /*
-             * Google Maps
-             *  API reference: https://developers.google.com/maps/documentation/javascript/reference
-             */
-
-            // Set default - Need to make this configurable
-            var startLat = $('#glmLat').val();
-            var startLon = $('#glmLng').val();
-            var location = new google.maps.LatLng(startLat, startLon);
-            var map;
-            var geocoder;
-            var marker;
-            
-            function initMap() {
-                var map = new google.maps.Map(document.getElementById('locationMap'), {  
-                    zoom: 15,  
-                    disableDefaultUI: false,   
-                    mapTypeId: google.maps.MapTypeId.MAP,  
-                });  
-                var geocoder = new google.maps.Geocoder();
-                var marker = new google.maps.Marker({  
-                    map: map,  
-                    position: location,  
-                    draggable: enableDraggable,
-                    animation: google.maps.Animation.DROP,  
-                    title: "This is your location"  
-                });  
-                map.setCenter(location);
-
-                // Listen for an end of drag event for the map marker            
-                google.maps.event.addListener(marker,'dragend',function(event) {
-                    
-                    // Get the end postion
-                    glmLat = this.position.lat();
-                    glmLng = this.position.lng();
-                    
-                    // Assign it to the hidden fields for submission
-                    $('#glmLat').val(glmLat);
-                    $('#glmLng').val(glmLng);
-                    
-                    // Also display it to the user
-                    $('#mapPosition').html('Lat ' + glmLat.toFixed(4) + ', Lon ' + glmLng.toFixed(4));
-                });
-                
-                // When estimate location button is clicked, geocode using address
-                $('#glm-estimate-location').on('click', function() {
-
-                    // Get all address parts
-                    var geoAddr1 = $('#addr1').val().trim();
-                    var geoAddr2 = $('#addr2').val().trim();
-                    var geoCity = $('#city').find('option:selected').text().trim();
-                    var geoState = $('#state').find('option:selected').text().trim();
-                    var geoZIP = $('#zip').val().trim();
-                    var geoCountry = $('#country').find('option:selected').text().trim();
-                    
-                    // Assemble address string for 
-                    var geoAddress = geoAddr1 + ', ' + geoAddr2 + ', ' + geoCity + ', ' + geoState + ' ' + geoZIP + ', ' + geoCountry;
-                    
-                    // Send to Google Geocoder
-                    geocoder.geocode( { 'address': geoAddress }, function(results, status) {
-
-                        // If we have a geocode solution
-                        if (status == google.maps.GeocoderStatus.OK) {
-
-                            // Center the map and locate the marger to the new location
-                            map.setCenter(results[0].geometry.location);
-                            marker.setPosition( results[0].geometry.location );
-                            
-                            // Assign the new position to the hidden fields for submission
-                            glmLat = results[0].geometry.location.lat();
-                            glmLng = results[0].geometry.location.lng();
-                            $('#glmLat').val(glmLat);
-                            $('#glmLng').val(glmLng);
-
-                            // Also display it to the user
-                            $('#mapPosition').html('Lat ' + glmLat.toFixed(4) + ', Lon ' + glmLng.toFixed(4));
-
-                            // Otherwise tell the user. 
-                        } else {                        
-                            alert('Not able to estimate position from the current address.');
-                        }
-                    });
-
-                });
-
-            }
-
-            // Resubmit geocoding when map location button is clicked
-            function glmGeocode() {
-                
-                // Get all address parts
-                var geoAddr1 = $('#addr1').val().trim();
-                var geoAddr2 = $('#addr2').val().trim();
-                var geoCity = $('#city').find('option:selected').text().trim();
-                var geoState = $('#state').find('option:selected').text().trim();
-                var geoZIP = $('#zip').val().trim();
-                var geoCountry = $('#country').find('option:selected').text().trim();
-                
-                // Assemble address string for 
-                var geoAddress = geoAddr1 + ', ' + geoAddr2 + ', ' + geoCity + ', ' + geoState + ' ' + geoZIP + ', ' + geoCountry;
-                
-                // Send to Google Geocoder
-                geocoder.geocode( { 'address': geoAddress }, function(results, status) {
-
-                    // If we have a geocode solution
-                    if (status == google.maps.GeocoderStatus.OK) {
-
-                        // Center the map and locate the marger to the new location
-                        map.setCenter(results[0].geometry.location);
-                        marker.setPosition( results[0].geometry.location );
-                        
-                        // Assign the new position to the hidden fields for submission
-                        glmLat = results[0].geometry.location.lat();
-                        glmLng = results[0].geometry.location.lng();
-                        $('#glmLat').val(glmLat);
-                        $('#glmLng').val(glmLng);
-
-                        // Also display it to the user
-                        $('#mapPosition').html('Lat ' + glmLat.toFixed(4) + ', Lon ' + glmLng.toFixed(4));
-
-                        // Otherwise tell the user. 
-                    } else {                        
-                        alert('Not able to estimate position from the current address.');
-                    }
-                });
-            }
-
-               $('#showArchived').click( function() {
-                       checked = 'false';
-                       if ($(this).attr('checked') == 'checked') {
-                           checked = 'true';   
-                       }
-                window.location.replace("{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}&showArchived=" + checked);                
-               });
-               
             // Flash certain elements for a short time after display      
             $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
 
-            
             /*
-             * Check for bad input or input changes
+             * Check for input changes
              */
-             
-            // Check for any field errors and if found change related tab to error color.
-            if ($('.glm-form-bad-input-general').length) {
-                $('#glm-member-general').addClass('glm-bad-input-area');
-            }
-            if ($('.glm-form-bad-input-address').length) {
-                $('#glm-member-address').addClass('glm-bad-input-area');
-            }
-            if ($('.glm-form-bad-input-other').length) {
-                $('#glm-member-other').addClass('glm-bad-input-area');
-            }
-            
-            // Check for most input changes
+            var glmSubmitRequired = false;
             $('input, textarea, select').on( 'change', function() {
                 glmPageUpdateRequired();
             }); 
-
+            
             /*
              * Checks for leaving the page
              */
-            var glmSubmitRequired = false;
              
             // Flag submit button when updates are required.
             function glmPageUpdateRequired() {
index 0cae9e1..cd1bea9 100644 (file)
@@ -1,5 +1,9 @@
 {include file='admin/member/header.html'}
 
+
+    <script src="http://maps.googleapis.com/maps/api/js?&key={$settings.google_maps_api_key}"></script>
+    <script type="text/javascript">var enableDraggable = true;</script>
+
     <!--[if lt IE 9]>
       <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
     <![endif]-->
         </table>
             
     <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
-        <a id="glm-member-info-general" data-show-table="glm-table-general" class="glm-member-info-tab nav-tab nav-tab-active">General Information</a>
-        <a id="glm-member-info-gallery" data-show-table="glm-table-gallery" class="glm-member-info-tab nav-tab">Image Gallery</a>
+        <a id="glm-member-info-descr" data-show-table="glm-table-descr" class="glm-member-info-tab nav-tab nav-tab-active">Status & Description</a>
+        <a id="glm-member-info-address" data-show-table="glm-table-address" class="glm-member-info-tab nav-tab">Address & Location</a>
+        <a id="glm-member-info-contact" data-show-table="glm-table-contact" class="glm-member-info-tab nav-tab">Contact Info</a>
+        <a id="glm-member-info-cat" data-show-table="glm-table-cat" class="glm-member-info-tab nav-tab">Categories & Amenities</a>
+        <a id="glm-member-info-images" data-show-table="glm-table-images" class="glm-member-info-tab nav-tab">Images</a>
+        <a id="glm-member-info-ccards" data-show-table="glm-table-ccards" class="glm-member-info-tab nav-tab">Credit Cards</a>
         {if $memberUpdated}<span class="glm-notice glm-flash-updated glm-right">Member Profile Updated</span>{/if}
         {if $memberUpdateError}<span class="glm-error glm-flash-updated glm-right">Member Profile Update Error</span>{/if}
     </h2>
             
-        <table id="glm-table-general" class="glm-admin-table glm-member-info-table">
+        <!-- Profile Status & Description -->
+        
+        <table id="glm-table-descr" class="glm-admin-table glm-member-info-table">
             <tr>
                 <th {if $memberInfo.fieldRequired.reference_name}class="glm-required"{/if}>Profile Name:</th>
-                <td {if $memberInfo.fieldFail.reference_name}class="glm-form-bad-input glm-form-bad-input-general"{/if}>
+                <td {if $memberInfo.fieldFail.reference_name}class="glm-form-bad-input" data-tabid="glm-member-info-descr"{/if}>
                     <input type="text" name="reference_name" value="{$memberInfo.fieldData.reference_name}" class="glm-form-text-input" placeholder="Name of this member profile record for reference only. Not displayed to user.">
                     {if $memberInfo.fieldFail.reference_name}<p>{$memberInfo.fieldFail.reference_name}</p>{/if}<br>
                     The "Profile Name" field is used to help identify this particular member profile. Members may have multiple profiles,
             </tr>
             <tr>
                 <th {if $memberInfo.fieldRequired.descr}class="glm-required"{/if}>Description:</th>
-                <td {if $memberInfo.fieldFail.descr}class="glm-form-bad-input glm-form-bad-input-general"{/if}>
+                <td {if $memberInfo.fieldFail.descr}class="glm-form-bad-input" data-tabid="glm-member-info-descr"{/if}>
                     {php} 
                         wp_editor('{$memberInfo.fieldData.descr|escape:quotes}', 'glm_descr', array(
                             // 'media_buttons' => true,
             </tr>
             <tr>
                 <th {if $memberInfo.fieldRequired.short_descr}class="glm-required"{/if}>Short Description:</th>
-                <td {if $memberInfo.fieldFail.short_descr}class="glm-form-bad-input glm-form-bad-input-general"{/if}>
+                <td {if $memberInfo.fieldFail.short_descr}class="glm-form-bad-input" data-tabid="glm-member-info-descr"{/if}>
                     <input type="text" name="short_descr" value="{$memberInfo.fieldData.short_descr}" class="glm-form-text-input" placeholder="A short, one line, description of the member.">
                     {if $memberInfo.fieldFail.short_descr}<p>{$memberInfo.fieldFail.short_descr}</p>{/if}
                 </td>
             </tr>
+            <tr>
+                <th {if $memberInfo.fieldRequired.notes}class="glm-required"{/if}>Notes:</th>
+            <td
+                {if $memberInfo.fieldFail.notes}class="glm-form-bad-input" data-tabid="glm-member-info-descr"{/if}>
+                <textarea name="notes" class="glm-form-textarea">{$memberInfo.fieldData.notes}</textarea>
+                {if $memberInfo.fieldFail.notes}
+                <p>{$memberInfo.fieldFail.notes}</p>{/if}<br> This
+                "Notes" field is not displayed anywhere else. It is
+                strictly for making and keeping notes related to this
+                member profile.
+            </td>
+        </tr>
+        </table>
+        
+        <!-- **** Address and Location **** -->
+        
+        <table id="glm-table-address" class="glm-admin-table glm-hidden glm-member-info-table">
+            <tr>
+                <th {if $memberInfo.fieldRequired.addr1}class="glm-required"{/if}>Address Line 1:</th>
+                <td {if $memberInfo.fieldFail.addr1}class="glm-form-bad-input" data-tabid="glm-member-info-address"{/if}>
+                    <input type="text" id="addr1" name="addr1" value="{$memberInfo.fieldData.addr1}" class="glm-form-text-input">
+                    {if $memberInfo.fieldFail.addr1}<p>{$memberInfo.fieldFail.addr1}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $memberInfo.fieldRequired.addr2}class="glm-required"{/if}>Address Line 2:</th>
+                <td {if $memberInfo.fieldFail.addr2}class="glm-form-bad-input" data-tabid="glm-member-info-address"{/if}>
+                    <input id="addr2" type="text" name="addr2" value="{$memberInfo.fieldData.addr2}" class="glm-form-text-input">
+                    {if $memberInfo.fieldFail.addr2}<p>{$memberInfo.fieldFail.addr2}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th>City</th>
+                <td class="glm-item-container">
+                    <!--  Add new city dialog -->
+                    <div id="newCityButton" class="button button-secondary glm-right">Add a new City</div>
+                    <div id="newCityDialog" class="glm-dialog-box" title="Enter a New City">
+                        <table class="glm-admin-table">
+                            <tr>
+                                <th class="glm-required">City Name:</th>
+                                <td id="newCityNameTD">
+                                    <input id="newCityName" type="text" name="newCityName" class="glm-form-text-input">
+                                    <div id="newCityNameRequired"></div>
+                                </td>
+                            </tr>
+                        </table>
+                        <p><span class="glm-required">*</span> Required</p>
+                        <a id="newCityCancel" class="button button-primary glm-right">Cancel</a>
+                        <input id="newCitySubmit" type="submit" value="Add new City">
+                    </div>
+                    <!-- City Selection -->
+                    <input id="cityName" type="hidden" name="newCityName" value=""><!-- this field is only used if adding a new city to pass the new name -->
+                    <select name="city" id="city">
+                        <option value="0"></option>
+        {foreach from=$memberInfo.fieldData.city.list item=v}
+                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
+                            {$v.name}
+                        </option>
+        {/foreach}
+                    </select>
+                </td>
+            </tr>
+            <tr>
+                <th {if $memberInfo.fieldRequired.state}class="glm-required"{/if}>State:</th>
+                <td {if $memberInfo.fieldFail.state}class="glm-form-bad-input" data-tabid="glm-member-info-address"{/if}>
+                    <select id="state" name="state">
+        {foreach from=$memberInfo.fieldData.state.list item=v}
+                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
+                            {$v.name}
+                        </option>
+        {/foreach}
+                    </select>
+                    {if $memberInfo.fieldFail.state}<p>{$memberInfo.fieldFail.state}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $memberInfo.fieldRequired.zip}class="glm-required"{/if}>ZIP / Postal Code:</th>
+                <td {if $memberInfo.fieldFail.zip}class="glm-form-bad-input" data-tabid="glm-member-info-address"{/if}>
+                    <input id="zip" type="text" name="zip" value="{$memberInfo.fieldData.zip}" class="glm-form-text-input-short">
+                    {if $memberInfo.fieldFail.zip}<p>{$memberInfo.fieldFail.zip}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $memberInfo.fieldRequired.country}class="glm-required"{/if}>Country:</th>
+                <td {if $memberInfo.fieldFail.country}class="glm-form-bad-input" data-tabid="glm-member-info-address"{/if}>
+                    <select id="country" name="country">
+        {foreach from=$memberInfo.fieldData.country.list item=v}
+                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
+                            {$v.name} {$v.value}
+                        </option>
+        {/foreach}
+                    </select>
+                    {if $memberInfo.fieldFail.country}<p>{$memberInfo.fieldFail.country}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $memberInfo.fieldRequired.region}class="glm-required"{/if}>Region:</th>
+                <td {if $memberInfo.fieldFail.region}class="glm-form-bad-input" data-tabid="glm-member-info-address"{/if}>
+                    <select name="region">
+        {foreach from=$memberInfo.fieldData.region.list item=v}
+                        <option value="{$v.value}"{if $v.default} selected="selected"{/if}>{$v.name}</option>
+        {/foreach}
+                    </select>
+                    {if $memberInfo.fieldFail.region}<p>{$memberInfo.fieldFail.region}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                {if $memberInfo.fieldRequired.lat}<th class="emRequiredInputField">{else}<th>{/if}Location:</th>
+                <td>
+                    <input id="glmLat" name="lat" type="hidden" value="{$memberInfo.fieldData.lat}">
+                    <input id="glmLng" name="lon" type="hidden" value="{$memberInfo.fieldData.lon}">
+                    <div id="glm-estimate-location" class="button button-secondary">Map Location Using Above Address</div>
+                    <p>
+                        MAP USE: Drag the pointer to the desired location for this member.
+                        Use + and - buttons or the mouse wheel to zoom in or out.
+                        Click and drag anywhere else on the map to move to another area.
+                    </p>
+                    <div id="locationMap" class="glm-map-edit">(map loads here)</div>
+                    Selected Position: <span id="mapPosition">Lat {$memberInfo.fieldData.lat}, Lon {$memberInfo.fieldData.lon}</span>
+                </td>
+            </tr>
+        </table>
+
+        <!-- **** Contact Info **** -->
+        
+        <table id="glm-table-contact" class="glm-admin-table glm-hidden glm-member-info-table">
+            <tr>
+                <th {if $memberInfo.fieldRequired.phone}class="glm-required"{/if}>Phone #:</th>
+                <td {if $memberInfo.fieldFail.phone}class="glm-form-bad-input" data-tabid="glm-member-info-contact"{/if}>
+                    <input type="text" name="phone" value="{$memberInfo.fieldData.phone}" class="glm-form-text-input-short" placeholder="ex: 123-456-7890 ext 123">
+                    {if $memberInfo.fieldFail.phone}<p>{$memberInfo.fieldFail.phone}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $memberInfo.fieldRequired.toll_free}class="glm-required"{/if}>Toll Free #:</th>
+                <td {if $memberInfo.fieldFail.toll_free}class="glm-form-bad-input" data-tabid="glm-member-info-contact"{/if}>
+                    <input type="text" name="toll_free" value="{$memberInfo.fieldData.toll_free}" class="glm-form-text-input-short" placeholder="ex: 800-123-4567">
+                    {if $memberInfo.fieldFail.toll_free}<p>{$memberInfo.fieldFail.toll_free}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $memberInfo.fieldRequired.email}class="glm-required"{/if}>E-Mail Address:</th>
+                <td {if $memberInfo.fieldFail.email}class="glm-form-bad-input" data-tabid="glm-member-info-contact"{/if}>
+                    <input type="text" name="email" value="{$memberInfo.fieldData.email}" class="glm-form-text-input-short" placeholder="ex: info@gaslightmedia.com">
+                    {if $memberInfo.fieldFail.email}<p>{$memberInfo.fieldFail.email}</p>{/if}
+                </td>
+            </tr>
+            <tr>
+                <th {if $memberInfo.fieldRequired.url}class="glm-required"{/if}>Web Address (URL):</th>
+                <td {if $memberInfo.fieldFail.url}class="glm-form-bad-input" data-tabid="glm-member-info-contact"{/if}>
+        {if $memberInfo.fieldData.url}
+                    <a class="button button-secondary glm-right" href="{$memberInfo.fieldData.url}" target="urlTarget">Test Link</a>
+        {/if}
+                    <input type="text" name="url" value="{$memberInfo.fieldData.url}" class="glm-form-text-input-medium" placeholder="ex: http://www.gaslightmedia.com">
+                    {if $memberInfo.fieldFail.url}<p>{$memberInfo.fieldFail.url}</p>{/if}
+                </td>
+            </tr>
+        </table>
+
+        <!-- **** Category & Amenities **** -->
+        
+        <table id="glm-table-cat" class="glm-admin-table glm-hidden glm-member-info-table">
+            <tr>
+                <th>Categories</th>
+                <td class="glm-item-container">
+                    <!--  Add new category dialog -->
+                    <div id="newCategoryButton" class="button button-secondary glm-right">Add a new Category</div>
+                    <div id="newCategoryDialog" class="glm-dialog-box" title="Enter a New Category">
+                            <table class="glm-admin-table">
+                                <tr>
+                                    <th class="glm-required">Category Name:</th>
+                                    <td id="newCatNameTD">
+                                        <input id="newCatName" type="text" name="newCatName" class="glm-form-text-input">
+                                        <div id="newCatNameRequired"></div>
+                                    </td>
+                                </tr>
+                                <tr>
+                                    <th>Parent Category:</th>
+                                    <td>
+                                        <select id="newCatParent" name="newCatParent">
+                            {if $availableCategories}
+                                            <option value=""></option>
+                                {foreach $availableCategories as $t}
+                                    {if !$t.parent.value} <!-- don't show child categories -->
+                                            <option value="{$t.id}" data-parent="{$t.name}">{$t.name}</option>
+                                    {/if}
+                                {/foreach}
+                            {/if}
+                                        </select>
+                                        <br>OR<br>
+                                        <input id="newCatParentName" type="text" name="newCatParentName" placeholder="Enter a new parent name."> 
+                                    </td>
+                                </tr>
+                            </table>
+                            <p><span class="glm-required">*</span> Required</p>
+                            <a id="newCategoryCancel" class="button button-primary glm-right">Cancel</a>
+                            <input id="newCategorySubmit" type="submit" value="Add new Category">
+                    </div>
+                    <!-- Category Selection -->
+                    <select name="categorySelect" id="categorySelect">
+        {if $availableCategories}
+                        <option id="categoryNone" value=""></option>
+            {foreach from=$availableCategories item=v}
+                        <option value="{$v.id}" data-parent="{$v.parent.name}">
+                            {if $v.parent.value}&nbsp;&nbsp;&nbsp;&nbsp;{/if}{$v.name}
+                        </option>
+            {/foreach}
+        {else}
+                        <option id="" value="">(No Categories Listed - Select "Add a new Category" to the right. )</option>  
+        {/if}
+                    </select>&nbsp;&nbsp; Select a category to add to box below.<br>
+                    <div id="activeCategories" class="glm-dynSelect-box">
+                    
+        {if isset($memberInfo.fieldData.categories) && $memberInfo.fieldData.categories}
+            {foreach from=$memberInfo.fieldData.categories item=c}
+                        <div data-id="{$c.id}" class="glm-dynSelect-item glm-members-catgegory"> 
+                            {if $c.parent_name != ''}{$c.parent_name}: {/if}{$c.name} 
+                            <span data-id="{$c.id}" class="glm-dynSelect-delete catDelete">X</span>
+                            <input type="hidden" name="category[{$c.id}]" value="{$c.id}">
+                       </div>                    
+            {/foreach}
+        {/if}                    
+                    </div>
+                </td>
+            </tr>
             <tr>
                 <th>Amenities</th>
                 <td class="glm-item-container">
                     </div>
                 </td>
             </tr>
+        </table>
+
+        
+        <!-- **** Images **** -->
+         
+        <table id="glm-table-images" class="glm-admin-table glm-hidden glm-member-info-table">
             <tr>
-                <th {if $memberInfo.fieldRequired.notes}class="glm-required"{/if}>Notes:</th>
-                <td {if $memberInfo.fieldFail.notes}class="glm-form-bad-input glm-form-bad-input-general"{/if}>
-                    <textarea name="notes" class="glm-form-textarea">{$memberInfo.fieldData.notes}</textarea>
-                    {if $memberInfo.fieldFail.notes}<p>{$memberInfo.fieldFail.notes}</p>{/if}<br>
-                    This "Notes" field is not displayed anywhere else. It is strictly for making and keeping
-                    notes related to this member profile. 
+                <th {if $memberInfo.fieldRequired.logo}class="glm-required"{/if}>Logo:</th>
+                <td {if $memberInfo.fieldFail.logo}class="glm-form-bad-input" data-tabid="glm-member-info-images"{/if}>
+                    <table class="glm-admin-image-edit-table">
+        {if $memberInfo.fieldData.logo}
+                        <tr>
+                            <td>
+                                <div class="glm-galleryImage" data-id="logo">
+                                    <img src="{$glmPluginMediaURL}/images/small/{$memberInfo.fieldData.logo}">
+                                </div>
+                            </td>
+                            <td>
+                                <input type="checkbox" name="logo_delete"> Delete Image<br>
+                                {$memberInfo.fieldData.logo}<br>
+                            </td>
+                        </tr>
+        {/if}
+                        <tr><td colspan="2"><b>New image:</b> <input type="file" name="logo_new"></td></tr>
+                    </table>
+                    <div id="glm-galleryImageLarger_logo" class="glm-imageDialog"><img src="{$glmPluginMediaURL}/images/large/{$memberInfo.fieldData.logo}"></div>
+                    {if $memberInfo.fieldFail.logo}<p>{$memberInfo.fieldFail.logo}</p>{/if}
                 </td>
             </tr>
-        </table>
-        <table id="glm-table-gallery" class="glm-admin-table glm-hidden glm-member-info-table">
             <tr>
                 <th>Image Gallery</th>
                 <td class="glm-item-container glm-imageGalleryContainer">
                 </td>
             </tr>
         </table>
+        
+        <!-- **** Credit Cards **** -->
+        
+        <table id="glm-table-ccards" class="glm-admin-table glm-hidden glm-member-info-table">
+            <tr>
+                <th {if $memberInfo.fieldRequired.cc_type}class="glm-required"{/if}>Credit Cards Accepted:</th>
+                <td {if $memberInfo.fieldFail.cc_type}class="glm-form-bad-input" data-tabid="glm-member-info-ccards"{/if}>
+        {foreach from=$memberInfo.fieldData.cc_type.bitmap item=v}
+                    <input type="checkbox" name="cc_type[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}<br>
+        {/foreach}                    
+                    {if $memberInfo.fieldFail.cc_type}<p>{$memberInfo.fieldFail.cc_type}</p>{/if}
+                </td>
+            </tr>
+        </table>
+        
         <p><span class="glm-required">*</span> Required</p>
         <input id="updateMemberProfile" type="submit" value="{if $memberInfoID && $memberInfo}Update member profile{else}Add new member profile{/if}">
 
                 var table = $(this).attr('data-show-table');
                 $('#' + table).removeClass('glm-hidden');
                 
+                
+                if (table == 'glm-table-address') {
+                    initMap();
+                }
+                
             });
             
             /*
                window.location.replace("{$thisURL}?page={$thisPage}&glm_action=index&member={$memberID}&deleteID={$memberInfo.fieldData.id}");
             });
     {/if}        
+            /*
+             * Category Selection
+             */
+             
+            // Action to select a category
+            $('#categorySelect').change( function() {
+                
+                // Get the ID, name, and parent of the category
+                var catValue = $('#categorySelect').val();       
+                var catName = $('#categorySelect').find(':selected').text();
+                var catParent = $('#categorySelect').find(':selected').attr('data-parent');
+                
+                // Check if the category has already been added
+                var found = false;              
+                $(".glm-members-catgegory").each( function() {
+                    var id = $(this).attr('data-id');
+                    if (id == catValue) {
+                        found = true;
+                    }
+                });
+    
+                // Check if there's a parent
+                parentName = '';
+                if (catParent != '') {
+                    parentName = catParent + ': ';
+                }
+                
+                // If not found, Add the category
+                if (!found) {
+                    $('#activeCategories').append('<div data-id="' + catValue 
+                            + '" class="glm-dynSelect-item glm-members-catgegory">' 
+                            + parentName + catName.trim() + ' <span class="glm-dynSelect-delete catDelete">X</span>'
+                            + '<input type="hidden" name="category[' + catValue + ']" value="' + catValue + '"></div>');
+                }
+    
+                // Reset picklist
+                $('#categorySelect').val('');
+    
+            });
+    
+            // Action to de-select a category
+            $('.catDelete').live('click', function() {
+                $(this).parent().remove();
+            });
+    
+            /*
+             * New Category Dialog
+             */
+             
+            var newCat = 0;    // Used for new category numbering (new cats are negative numbers)
+            
+            // Setup dialog box for adding a new category
+            $("#newCategoryDialog").dialog({
+                autoOpen: false,
+                minWidth: 400,
+                dialogClass: "glm-dialog-no-close"
+            });
+    
+            // Ad a new category button action - pop-up dialog
+            $('#newCategoryButton').click( function() {
+                $("#newCategoryDialog").dialog("open");
+            });
+    
+            // Submit new category
+             $('#newCategorySubmit').click( function() {
+                
+                // Assign new cat number
+                newCat--;
+                
+                // Get new category information
+                var newCatName = $('#newCatName').val();
+                var newCatParent = $('#newCatParent').val();
+                var catParent = $('#newCatParent').find(':selected').attr('data-parent');
+                var newCatParentName = $('#newCatParentName').val();
+                
+                // If there's no name, tell the user we need one.
+                if (newCatName == '') {
+                    $('#newCatNameTD').addClass('glm-form-bad-input');
+                    $('#newCatNameRequired').text('A catogory name is required!');
+                    return false;
+                }
+                
+                // Check if there's a parent, get the name - new parent name overrides selected parent
+                parentName = '';
+                if (newCatParentName && newCatParentName != '') {
+                    parentName = newCatParentName + ': ';
+                } else if (catParent && catParent != '') {
+                    parentName = catParent + ': ';
+                }
+                
+                // Add the new category to the active categories list
+                $('#activeCategories').append('<div data-id="' + newCat 
+                        + '" class="glm-dynSelect-item glm-members-catgegory">' 
+                        + parentName + newCatName.trim() + ' <span data-id="' + newCat + '" class="glm-dynSelect-delete catDelete">X</span>'
+                        + '<input type="hidden" name="category[' + newCat + ']" value="' + newCat + '">'
+                        + '<input type="hidden" name="newCategory[' + newCat + ']" value="' + newCatName + '">'
+                        + '<input type="hidden" name="newCatParent[' + newCat + ']" value="' + newCatParent + '">'
+                        + '<input type="hidden" name="newCatParentName[' + newCat + ']" value="' + newCatParentName + '">'
+                        + '</div>');
+    
+                // Clear the dialog input fields
+                $('#newCatName').val('');
+                $('#newCatParent').val('');  
+                $('#newCatParentName').val('');  
+    
+                $("#newCategoryDialog").dialog("close");
+    
+            });
+            $('#newCategoryCancel').click( function() {
+                $("#newCategoryDialog").dialog("close");
+            });
+    
+            // Setup dialog box for adding a new category
+            $("#newCategoryDialog").dialog({
+                autoOpen: false,
+                minWidth: 400,
+                dialogClass: "glm-dialog-no-close"
+            });
             
+            /*
+             * New City Dialog
+             */
+    
+            // Setup dialog box for adding a new city
+            $("#newCityDialog").dialog({
+                autoOpen: false,
+                minWidth: 400,
+                dialogClass: "glm-dialog-no-close"
+            });
+            $('#newCityCancel').click( function() {
+                $("#newCityDialog").dialog("close");
+            });
+             
+            // Ad a new city button action - pop-up dialog
+            $('#newCityButton').click( function() {
+                $("#newCityDialog").dialog("open");
+            });
+    
+            // Submit new city
+            var newCityAdded = false;
+            $('#newCitySubmit').click( function() {
+                
+                // Get new city name
+                var newCityName = $('#newCityName').val();
+    
+                // If no name is supplied, notify used it's required
+                if (newCityName == '') {
+                    $('#newCityNameTD').addClass('glm-form-bad-input');
+                    $('#newCityNameRequired').text('A city name is required!');
+                    return false;
+                }
+    
+                // Add new city name to the hidden field that will pass the new name to PHP.
+                $('#cityName').val(newCityName);
+                
+                // Add new city name to picklist and for storing - Only one permitted per submission
+                if (newCityAdded) {
+                    
+                    // New city already added, so just update the name and select that one
+                    $('#city').val(-1);
+                    $('#city option:selected').text(newCityName);
+                    
+                } else {
+                    
+                    // Add the new city name to the city picklist
+                    $('#city').append('<option value="-1">' + newCityName + '</option>');
+                    $('#city').val(-1);
+                    $('#newCityNameTD').append('<input type="hidden" name="newCity" value="' + newCityName + '">');
+                    newCityAdded = true;
+    
+                }
+      
+                // Clear new city name from form
+                $('#newCityName').val('');
+                
+                $("#newCityDialog").dialog("close");
+    
+                glmGeocode();   
+    
+            });
+            
+            /*
+             * Map operations
+             */
+    
+           //show error if location can't be found
+           function showError() {
+               alert("Location can't be found");
+           }
+    
+            /*
+             * Google Maps
+             *  API reference: https://developers.google.com/maps/documentation/javascript/reference
+             */
+    
+            // Set default - Need to make this configurable
+            var startLat = $('#glmLat').val();
+            var startLon = $('#glmLng').val();
+            var location = new google.maps.LatLng(startLat, startLon);
+            var map;
+            var geocoder;
+            var marker;
+
+            function initMap() {
+                var map = new google.maps.Map(document.getElementById('locationMap'), {  
+                    zoom: 15,  
+                    disableDefaultUI: false,   
+                    mapTypeId: google.maps.MapTypeId.MAP,  
+                });  
+                var geocoder = new google.maps.Geocoder();
+                var marker = new google.maps.Marker({  
+                    map: map,  
+                    position: location,  
+                    draggable: enableDraggable,
+                    animation: google.maps.Animation.DROP,  
+                    title: "This is your location"  
+                });  
+                map.setCenter(location);
+    
+                // Listen for an end of drag event for the map marker            
+                google.maps.event.addListener(marker,'dragend',function(event) {
+                    
+                    // Get the end postion
+                    glmLat = this.position.lat();
+                    glmLng = this.position.lng();
+                    
+                    // Assign it to the hidden fields for submission
+                    $('#glmLat').val(glmLat);
+                    $('#glmLng').val(glmLng);
+                    
+                    // Also display it to the user
+                    $('#mapPosition').html('Lat ' + glmLat.toFixed(4) + ', Lon ' + glmLng.toFixed(4));
+                });
+                
+                // When estimate location button is clicked, geocode using address
+                $('#glm-estimate-location').on('click', function() {
+    
+                    // Get all address parts
+                    var geoAddr1 = $('#addr1').val().trim();
+                    var geoAddr2 = $('#addr2').val().trim();
+                    var geoCity = $('#city').find('option:selected').text().trim();
+                    var geoState = $('#state').find('option:selected').text().trim();
+                    var geoZIP = $('#zip').val().trim();
+                    var geoCountry = $('#country').find('option:selected').text().trim();
+                    
+                    // Assemble address string for 
+                    var geoAddress = geoAddr1 + ', ' + geoAddr2 + ', ' + geoCity + ', ' + geoState + ' ' + geoZIP + ', ' + geoCountry;
+                    
+                    // Send to Google Geocoder
+                    geocoder.geocode( { 'address': geoAddress }, function(results, status) {
+    
+                        // If we have a geocode solution
+                        if (status == google.maps.GeocoderStatus.OK) {
+    
+                            // Center the map and locate the marger to the new location
+                            map.setCenter(results[0].geometry.location);
+                            marker.setPosition( results[0].geometry.location );
+                            
+                            // Assign the new position to the hidden fields for submission
+                            glmLat = results[0].geometry.location.lat();
+                            glmLng = results[0].geometry.location.lng();
+                            $('#glmLat').val(glmLat);
+                            $('#glmLng').val(glmLng);
+    
+                            // Also display it to the user
+                            $('#mapPosition').html('Lat ' + glmLat.toFixed(4) + ', Lon ' + glmLng.toFixed(4));
+    
+                            // Otherwise tell the user. 
+                        } else {                        
+                            alert('Not able to estimate position from the current address.');
+                        }
+                    });
+    
+                });
+    
+            }
+    
+            // Resubmit geocoding when map location button is clicked
+            function glmGeocode() {
+                
+                // Get all address parts
+                var geoAddr1 = $('#addr1').val().trim();
+                var geoAddr2 = $('#addr2').val().trim();
+                var geoCity = $('#city').find('option:selected').text().trim();
+                var geoState = $('#state').find('option:selected').text().trim();
+                var geoZIP = $('#zip').val().trim();
+                var geoCountry = $('#country').find('option:selected').text().trim();
+                
+                // Assemble address string for 
+                var geoAddress = geoAddr1 + ', ' + geoAddr2 + ', ' + geoCity + ', ' + geoState + ' ' + geoZIP + ', ' + geoCountry;
+                
+                // Send to Google Geocoder
+                geocoder.geocode( { 'address': geoAddress }, function(results, status) {
+    
+                    // If we have a geocode solution
+                    if (status == google.maps.GeocoderStatus.OK) {
+    
+                        // Center the map and locate the marger to the new location
+                        map.setCenter(results[0].geometry.location);
+                        marker.setPosition( results[0].geometry.location );
+                        
+                        // Assign the new position to the hidden fields for submission
+                        glmLat = results[0].geometry.location.lat();
+                        glmLng = results[0].geometry.location.lng();
+                        $('#glmLat').val(glmLat);
+                        $('#glmLng').val(glmLng);
+    
+                        // Also display it to the user
+                        $('#mapPosition').html('Lat ' + glmLat.toFixed(4) + ', Lon ' + glmLng.toFixed(4));
+    
+                        // Otherwise tell the user. 
+                    } else {                        
+                        alert('Not able to estimate position from the current address.');
+                    }
+                });
+            }
+
             // 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);
            
              */
              
             // Check for any field errors and if found change related tab to error color.
-            if ($('.glm-form-bad-input-general').length) {
-                $('#glm-member-info-general').addClass('glm-bad-input-area');
-            }
+
+            $('.glm-form-bad-input').each( function(index) {
+
+                tab = $(this).attr('data-tabid');
+                
+                if (!$('#' + tab).hasClass('glm-bad-input-area')) {
+                    $('#' + tab).addClass('glm-bad-input-area');
+                }
+            });
             
             // Check for most input changes
             $('input, textarea, select').on( 'change', function() {
index 60eedf0..bd6cf74 100644 (file)
                  select: function( event, ui ) {
                      var memberID = ui.item.id;
                      window.location.replace("{$adminURL}?page=glm-members-admin-menu-member&glm_action=index&member=" + memberID );
+                 },
+                 response: function(event, ui) {
+                     if (!ui.content.length) {
+                         var noResult = { value:"",label:"No results found" };
+                         ui.content.push(noResult);
+                     }
                  }
              });
                              
index fbecd96..e8b5222 100644 (file)
@@ -1,6 +1,6 @@
 {include file='admin/members/header.html'}
     
-    <form class="glm-right" onSubmit="return false;">
+    <form id="searchForm" 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;
        <input type="checkbox" id="filterPending" class="listFilter"{if $filterPending} checked{/if}>Pending Only&nbsp;&nbsp;
                  select: function( event, ui ) {
                      var memberID = ui.item.id;
                      window.location.replace("{$adminURL}?page=glm-members-admin-menu-member&glm_action=index&member=" + memberID );
+                 },
+                 response: function(event, ui) {
+                     if (!ui.content.length) {
+                         var noResult = { value:"",label:"No results found" };
+                         ui.content.push(noResult);
+                     }
                  }
              });
 
+             
+             
         });
     </script>
             
index ce3a205..75ce31a 100644 (file)
@@ -1,10 +1,4 @@
 
     </div> <!-- / admin content area -->
-          
-  {if $frontDebug}
-    <script>
-        window.open('{$thisURL}?glmDebugWindow=true','GLM_Plugin_Debug','width=800,height=800,left=50,top=50,resizable=yes,scrollbars=yes');
-    </script>
-  {/if}
   
 </div> <!-- / wrap -->
\ No newline at end of file