Saving files before switching to do a separate hotfix
authorChuck Scott <cscott@gaslightmedia.com>
Mon, 4 Jan 2016 19:13:28 +0000 (14:13 -0500)
committerChuck Scott <cscott@gaslightmedia.com>
Mon, 4 Jan 2016 19:13:28 +0000 (14:13 -0500)
17 files changed:
classes/data/dataManagement.php [new file with mode: 0644]
classes/data/dataPackages.php
glm-member-db-packaging.php
misc/documentation/AddAnAdminTab.txt [new file with mode: 0644]
models/admin/management/packaging.php [new file with mode: 0644]
models/admin/member/packaging.php
models/admin/members/packaging.php
setup/adminTabs.php
setup/databaseScripts/create_database_V1.1.0.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php
setup/databaseScripts/update_database_V1.1.0.php [new file with mode: 0644]
setup/databaseScripts/update_database_V1.1.0.sql [new file with mode: 0644]
setup/validActions.php
views/admin/management/packaging.html [new file with mode: 0644]
views/admin/member/packaging.html
views/admin/members/packaging.html
views/front/packaging/list.html

diff --git a/classes/data/dataManagement.php b/classes/data/dataManagement.php
new file mode 100644 (file)
index 0000000..bcfc301
--- /dev/null
@@ -0,0 +1,133 @@
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Packaging Management data class
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package  GLM Member-DB
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  SVN: $Id: dataPackagingManagement.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * GlmDataManagementPackaging class
+ *
+ * PHP version 5
+ *
+ * @category Data
+ * @package GLM Member DB
+ * @author  Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ *          @release SVN: $Id: dataPackagingManagement.php,v 1.0 2011/01/25 19:31:47 cscott
+ *          Exp $
+ */
+class GlmDataPackagingManagement extends GlmDataAbstract
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Data Table Name
+     *
+     * @var $table
+     * @access public
+     */
+    public $table;
+    /**
+     * Field definitions
+     *
+     * 'type' is type of field as defined by the application
+     * text Regular text field
+     * pointer Pointer to an entry in another table
+     * 'filters' is the filter name for a particular filter ID in PHP filter
+     * functions
+     * See PHP filter_id()
+     *
+     * 'use' is when to use the field
+     * l = List
+     * g = Get
+     * n = New
+     * i = Insert
+     * e = Edit
+     * u = Update
+     * d = Delete
+     * a = All
+     *
+     * @var $ini
+     * @access public
+     */
+    public $fields = false;
+
+    /**
+     * Constructor
+     *
+     * @param object $d database connection
+     * @param array $config Configuration array
+     * @param bool $limitedEdit Flag to say indicate limited edit requested
+     *
+     * @return void
+     * @access public
+     */
+    public function __construct($wpdb, $config, $limitedEdit = false)
+    {
+
+        // If this class is not being extended along with existing $wpdb and $config
+        if (!$this->wpdb) {
+
+            // Save WordPress Database object
+            $this->wpdb = $wpdb;
+
+            // Save plugin configuration object
+            $this->config = $config;
+
+        }
+
+        /*
+         * Table Name
+         */
+        $this->table = GLM_MEMBERS_PACKAGING_PLUGIN_DB_PREFIX . 'management';
+
+        /*
+         * Table Data Fields
+         */
+
+        $this->fields = array (
+
+            'id' => array (
+                'field' => 'id',
+                'type' => 'integer',
+                'view_only' => true,
+                'use' => 'a'
+            ),
+
+            // Canonical Page Slug
+            'canonical_package_page' => array (
+                'field' => 'canonical_package_page',
+                'type' => 'text',
+                'required' => true,
+                'use' => 'a'
+            )
+
+        );
+
+    }
+
+
+}
+
+?>
\ No newline at end of file
index 6328ebc..f366f59 100644 (file)
@@ -141,6 +141,14 @@ class GlmDataPackages extends GlmDataAbstract
                 'use' => 'a'
             ),
 
+            // Package Slug
+            'package_slug' => array (
+                'field' => 'package_slug',
+                'type' => 'text',
+                'required' => true,
+                'use' => 'gle'
+            ),
+
             // Description
             'descr' => array (
                 'field' => 'descr',
@@ -231,7 +239,6 @@ class GlmDataPackages extends GlmDataAbstract
                 'type' => 'pointer',
                     'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX . 'members',
                     'p_field' => 'name',
-                    'p_orderby' => 'name',
                     'p_blank' => true,
                 'required' => true,
                 'use' => 'lged'
@@ -280,6 +287,36 @@ class GlmDataPackages extends GlmDataAbstract
         return $r;
     }
 
+    /*
+     * Update package slug - should be called after a package record is added or updated
+     *
+     * @param integer id ID of package that needs the slug updated
+     * @access public
+     */
+    public function updateSlug($id = false)
+    {
+
+        if ($id == false) {
+            return false;
+        }
+
+        $p = $this->getEntry($id);
+
+        $slug = sanitize_title($p['title']);
+
+        // Update the slug
+        $sql = "
+         UPDATE ".GLM_MEMBERS_PACKAGING_PLUGIN_DB_PREFIX."packages
+                 SET package_slug = '$slug'
+                 WHERE id = $id
+             ;";
+        $this->wpdb->query($sql);
+
+        return $slug;
+
+    }
+
+
 }
 
 ?>
\ No newline at end of file
index 373f60a..8581a40 100644 (file)
@@ -34,7 +34,7 @@
  *  version nunmber of that release for the DB version.
  */
 define('GLM_MEMBERS_PACKAGING_PLUGIN_VERSION', '1.0.5');
-define('GLM_MEMBERS_PACKAGING_PLUGIN_DB_VERSION', '0.0.2');
+define('GLM_MEMBERS_PACKAGING_PLUGIN_DB_VERSION', '1.1.0');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
 define('GLM_MEMBERS_PACKAGING_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.48');
@@ -130,6 +130,10 @@ require_once(GLM_MEMBERS_PACKAGING_PLUGIN_SETUP_PATH.'/validActions.php');
 require_once(GLM_MEMBERS_PACKAGING_PLUGIN_SETUP_PATH.'/shortcodes.php');
 require_once(GLM_MEMBERS_PACKAGING_PLUGIN_DB_SCRIPTS.'/dbVersions.php');
 
+// Load Packaging Management Settings data
+$packagingManagementSettings = $wpdb->get_row( "SELECT * FROM ".GLM_MEMBERS_PACKAGING_PLUGIN_DB_PREFIX."management WHERE id = 1", ARRAY_A );
+unset($packagingManagementSettings['id']);
+
 function glmMembersRegisterPackaging($addOns) {
 
     // Add this add-on to the add-ons array
@@ -139,6 +143,9 @@ function glmMembersRegisterPackaging($addOns) {
             'short_name' => GLM_MEMBERS_PACKAGING_PLUGIN_SHORT_NAME,
             'slug' => GLM_MEMBERS_PACKAGING_PLUGIN_SLUG,
             'actions' => $GLOBALS['glmMembersPackagingAddOnValidActions'],
+            'config' => array(
+                'settings' => $GLOBALS['packagingManagementSettings']
+            ),
             'shortcodes' => $GLOBALS['glmMembersPackagingShortcodes'],
             'shortcodesDescription' => $GLOBALS['glmMembersPackagingShortcodesDescription'],
             'database' => array(
diff --git a/misc/documentation/AddAnAdminTab.txt b/misc/documentation/AddAnAdminTab.txt
new file mode 100644 (file)
index 0000000..c697b47
--- /dev/null
@@ -0,0 +1,15 @@
+Add an admin tab
+
+* Add a new section in setup/adminTabs.php
+
+* Add a model file - models/admin/{menu}/{action}.php
+
+* Add a view file - views/admin/{menu}/{action}.html
+
+* Add action to setup/validActions.php
+
+* If needed add a database table to the create_database_V...sql file
+  and update name to current database version, add an
+  update_database_V....sql file, and/or update dbVersions.php
+
+* If required add a data definition for any new tables
diff --git a/models/admin/management/packaging.php b/models/admin/management/packaging.php
new file mode 100644 (file)
index 0000000..a0c454d
--- /dev/null
@@ -0,0 +1,158 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Packaging Add-on - Management Package Tab
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  packaging.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Load Management Packaging data abstract
+require_once(GLM_MEMBERS_PACKAGING_PLUGIN_CLASS_PATH.'/data/dataManagement.php');
+
+/**
+ * GlmMembersAdmin_management_packaging
+ *
+ * PHP version 5
+ *
+ * @category Model
+ * @package GLM Member DB
+ * @author  Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ *          @release SVN: $Id: packaging.php,v 1.0 2011/01/25 19:31:47 cscott
+ *          Exp $
+ */
+class GlmMembersAdmin_management_packaging extends GlmDataPackagingManagement
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+
+    /*
+     * Constructor
+     *
+     * This contructor performs the work for this model. This model returns
+     * an array containing the following.
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * 'view'
+     *
+     * A suggested view name that the contoller should use instead of the
+     * default view for this model or false to indicate that the default view
+     * should be used.
+     *
+     * 'data'
+     *
+     * Data that the model is returning for use in merging with the view to
+     * produce output.
+     *
+     * @wpdb object WordPress database object
+     *
+     * @return array Array containing status, suggested view, and any data
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        // Run constructor for members data class
+        parent::__construct(false, false);
+
+     }
+
+    public function modelAction($actionData = false)
+    {
+        $settingsUpdated = false;
+
+        // Determine if current user can edit configurations
+        if (!current_user_can('glm_members_configure')) {
+            return array(
+                    'status' => false,
+                    'menuItemRedirect' => 'error',
+                    'modelRedirect' => 'index',
+                    'view' => 'admin/error/index.html',
+                    'data' => array(
+                            'reason' => 'User does not have rights to make configuration changes.'
+                    )
+            );
+        }
+
+        // Check for submission option
+        $option = '';
+        if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
+            $option = $_REQUEST['option'];
+        }
+
+        switch($option) {
+
+            // Update the settings and redisplay the form
+            case 'submit':
+
+                // Update the package management settings
+                $packageSettings = $this->updateEntry(1);
+                if ($packageSettings['status']) {
+                    $settingsUpdated = true;
+                }
+
+                // Display admin message that the data has been updated
+                glmMembersAdmin::addNotice('Packaging Settings for the '.GLM_MEMBERS_PACKAGING_PLUGIN_NAME.' plugin have been updated.', 'AdminNotice');
+
+                break;
+
+            // Default is to get the current settings and display the form
+            default:
+
+                // Try to get the first (should be only) entry for general settings.
+                $packageSettings = $this->editEntry(1);
+
+                if ($packageSettings === false) {
+
+                    if (GLM_MEMBERS_PLUGIN_ADMIN_DEBUG) {
+                        glmMembersAdmin::addNotice("<b>&nbsp;&nbsp;/models/admin/management/packaging.php: Unable to load packaging management settings.", 'Alert');
+                    }
+
+                }
+
+                break;
+
+        }
+
+        // Compile template data
+        $templateData = array(
+            'reason' => '',
+            'packagingSettings' => $packageSettings,
+            'settingsUpdated' => $settingsUpdated
+        );
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status' => true,
+            'menuItemRedirect' => false,
+            'modelRedirect' => false,
+            'view' => 'admin/management/packaging.html',
+            'data' => $templateData
+        );
+
+
+    }
+}
+
+?>
\ No newline at end of file
index a0c7ee2..6ceb1cd 100644 (file)
@@ -170,6 +170,9 @@ class GlmMembersAdmin_member_packaging extends GlmDataPackages
                 // If the package inserted successfully
                 if ($packageInfo && $packageInfo['status']) {
 
+                    // Update the package title slug
+                    $this->updateSlug($packageInfo['fieldData']['id']);
+
                     // Get the new package ID
                     $packageID = $packageInfo['fieldData']['id'];
 
@@ -213,8 +216,11 @@ class GlmMembersAdmin_member_packaging extends GlmDataPackages
                 // If it updated successfully
                 if ($packageInfo && $packageInfo['status']) {
 
+                    // Update the package title slug
+                    $this->updateSlug($packageID);
+
                     // Get the package data again prepared for editing
-                    $packages = $this->editEntry($packageID);
+                    $packageInfo = $this->editEntry($packageID);
 
                     // Tell the template the package was updated
                     $packageUpdated = true;
index 7ca37d9..d49f66a 100644 (file)
@@ -217,7 +217,8 @@ class GlmMembersAdmin_members_packaging extends GlmDataPackages
             default:
 
                 // Get the list of packages
-                $packages = $this->getList("T.ref_type = 0");
+//                $packages = $this->getList("T.ref_type = 0");
+                $packages = $this->getList();
 
                 // If we have some, tell the template
                 if ($packages && count($packages) > 0) {
index d0bb894..3c3a3b5 100644 (file)
@@ -65,4 +65,21 @@ if (apply_filters('glm_members_permit_admin_members_packages_tab', true)) {
     );
 }
 
+if (apply_filters('glm_members_permit_admin_members_packages_tab', true)) {
+    add_filter('glm-member-db-add-tab-for-management',
+        function($addOnTabs) {
+            $newTabs = array(
+                array(
+                    'text' => 'Packaging',
+                    'menu' => 'management',
+                    'action' => 'packaging'
+                )
+            );
+            $addOnTabs = array_merge($addOnTabs, $newTabs);
+            return $addOnTabs;
+        }
+    );
+}
+
+
 ?>
\ No newline at end of file
diff --git a/setup/databaseScripts/create_database_V1.1.0.sql b/setup/databaseScripts/create_database_V1.1.0.sql
new file mode 100644 (file)
index 0000000..cf097c3
--- /dev/null
@@ -0,0 +1,70 @@
+-- Gaslight Media Members Database - Packaging 
+-- File Created: 12/02/15 15:27:15
+-- Database Version: 0.0.2
+-- Database Creation Script
+-- 
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+-- Packages 
+CREATE TABLE {prefix}packages (
+  id INT NOT NULL AUTO_INCREMENT,
+  active BOOLEAN NULL,                      -- Package is active
+  title TINYTEXT NULL,                      -- Title of package
+  package_slug TINYTEXT NULL,               -- Package name slug for canonical URLs (lowercase, "-" for spaces, no punctuation)
+  descr TEXT NULL,                          -- Description of package
+  short_descr TINYTEXT NULL,                -- Short description of package
+  image TINYTEXT NULL,                      -- Package image
+  start_date TIMESTAMP NULL,                -- Date display of this package starts
+  end_date TIMESTAMP NULL,                  -- Date display of this package ends (last date of display)
+  expire_date TIMESTAMP NULL,               -- Date package expires (first date it's expired)
+  position INT NULL,                        -- Display order position
+  pricing TINYTEXT NULL,                    -- Pricing, descriptive
+  ref_type INT NULL,                        -- Type of entity this package is associated with
+  ref_dest INT NULL,                        -- Pointer to the specific entity
+  PRIMARY KEY (id),                         
+  INDEX(ref_type),
+  INDEX(ref_dest),
+  INDEX(start_date),
+  INDEX(end_date),
+  INDEX(expire_date)
+);
+
+----
+
+-- Package Elements - Items in a package
+CREATE TABLE {prefix}package_elements (
+  id INT NOT NULL AUTO_INCREMENT,
+  package INT NULL,                         -- Pointer to the package
+  active BOOLEAN NULL,                      -- Package is active
+  title TINYTEXT NULL,                      -- Title of element
+  descr TEXT NULL,                          -- Description for this entity's participation in the package
+  short_descr TEXT NULL,                    -- Short description for this entity's participation in the package
+  image TINYTEXT NULL,                      -- Element image
+  position INT NULL,                        -- Display order position
+  ref_type INT NULL,                        -- Type of entity this element is association with
+  ref_dest INT NULL,                        -- Pointer to the specific entity
+  PRIMARY KEY (id),
+  INDEX(package),
+  INDEX(ref_type),
+  INDEX(ref_dest)
+);
+
+----
+
+-- Package Management Settings
+CREATE TABLE {prefix}management (
+  id INT NOT NULL AUTO_INCREMENT,
+  canonical_package_page TINYTEXT NULL,          -- Canonical page slug for package detail
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Set default package management entry
+INSERT INTO {prefix}management
+    ( id, canonical_package_page )
+   VALUES
+    ( 1, 'package-detail' )
+;
+
index 5451371..6a74c96 100644 (file)
@@ -14,6 +14,7 @@
  */
 
 $glmMembersPackagingDbVersions = array(
-            '0.0.2' => array('version' => '0.0.2', 'tables' => 2)
+            '0.0.2' => array('version' => '0.0.2', 'tables' => 2),
+            '1.1.0' => array('version' => '1.1.0', 'tables' => 3)
 );
 
diff --git a/setup/databaseScripts/update_database_V1.1.0.php b/setup/databaseScripts/update_database_V1.1.0.php
new file mode 100644 (file)
index 0000000..b71f50c
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/*
+ * Gaslight Media Members Database - Packaging Add-On
+ *
+ * Database Update Script for version 1.1.0
+ */
+
+/*
+ * Update package records to build package_slug field data from title
+ */
+
+// Get all package records
+$packageRecords = $this->wpdb->get_results('SELECT id, title FROM '.GLM_MEMBERS_PACKAGING_PLUGIN_DB_PREFIX.'packages;', ARRAY_A);
+
+// If there's any package records
+if ($packageRecords && count($packageRecords) > 0) {
+
+    // For each package record
+    foreach ($packageRecords as $p) {
+
+        // Create a slug from the title
+        $slug = sanitize_title($p['title']);
+
+        // Store this value back into the record
+        $this->wpdb->update(
+                GLM_MEMBERS_PACKAGING_PLUGIN_DB_PREFIX.'packages',
+                array(
+                        'package_slug' => $slug
+                ),
+                array( 'id' => $p['id'] ),
+                array( '%s' ),
+                array( '%d')
+        );
+    }
+
+}
+
+?>
\ No newline at end of file
diff --git a/setup/databaseScripts/update_database_V1.1.0.sql b/setup/databaseScripts/update_database_V1.1.0.sql
new file mode 100644 (file)
index 0000000..a699971
--- /dev/null
@@ -0,0 +1,30 @@
+-- Gaslight Media Members Database 
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 1.0.28
+-- Database Update From Previous Version Script
+-- 
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashses
+
+-- Package Management Settings
+CREATE TABLE {prefix}management (
+  id INT NOT NULL AUTO_INCREMENT,
+  canonical_package_page TINYTEXT NULL,          -- Canonical page slug for package detail
+  PRIMARY KEY (id)
+);
+
+----
+
+-- Set default package management entry
+INSERT INTO {prefix}management
+    ( id, canonical_package_page )
+   VALUES
+    ( 1, 'package-detail' )
+;
+
+----
+
+ALTER TABLE {prefix}packages ADD COLUMN package_slug TINYTEXT;
+
+
+
index f427686..0d5a336 100644 (file)
@@ -37,6 +37,9 @@ $glmMembersPackagingAddOnValidActions = array(
         ),
         'member' => array(
             'packaging' => GLM_MEMBERS_PACKAGING_PLUGIN_SLUG
+        ),
+        'management' => array(
+            'packaging' => GLM_MEMBERS_PACKAGING_PLUGIN_SLUG
         )
     ),
     'frontActions' => array(
diff --git a/views/admin/management/packaging.html b/views/admin/management/packaging.html
new file mode 100644 (file)
index 0000000..a722756
--- /dev/null
@@ -0,0 +1,36 @@
+{include file='admin/management/header.html'}
+    
+    
+    {if $settingsUpdated}<h2 class="glm-notice glm-flash-updated">Settings Updated</h2>{/if}
+    
+    <form action="{$thisURL}?page={$thisPage}" method="post" enctype="multipart/form-data">
+        <input type="hidden" name="glm_action" value="packaging">
+        <input type="hidden" name="option" value="submit">
+        
+        <table class="glm-admin-table">
+        
+            <!-- General Packaging Settings -->
+        
+            <tr><td colspan="2"><h2>General Packaging Settings</h2></td></tr>
+            <tr>
+               <th>Package Detail Page Permalink Name:</th>
+                <td>
+                    <input type="text" name="canonical_package_page" value="{$packagingSettings.fieldData.canonical_package_page}">
+                    <br>Use only the page name at the end of the permalink for the package detail page.
+                </td>
+            </tr>
+        </table>
+        <input type="submit" value="Update Settings" class="button-primary">
+    </form>
+    
+    <script type="text/javascript">
+        
+        jQuery(document).ready(function($) {
+
+            // Flash certain elements for a short time after display      
+            $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
+                    
+        });
+    </script>
+
+{include file='admin/footer.html'}
index 6e57ded..3e66b15 100644 (file)
@@ -57,6 +57,7 @@
                         {if $packageInfo.fieldFail.title}<p>{$packageInfo.fieldFail.title}</p>{/if}
                     </td>
                 </tr>
+                <tr><th>Name for URLs:</th><td>{$packageInfo.fieldData.package_slug}</p></td></tr>
                 <tr>
                     <th>Active:</th>
                     <td>
index 96e2bb2..ee211fb 100644 (file)
           
         <table class="glm-admin-table">
             <tr><th>Title:</th><td>{$packageInfo.fieldData.title}</td></tr>
+            <tr><th>Name for URLs:</th><td>{$packageInfo.fieldData.package_slug}</td></tr>
             <tr><th>Active:</th><td>{$packageInfo.fieldData.active.name}</td></tr>
             <tr><th>Description:</th><td>{$packageInfo.fieldData.descr}</td></tr>
             <tr><th>Short Description:</th><td>{$packageInfo.fieldData.short_descr}</td></tr>
 {else} <!-- option is not edit or add -->
     
   {if apply_filters('glm_members_permit_admin_members_packaging_add_package', true)}
-    <div id="addPackageButton" class="button-primary glm-right">Add a Package</div>
+    <div id="addPackageButton" class="button-primary glm-right">&nbsp;&nbsp;Add a Package</div>
   {/if}
       
-    <h2>Multi-Member Packages</h2>
+    <!-- Package list selection form -->      
+    <form class="glm-right" onSubmit="return false;">
+       <span{if $haveFilter} class="glm-notice"{/if}><b>List Filters:</b>&nbsp;&nbsp;</span> 
+       <input type="radio" name="filterPackageType" class="listFilter"{if $filterMultiMember} checked{/if} value="all">All&nbsp;&nbsp;
+       <input type="radio" name="filterPackageType" class="listFilter"{if $filterMultiMember} checked{/if} value="member">Member&nbsp;&nbsp;
+       <input type="radio" name="filterPackageType" class="listFilter"{if $filterMultiMember} checked{/if} value="multi-member">Multi-Member&nbsp;&nbsp;
+       Search: <input  id="glmPackageSearch" type="text" id="autoTest">&nbsp;&nbsp;
+    </form>
+    <br clear="all">
+      
+      
+    <h2>Packages</h2>
 
     <table class="wp-list-table striped glm-admin-table">
         <thead>
             <tr>
                 <th>Package</th>
+                <th>Member</th>
                 <th>Start</th>
                 <th>End</th>
                 <th>Expire</th>
   {if $havePackages}
     {foreach $packages as $p}
             <tr>
-                <td>
+                <td class="glm-nowrap">
                     <a href="{$thisURL}?page={$thisPage}&glm_action=packaging&option=edit&packageID={$p.id}">{$p.title}</a>
                 </td>
+                <td class="glm-nowrap">
+                    <a href="{$thisURL}?page=glm-members-admin-menu-member&glm_action=index&member={$p.ref_dest}">{$p.ref_dest_name}</a>
+                </td>
                 <td>
                     {$p.start_date.date}
                 </td>
     {/if}
 
             /*
-             * Package Members Processing
+             * Do autocomplete search for package
+             * label: What will be searched
+             * value: What will be displayed when selected
+             * id: Package id added so we can go to the member while showing what was selected
+             * Also note that autocomplete does not properly render HTML codes, so we 
+             * "unescape" them for HTML in Smarty.
              */
-
-             // Build a list of members for the autocomplete search
-             var availableTags = [
-     {foreach $membersList as $m}
-                 { label: "{$m.name|unescape:'html'}", value: "{$m.name|unescape:'html'}", id: '{$m.id}', name: "{$m.name}" },
-     {/foreach}
-              ];
-
-             $( "#glmMembersList" ).autocomplete({
+            var availableTags = [
+    {if $havePackages}
+        {foreach $packages as $p}
+                { label: "{$p.title|unescape:'html'} - {$p.ref_dest_name|unescape:'html'}", id: '{$p.id}' },
+        {/foreach}
+    {/if}
+             ];
+             $( "#glmPackageSearch" ).autocomplete({
                  source: availableTags,
                  html: true,
                  select: function( event, ui ) {
-
-                     // get the member ID and Name
-                     var memberID = ui.item.id;
-                     var memberName = ui.item.name
-
-                     // Get a copy of the template 
-                     var memberTemplate = $('#glmGalleryItmeDataTemplate').html();
-                     
-                     // Set the member data into the template copy
-                     memberTemplate = memberTemplate.replace('{ id }', memberID).replace('{ memberName }', memberID);
-                     
-                     // Insert the selected member
-                     $('#glmPackageMembersList').append(memberTemplate);
-
-                     {if !$havePackageMembers}
-                     // Hide the no members selected message
-                     $('#glmNoMembersSelected').hide();                     
-        {/if}        
-
+                     var packageID = ui.item.id;
+                     window.location.replace("{$adminURL}?page=glm-members-admin-menu-members&glm_action=packaging&package=" + packageID );
                  }
              });
-
+             
         });
     </script>
             
index 318df70..1ac0fce 100644 (file)
@@ -39,7 +39,7 @@
                 <div><a class="url" title="url" href={$p.url}>{$p.url}</a></div>
               {/if}
               {if $p.email}
-                <div><a class="email" title="Email" href={$p.email}>Email</a></div>
+                <div><a class="email" title="Email" href={$p.email}>{$p.email}</a></div>
               {/if}
             </div>
         </div>
@@ -86,7 +86,7 @@
               {if $p.image}
                 <img src="{$glmPluginMediaURL}/images/medium/{$p.image}">
               {/if}
-                <h3 class="package-title"><a href="{$thisURL}?glm_action=detail&packageID={$p.id}">{$p.title}</a></h3>
+                <h3 class="package-title"><a href="{$thisURL}{$settings.canonical_package_page}/{$p.package_slug}/">{$p.title}</a></h3>
               {if $p.descr}
                 {$p.descr}
               {else if $p.short_descr}