initial commit master
authorAnthony Talarico <talarico@gaslightmedia.com>
Wed, 20 Sep 2017 17:46:44 +0000 (13:46 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Wed, 20 Sep 2017 17:46:44 +0000 (13:46 -0400)
initial commit, migrating code from a different repo instance, admin model views and front
model views added and being worked on

48 files changed:
.gitignore [new file with mode: 0644]
activate.php [new file with mode: 0644]
assets/readme.txt [new file with mode: 0644]
classes/data/dataForSale.php [new file with mode: 0644]
classes/readme.txt [new file with mode: 0644]
config/plugin.ini [new file with mode: 0644]
css/admin.css [new file with mode: 0644]
css/admin.css.map [new file with mode: 0644]
css/front.css [new file with mode: 0644]
css/front.css.map [new file with mode: 0644]
css/readme.txt [new file with mode: 0644]
deactivate.php [new file with mode: 0644]
defines.php [new file with mode: 0644]
gulpfile.js [new file with mode: 0644]
index.php [new file with mode: 0644]
js/readme.txt [new file with mode: 0644]
lib/readme.txt [new file with mode: 0644]
misc/documentation/AddAnAdminTab.txt [new file with mode: 0644]
misc/documentation/CreateNewAddOn.txt [new file with mode: 0644]
models/admin/forSale/index.php [new file with mode: 0644]
models/admin/readme.txt [new file with mode: 0644]
models/front/forSale/detail.php [new file with mode: 0644]
models/front/forSale/list.php [new file with mode: 0644]
models/front/readme.txt [new file with mode: 0644]
package.json [new file with mode: 0644]
readme.txt [new file with mode: 0644]
scss/admin.scss [new file with mode: 0644]
scss/front.scss [new file with mode: 0644]
setup/adminHooks.php [new file with mode: 0644]
setup/adminMenus.php [new file with mode: 0644]
setup/adminTabs.php [new file with mode: 0644]
setup/databaseScripts/create_database_V0.0.1.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php [new file with mode: 0644]
setup/frontHooks.php [new file with mode: 0644]
setup/hooksHelp.html [new file with mode: 0644]
setup/permissions.php [new file with mode: 0644]
setup/rolesAndCapabilities.php [new file with mode: 0644]
setup/shortcodes.php [new file with mode: 0644]
setup/validActions.php [new file with mode: 0644]
uninstall.php [new file with mode: 0644]
views/admin/forSale/edit.html [new file with mode: 0644]
views/admin/forSale/list.html [new file with mode: 0644]
views/admin/forSale/parts/image_input.html [new file with mode: 0644]
views/admin/header.html [new file with mode: 0644]
views/admin/readme.txt [new file with mode: 0644]
views/front/forSale/detail.html [new file with mode: 0644]
views/front/forSale/list.html [new file with mode: 0644]
views/front/readme.txt [new file with mode: 0644]

diff --git a/.gitignore b/.gitignore
new file mode 100644 (file)
index 0000000..3c3629e
--- /dev/null
@@ -0,0 +1 @@
+node_modules
diff --git a/activate.php b/activate.php
new file mode 100644 (file)
index 0000000..05d3c19
--- /dev/null
@@ -0,0 +1,153 @@
+<?php
+
+/**
+ * GLM Members Database Buy Sell
+ * Activate Plugin Tasks
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersForSale
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  activate.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+    die("Please do not call this code directly!");
+}
+
+/*
+ * This class performs all necessary additional work when this
+ * plugin is activated.
+ *
+ * Currently the only actions are to add role capability to display and modify
+ * prototypes.
+ */
+class glmMembersForSalePluginActivate
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+    /*
+     * Constructor
+     *
+     * Note that the $noDatabaseCheck is used to access the database versions
+     * without triggering a database check.
+     *
+     * Performs all the work for this model
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Make sure the current user has this capability
+        if (! current_user_can('activate_plugins')) {
+            $this->addNotice("Interesting, you don't have permission to activate plugins.");
+            die();
+        }
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        // Set current plugin version
+        update_option('glmMembersForSalePluginVersion', GLM_MEMBERS_FOR_SALE_PLUGIN_VERSION);
+
+        // Set Roles and Capabilities for this plugin
+        require_once GLM_MEMBERS_FOR_SALE_PLUGIN_SETUP_PATH.'/rolesAndCapabilities.php';
+    }
+
+    /*
+     * Add a capability to all current roles
+     *
+     * @param string $capability Name of capability to add
+     * @param array $default Whether capability should be on by default
+     *           array(
+     *               'author' => false,
+     *               'contributor' => false,
+     *               'editor' => false,
+     *               'subscriber' => false
+     *           )
+     *
+     * @return void
+     * @access private
+     */
+    private function addRoleCapability($capability, $default)
+    {
+        // Get list of role objects
+        $roleObjects = $GLOBALS['wp_roles']->role_objects;
+
+        // Get list of roles we can edit
+        $roles = get_editable_roles();
+
+        // For each role object
+        foreach ($roleObjects as $key => $role) {
+
+            // Check if the role exists in list of editable roles and
+            // the capability does not exist
+            if (isset($roles[$key]) && ! isset($role->capabilities[$capability])) {
+
+                // Check if a default value has been specified in the $default array
+                $enabled = false;
+                if (isset($default[$role->name])) {
+
+                    // It has, so use that
+                    $enabled = $default[$role->name];
+
+                }
+
+                // Add the role
+                $role->add_cap($capability, $enabled);
+
+            }
+        }
+    }
+
+
+    /*
+     * Delete a capability from all current roles
+     *
+     * @param string $capability Name of capability to add
+     *
+     * @return void
+     * @access private
+     */
+    private function deleteRoleCapability($capability)
+    {
+        // Get list of role objects
+        $roleObjects = $GLOBALS['wp_roles']->role_objects;
+
+        // Get list of roles we can edit
+        $roles = get_editable_roles();
+
+        // For each role object
+        foreach ($roleObjects as $key => $role) {
+
+            if ( isset($role->capabilities[$capability])) {
+                $role->remove_cap($capability);
+            }
+
+        }
+
+    }
+
+
+
+}
diff --git a/assets/readme.txt b/assets/readme.txt
new file mode 100644 (file)
index 0000000..34a6135
--- /dev/null
@@ -0,0 +1,2 @@
+Assets folder for things like images and other 
+files that might need to be read directly.
\ No newline at end of file
diff --git a/classes/data/dataForSale.php b/classes/data/dataForSale.php
new file mode 100644 (file)
index 0000000..fbc8fbb
--- /dev/null
@@ -0,0 +1,257 @@
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Data Class Buy Sell Postings
+ *
+ * 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: dataConditions.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**********************************************************************
+ *  NOTE: THIS IS A Buy Sell Postings FILE - DO NOT USE UNMODIFIED
+ *
+ *  Please change all references to conditions, Conditions, or CONDITIONS to a name
+ *  appropriate for your new Add-On.
+ *
+ *  Data fields in this file are conditions only.
+ *
+ *  Remove this message before using this file in production!
+ **********************************************************************/
+
+/**
+ * GlmDataBuy Sells 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: dataMembers.php,v 1.0 2011/01/25 19:31:47 cscott
+ *          Exp $
+ */
+class GlmDataForSale 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_FOR_SALE_PLUGIN_DB_PREFIX . 'items';
+
+        //        -- Conditions Table
+        //CREATE TABLE {prefix}conditions (
+        //  id INT NOT NULL AUTO_INCREMENT,
+        //  name TEXT NOT NULL,
+        //  descr_short TEXT NULL,
+        //  descr TEXT NULL,
+        //  last_update DATE NULL,
+        //  PRIMARY KEY (id)
+        //);
+        
+        /*
+         * Table Data Fields
+         */
+
+        $this->fields = array (
+
+            'id' => array (
+                'field' => 'id',
+                'type' => 'integer',
+                'view_only' => true,
+                'use' => 'a'
+            ),
+            'topic' => array (
+                'field' => 'topic',
+                'type' => 'list',
+                    'list' => $this->config['topics'],
+                    'default' => 'For Sale',
+                    'force_list' => true,
+                'use' => 'a'
+            ),
+            'title' => array (
+                'field' => 'title',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+            'descr' => array (
+                'field' => 'descr',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+            'terms' => array (
+                'field' => 'terms',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+            'contact_email' => array (
+                'field' => 'contact_email',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+            'contact_name' => array (
+                'field' => 'contact_name',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+            'contact_phone' => array (
+                'field' => 'contact_phone',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+            'post_date' => array (
+                'field' => 'post_date',
+                'type' => 'datetime',
+                'use' => 'lge'
+            ),
+            'visible' => array (
+                'field' => 'visible',
+                'type' => 'checkbox',
+                'use' => 'a'
+            ),
+            'post' => array (
+                'field' => 'post',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+            'location' => array (
+                'field' => 'location',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+            'item_expiration' => array (
+                'field' => 'item_expiration',
+                'type' => 'list',
+                    'list' => $this->config['item_expiration'],
+                    'default' => '120 Days',
+                    'force_list' => true,
+                'use' => 'a'
+            ),
+            'image_1' => array (
+                'field' => 'image_1',
+                'type' => 'image',
+                'use' => 'a'
+            ),
+            'image_2' => array (
+                'field' => 'image_2',
+                'type' => 'image',
+                'use' => 'a'
+            ),
+            'company' => array (
+                'field' => 'company',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+            'image_3' => array (
+                'field' => 'image_3',
+                'type' => 'image',
+                'use' => 'a'
+            ),
+            'member' => array (
+                'field' => 'member',
+                'type' => 'pointer',
+                    'p_table' => GLM_MEMBERS_PLUGIN_DB_PREFIX  . 'members',
+                    'p_field' => 'name',
+                    'p_orderby' => 'name',
+                'use' => 'a'
+            ),
+        );
+    }
+
+    /*
+     * Entry Post Processing Call-Back Method
+     *
+     * Perform post-processing for all result entries.
+     *
+     * In this case we're using it to append an array of category
+     * data to each row result and also sort by name.
+     *
+     * @param array $r Array of field result data for a single entry
+     * @param string $a Action being performed (l, i, g, ...)
+     *
+     * @return object Class object
+     *
+     */
+    public function entryPostProcessing($r, $a)
+    {
+        return $r;
+    }
+
+}
+
+?>
\ No newline at end of file
diff --git a/classes/readme.txt b/classes/readme.txt
new file mode 100644 (file)
index 0000000..fa5f44e
--- /dev/null
@@ -0,0 +1,3 @@
+General class libraries developed specifically for this add-on should be placed in this directory.
+
+The lib directory should be considered instead for any standard class libraries not specifically developed for this add-on.
\ No newline at end of file
diff --git a/config/plugin.ini b/config/plugin.ini
new file mode 100644 (file)
index 0000000..eae9133
--- /dev/null
@@ -0,0 +1,14 @@
+;
+; Main Configuration File
+; {descrName}
+;
+; Place any static configuration parameters here.  
+;
+
+[common]
+item_expiration[60] = '60 Days'
+item_expiration[90] = '90 Days'
+item_expiration[120] = '120 Days'
+
+topics[1] = 'Buy'
+topics[2] = 'For Sale'
\ No newline at end of file
diff --git a/css/admin.css b/css/admin.css
new file mode 100644 (file)
index 0000000..8f82374
--- /dev/null
@@ -0,0 +1,3 @@
+#glm-admin-content-container .admin-item-label,#glm-admin-content-container .admin-item-input,#glm-admin-content-container .admin-item-list{padding:0}.itemTitle-record{float:left}.admin-new-item{margin-bottom:15px}.admin-new-item .admin-new-item-link{padding:5px;background:#3D84D0;color:white;text-decoration:none;border-radius:4px}.no-padding{padding:0}.no-margin{margin:0}#glm-admin-content-container .admin-item-list-header{margin-bottom:20px;padding-bottom:2px;border-bottom:1px solid lightgray}.admin-item-list-row{padding-bottom:5px}.item-company-list-header,.item-date-list-header,.item-title-list-header{font-weight:bold;font-size:16px}.admin-item-list-row:nth-child(odd){background:#e3e3e5}.item-image{display:block}.item-image-row{border-bottom:1px solid lightgray;padding-bottom:10px}
+
+/*# sourceMappingURL=admin.css.map */
diff --git a/css/admin.css.map b/css/admin.css.map
new file mode 100644 (file)
index 0000000..8b32b22
--- /dev/null
@@ -0,0 +1 @@
+{"version":3,"file":"admin.css","sources":["admin.scss"],"sourcesContent":["#glm-admin-content-container .admin-item-label,\n#glm-admin-content-container .admin-item-input,\n#glm-admin-content-container .admin-item-list{\n    padding: 0;\n}\n.itemTitle-record{\n    float: left;\n}\n.admin-item-input textarea{\n   \n}\n.admin-new-item{\n    margin-bottom: 15px;\n}\n.admin-new-item .admin-new-item-link{\n    padding: 5px;\n    background: #3D84D0;\n    color: white;\n    text-decoration: none;\n    border-radius: 4px;\n}\n.no-padding{\n    padding: 0;\n}\n.no-margin{\n    margin: 0;\n}\n#glm-admin-content-container .admin-item-list-header{\n    margin-bottom: 20px;\n    padding-bottom: 2px;\n    border-bottom: 1px solid lightgray;\n}\n.admin-item-list-row{\n    padding-bottom: 5px;\n/*    border-bottom: 1px solid lightgray;*/\n}\n.item-company-list-header,.item-date-list-header, .item-title-list-header{\n    font-weight: bold;\n    font-size: 16px;\n}\n.admin-item-list-row:nth-child(odd){\n    background: #e3e3e5;\n}\n.item-image{\n    display: block;\n}\n.item-image-row{\n    border-bottom: 1px solid lightgray;\n    padding-bottom: 10px;\n}\n"],"names":[],"mappings":"AAAA,AAA6B,4BAAD,CAAC,iBAAiB,CAC9C,AAA6B,4BAAD,CAAC,iBAAiB,CAC9C,AAA6B,4BAAD,CAAC,gBAAgB,AAAA,CACzC,OAAO,CAAE,CAAC,CACb,AACD,AAAA,iBAAiB,AAAA,CACb,KAAK,CAAE,IAAI,CACd,AAID,AAAA,eAAe,AAAA,CACX,aAAa,CAAE,IAAI,CACtB,AACD,AAAgB,eAAD,CAAC,oBAAoB,AAAA,CAChC,OAAO,CAAE,GAAG,CACZ,UAAU,CAAE,OAAO,CACnB,KAAK,CAAE,KAAK,CACZ,eAAe,CAAE,IAAI,CACrB,aAAa,CAAE,GAAG,CACrB,AACD,AAAA,WAAW,AAAA,CACP,OAAO,CAAE,CAAC,CACb,AACD,AAAA,UAAU,AAAA,CACN,MAAM,CAAE,CAAC,CACZ,AACD,AAA6B,4BAAD,CAAC,uBAAuB,AAAA,CAChD,aAAa,CAAE,IAAI,CACnB,cAAc,CAAE,GAAG,CACnB,aAAa,CAAE,mBAAmB,CACrC,AACD,AAAA,oBAAoB,AAAA,CAChB,cAAc,CAAE,GAAG,CAEtB,AACD,AAAA,yBAAyB,CAAC,AAAA,sBAAsB,CAAE,AAAA,uBAAuB,AAAA,CACrE,WAAW,CAAE,IAAI,CACjB,SAAS,CAAE,IAAI,CAClB,AACD,AAAA,oBAAoB,AAAA,UAAW,CAAA,AAAA,GAAG,CAAC,CAC/B,UAAU,CAAE,OAAO,CACtB,AACD,AAAA,WAAW,AAAA,CACP,OAAO,CAAE,KAAK,CACjB,AACD,AAAA,eAAe,AAAA,CACX,aAAa,CAAE,mBAAmB,CAClC,cAAc,CAAE,IAAI,CACvB"}
\ No newline at end of file
diff --git a/css/front.css b/css/front.css
new file mode 100644 (file)
index 0000000..9691ea0
--- /dev/null
@@ -0,0 +1,3 @@
+.no-padding{padding:0}.front-item-list-wrapper span{font-weight:bold}.front-item-list-wrapper .front-list-item{padding:10px 0;border-bottom:1px solid lightgray}.front-item-list-wrapper div{line-height:1.1;padding:5px}.front-item-list-wrapper .front-list-topic{padding:5px;width:100px;text-align:center;color:white;border-radius:5px;margin-bottom:10px}.front-item-list-wrapper .item-wanted{background:green}.front-item-list-wrapper .item-sale{background:red}
+
+/*# sourceMappingURL=front.css.map */
diff --git a/css/front.css.map b/css/front.css.map
new file mode 100644 (file)
index 0000000..928c7a6
--- /dev/null
@@ -0,0 +1 @@
+{"version":3,"file":"front.css","sources":["front.scss"],"sourcesContent":[".no-padding{\n    padding: 0;\n}\n.front-item-list-wrapper{\n    span{\n        font-weight: bold;\n    }\n    .front-list-item{\n        padding: 10px 0;\n        border-bottom: 1px solid lightgray;\n    }\n    div{\n        line-height: 1.1;\n        padding: 5px;\n    }\n    .front-list-topic{\n        padding: 5px;\n        width: 100px;\n        text-align: center;\n        color: white;\n        border-radius: 5px;\n        margin-bottom: 10px;\n    }\n    .item-wanted{\n        background: green;\n    }\n    .item-sale{\n        background: red;\n    }\n}"],"names":[],"mappings":"AAAA,AAAA,WAAW,AAAA,CACP,OAAO,CAAE,CAAC,CACb,AACD,AACI,wBADoB,CACpB,IAAI,AAAA,CACA,WAAW,CAAE,IAAI,CACpB,AAHL,AAII,wBAJoB,CAIpB,gBAAgB,AAAA,CACZ,OAAO,CAAE,MAAM,CACf,aAAa,CAAE,mBAAmB,CACrC,AAPL,AAQI,wBARoB,CAQpB,GAAG,AAAA,CACC,WAAW,CAAE,GAAG,CAChB,OAAO,CAAE,GAAG,CACf,AAXL,AAYI,wBAZoB,CAYpB,iBAAiB,AAAA,CACb,OAAO,CAAE,GAAG,CACZ,KAAK,CAAE,KAAK,CACZ,UAAU,CAAE,MAAM,CAClB,KAAK,CAAE,KAAK,CACZ,aAAa,CAAE,GAAG,CAClB,aAAa,CAAE,IAAI,CACtB,AAnBL,AAoBI,wBApBoB,CAoBpB,YAAY,AAAA,CACR,UAAU,CAAE,KAAK,CACpB,AAtBL,AAuBI,wBAvBoB,CAuBpB,UAAU,AAAA,CACN,UAAU,CAAE,GAAG,CAClB"}
\ No newline at end of file
diff --git a/css/readme.txt b/css/readme.txt
new file mode 100644 (file)
index 0000000..954cc9c
--- /dev/null
@@ -0,0 +1 @@
+Add admin.css and/or front.css to this directory to have those registered automatically.
\ No newline at end of file
diff --git a/deactivate.php b/deactivate.php
new file mode 100644 (file)
index 0000000..b63cad7
--- /dev/null
@@ -0,0 +1,61 @@
+<?php
+/**
+ * GLM Members Database Buy Sell
+ * Deactivate Plugin Tasks
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersForSale
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+    die("Please do not call this code directly!");
+}
+
+/*
+ * This class performs all necessary additional work when this
+ * plugin is deactivated.
+ */
+class glmMembersForSalePluginDeactivate
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+
+    /*
+     * Constructor
+     *
+     * Performs all the work for this model
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        // Delete our version from WordPress Options
+        delete_option('glmMembersForSalePluginVersion');
+    }
+
+}
diff --git a/defines.php b/defines.php
new file mode 100644 (file)
index 0000000..ac06c05
--- /dev/null
@@ -0,0 +1,64 @@
+<?php
+/**
+ * {DescrName}
+ *
+ * Set standard defined parameters
+ */
+
+// NOTE: Plugin & Database versions are defined in "/glm-member-db.php".
+
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_NAME', 'GLM Members Database For Sale');
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_SHORT_NAME', 'For Sale');
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG', 'glm-member-db-for-sale');
+
+// Database table prefixes - change if using add-on tables
+global $wpdb;
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_DB_PREFIX', $wpdb->prefix.'glm_membersForSale_');
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_ACTIVE_DB_OPTION', 'glmMembersForSaleDbVersion');
+
+// Determine which system we're running on - If not provided, assume PRODUCTION
+$host = getenv('GLM_HOST_ID');
+if (trim($host) == '') {
+    $host = 'PRODUCTION';
+}
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_HOST', $host);
+
+// Determine current http/https protocol
+$pageProtocol = 'http';
+if (isset($_SERVER['SERVER_PORT']) && $_SERVER['SERVER_PORT'] == '443') {
+    $pageProtocol = 'https';
+}
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_HTTP_PROTOCOL', $pageProtocol);
+
+// Get various pieces of the URL
+$urlParts = parse_url(get_bloginfo('url'));
+$pageUri = explode('?', $_SERVER['REQUEST_URI']);               // Bust this up to access URL path and script name only
+
+$WPUploadDir = wp_upload_dir();
+
+/*
+ *  Create a copy of the plugin slug that can be used as a variable prefix used to keep
+ *  global instances from clashing with instances in other plugins.
+ */
+$vprefix = str_replace('-', '_', GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG);
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_PREFIX', $vprefix.'_');
+
+// URLs
+define('GLM_MEMBERS_FOR_SALE_SITE_BASE_URL', home_url('/') );
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_URL', plugin_dir_url(__FILE__));
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_ADMIN_URL', admin_url('admin.php'));
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_BASE_URL', WP_PLUGIN_URL.'/'.GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG);
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_CURRENT_URL', $urlParts['scheme'].'://'.$urlParts['host'].$pageUri[0]);
+
+// Directories
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_PATH', dirname(__FILE__));
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_SETUP_PATH', GLM_MEMBERS_FOR_SALE_PLUGIN_PATH.'/setup');
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_DB_SCRIPTS', GLM_MEMBERS_FOR_SALE_PLUGIN_SETUP_PATH.'/databaseScripts');
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_CLASS_PATH', GLM_MEMBERS_FOR_SALE_PLUGIN_PATH.'/classes');
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_CONFIG_PATH', GLM_MEMBERS_FOR_SALE_PLUGIN_PATH.'/config');
+
+// Parameters related to the Main GLM Member DB plugin - Depending on what's going on these may already defined by the main plugin
+$pluginsPath = str_replace(GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG, '', GLM_MEMBERS_FOR_SALE_PLUGIN_PATH);
+define('GLM_MEMBERS_FOR_SALE_MAIN_PLUGIN_PATH', $pluginsPath.'/glm-member-db');
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_LIB_PATH', GLM_MEMBERS_FOR_SALE_MAIN_PLUGIN_PATH.'/lib');
+
diff --git a/gulpfile.js b/gulpfile.js
new file mode 100644 (file)
index 0000000..4d14218
--- /dev/null
@@ -0,0 +1,53 @@
+var gulp = require('gulp');
+var rename = require('gulp-rename');
+var sass = require('gulp-sass');
+var maps = require('gulp-sourcemaps');
+
+function swallowError (error) {
+
+  // If you want details of the error in the console
+  console.log(error.toString())
+
+  this.emit('end')
+}
+
+function swallowError (error) {
+
+  // If you want details of the error in the console
+  console.log(error.toString());
+
+  this.emit('end');
+}
+
+gulp.task('sass_admin', function() {
+  return gulp.src('scss/admin.scss')
+    .pipe(maps.init())
+    .on('error', swallowError)
+    .pipe(sass({ 
+      outputStyle: 'compressed'
+  })).on('error', swallowError)
+  .pipe(rename('admin.css'))
+    .pipe(maps.write('.'))
+    .pipe(gulp.dest('css'));
+});
+gulp.task('sass_front', function() {
+    return gulp.src('scss/front.scss')
+      .pipe(maps.init())
+      .on('error', swallowError)
+      .pipe(sass({ 
+        outputStyle: 'compressed'
+    })).on('error', swallowError)
+    .pipe(rename('front.css'))
+      .pipe(maps.write('.'))
+      .pipe(gulp.dest('css'));
+  });
+
+gulp.task('watch', function () {
+  gulp.watch('scss/**/*.{scss,sass}', ['sass_admin','sass_front']);
+});
+
+gulp.task('build', ["sass_admin", "sass_front"]);
+
+gulp.task('runwatch', ["sass_admin", "sass_front"]);
+
+gulp.task('default', ["runwatch","watch"]);
\ No newline at end of file
diff --git a/index.php b/index.php
new file mode 100644 (file)
index 0000000..f64144f
--- /dev/null
+++ b/index.php
@@ -0,0 +1,229 @@
+<?php
+/**
+ * Plugin Name: GLM Members Database For Sale
+ * Plugin URI: http://www.gaslightmedia.com/
+ * Description: {descrString}
+ * Version: 0.0.1
+ * Author: Gaslight Media
+ * Author URI: http://www.gaslightmedia.com/
+ * License: GPL2
+ */
+
+/**
+ * GLM Members Database For Sale
+ * Index
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPluginChild
+ * @package glmMembersForSaleAddOn
+ * @author Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ * @version 0.0.1
+ */
+
+/*
+ *  Plugin and Database Versions
+ *
+ *  Note that the database version matches the version of the last
+ *  plugin version where there was a change in the database.
+ *
+ *  Updates to checkDatabase() in glmPluginSupport.php must be
+ *  made together with the DB_VERSION below. ONLY bump the DB
+ *  version when there's a change in the database!! Use the
+ *  version nunmber of that release for the DB version.
+ *
+ *  We check the plugin version stored in the WordPress option below
+ *  so that we're sure the other add-ons see an up to date
+ *  version from this plugin.
+ */
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_VERSION', '0.0.1');
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_DB_VERSION', '0.0.1');
+
+// This is the minimum version of the GLM Members DB plugin require for this plugin.
+define('GLM_MEMBERS_FOR_SALE_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.8.0');
+
+// Check if plugin version is not current in WordPress option and if needed updated it
+if (GLM_MEMBERS_FOR_SALE_PLUGIN_VERSION != get_option('glmMembersForSalePluginVersion')) {
+    update_option('glmMembersForSalePluginVersion', GLM_MEMBERS_FOR_SALE_PLUGIN_VERSION);
+}
+
+/*
+ * Copyright 2014 Charles Scott (email : cscott@gaslightmedia.com)
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+    die("Please do not call this code directly!");
+}
+
+/*
+* Some initial setup and tests
+*/
+
+$startupNotices = '';
+
+// Get standard defined parameters
+require_once 'defines.php';
+
+// Required to be able to get user capabilities when being called as a filter from the main plugin
+require_once ABSPATH . 'wp-includes/pluggable.php';
+
+// Include defines to tell if a plugin is active
+include_once ABSPATH . 'wp-admin/includes/plugin.php';
+
+/*
+ * Do some preliminary sanity checks
+ */
+
+// Check if database version should be defined and it isn't - This would be a plugin/add-on setup issue
+if (is_file(GLM_MEMBERS_FOR_SALE_PLUGIN_PATH.'/setup/databaseScripts/dbVersions.php') && !defined('GLM_MEMBERS_FOR_SALE_PLUGIN_DB_VERSION')) {
+    die('You have database scripts but have not defined a current database version at the top of index.php for this plugin/add-on!');
+}
+
+/*
+ * Check installation, activation, and version of main Member DB plugin
+ */
+
+// Check for main plugin and that it's active
+function glmMembersForSalePluginRequired() {
+    echo '
+        <div class="error">
+            <p>The '.GLM_MEMBERS_FOR_SALE_PLUGIN_NAME.' add-on requires the base GLM Member DB plugin to be installed and active!</p>
+            <p>The '.GLM_MEMBERS_FOR_SALE_PLUGIN_NAME.' plugin has been de-activated.</p>
+        </div>
+    ';
+}
+$plugin_name = 'glm-member-db/index.php';
+$is_active = is_plugin_active($plugin_name);
+if ($is_active != '1') {
+    add_action( 'admin_notices', 'glmMembersForSalePluginRequired' );
+    deactivate_plugins('/'.GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG.'/index.php');
+}
+
+// Check for Minimum DB version for main Member DB
+function glmMembersForSaleMinVerRequired() {
+    echo '
+        <div class="error">
+            <p>The '.GLM_MEMBERS_FOR_SALE_PLUGIN_NAME.' requires that the main GLM Member DB plugin version be no older than '
+                    .GLM_MEMBERS_FOR_SALE_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION.'!<br>
+                    '.GLM_MEMBERS_FOR_SALE_MIN_VERSION_NOTE.'</p>
+            <p>The '.GLM_MEMBERS_FOR_SALE_PLUGIN_NAME.' plugin has been de-activated.</p>
+        </div>
+    ';
+}
+$glmMembersDatabasePluginVersion = get_option('glmMembersDatabasePluginVersion');
+if (version_compare($glmMembersDatabasePluginVersion, GLM_MEMBERS_FOR_SALE_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION) < 0) {
+    define('GLM_MEMBERS_FOR_SALE_MIN_VERSION_NOTE', "Members DB: $glmMembersDatabasePluginVersion, For Sale Requires: ".GLM_MEMBERS_FOR_SALE_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION);
+    add_action( 'admin_notices', 'glmMembersForSaleMinVerRequired');
+    deactivate_plugins('/'.GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG.'/'.GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG.'.php');
+}
+
+/*
+ * Register this add-on with the main GLM Member DB plugin and get information on all add-ons loaded.
+ */
+require_once GLM_MEMBERS_FOR_SALE_PLUGIN_SETUP_PATH.'/validActions.php';
+require_once GLM_MEMBERS_FOR_SALE_PLUGIN_SETUP_PATH.'/shortcodes.php';
+if (is_file(GLM_MEMBERS_FOR_SALE_PLUGIN_DB_SCRIPTS.'/dbVersions.php')) {
+    require_once GLM_MEMBERS_FOR_SALE_PLUGIN_DB_SCRIPTS.'/dbVersions.php';
+}
+
+// Load Add-On Management Settings data
+/* None - Need to figure out a smooth way to do this.
+$glmMembersForSaleManagementSettings = $wpdb->get_row( "SELECT * FROM ".GLM_MEMBERS_FOR_SALE_PLUGIN_DB_PREFIX."management WHERE id = 1", ARRAY_A );
+unset($glmMembersForSaleManagementSettings['id']);
+*/
+
+function glmMembersForSaleRegisterAddOn($addOns) {
+
+    // Add this add-on to the add-ons array
+    $addOns[GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG] =  array(
+        'dir' => GLM_MEMBERS_FOR_SALE_PLUGIN_PATH,
+        'name' =>  GLM_MEMBERS_FOR_SALE_PLUGIN_NAME,
+        'short_name' => GLM_MEMBERS_FOR_SALE_PLUGIN_SHORT_NAME,
+        'slug' => GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG,
+        'actions' => $GLOBALS['glmMembersForSaleAddOnValidActions'],
+        'config' => array(
+        ),
+        'shortcodes' => $GLOBALS['glmMembersForSaleShortcodes'],
+        'shortcodesDescription' => $GLOBALS['glmMembersForSaleShortcodesDescription']
+    );
+
+    // If we have database tables for this plugin/addon, provide that data also
+    if (isset($GLOBALS['glmMembersForSaleDbVersions'])) {
+        $addOns[GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG]['database'] = array(
+            'dbPrefix' => GLM_MEMBERS_FOR_SALE_PLUGIN_DB_PREFIX,
+            'dbCurrentVersion' => GLM_MEMBERS_FOR_SALE_PLUGIN_DB_VERSION,
+            'dbActiveVersionOption' => GLM_MEMBERS_FOR_SALE_PLUGIN_ACTIVE_DB_OPTION,
+            'dbScriptPath' => GLM_MEMBERS_FOR_SALE_PLUGIN_DB_SCRIPTS,
+            'dbVersions' => $GLOBALS['glmMembersForSaleDbVersions']
+        );
+    } else {
+        $addOns[GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG]['database'] = false;
+    }
+
+    // Return the array with our data added
+    return $addOns;
+}
+add_filter('glm-member-db-register-addon','glmMembersForSaleRegisterAddOn', 10, 1);
+
+/*
+ * Plugin Update Support - uses Gaslight Media update server
+ */
+/* Not functional yet - Need to resolve JavaScript conflicts with this feature in other plugins
+require GLM_MEMBERS_FOR_SALE_PLUGIN_LIB_PATH.'/opentools-update-checker/opentools-update-checker.php';
+${GLM_MEMBERS_FOR_SALE_PLUGIN_PREFIX."updateChecker"} = new OpenToolsPluginUpdateChecker(
+     'http://www.gaslightmedia.com/update_server/?action=get_metadata&slug='.GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG,
+    __FILE__,
+    GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG
+);
+
+${GLM_MEMBERS_FOR_SALE_PLUGIN_PREFIX."updateChecker"}->declareCredentials(array(
+  'license_key' => __('License Key:')
+));
+*/
+
+/*
+  *
+  * Activate and Deactivate hooks
+  *
+ */
+
+ // Activate
+ function glmMembersForSalePluginActivate ()
+ {
+     global $wpdb, $config;
+     require_once GLM_MEMBERS_FOR_SALE_PLUGIN_PATH . '/activate.php';
+     new glmMembersForSalePluginActivate($wpdb, $config);
+ }
+ register_activation_hook(__FILE__, 'glmMembersForSalePluginActivate');
+
+ // Deactivate
+ function glmMembersForSalePluginDeactivate ()
+ {
+     global $wpdb, $config;
+     require_once GLM_MEMBERS_FOR_SALE_PLUGIN_PATH . '/deactivate.php';
+     $x = new glmMembersForSalePluginDeactivate($wpdb, $config);
+     return false;
+ }
+ register_deactivation_hook(__FILE__, 'glmMembersForSalePluginDeactivate');
+
+/*
+ * Hooks for testing capabilities provided by this add-on
+ */
+require_once GLM_MEMBERS_FOR_SALE_PLUGIN_SETUP_PATH.'/permissions.php';
+
diff --git a/js/readme.txt b/js/readme.txt
new file mode 100644 (file)
index 0000000..f642355
--- /dev/null
@@ -0,0 +1 @@
+Add admin.js and/or front.js to this directory to have those registered automatically.
\ No newline at end of file
diff --git a/lib/readme.txt b/lib/readme.txt
new file mode 100644 (file)
index 0000000..8373066
--- /dev/null
@@ -0,0 +1,3 @@
+Standard class libraries not specifically developed for this add-on should be placed here.
+
+The classes directory should be considered instead for class libraries developed specifically for this add-on.
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/misc/documentation/CreateNewAddOn.txt b/misc/documentation/CreateNewAddOn.txt
new file mode 100644 (file)
index 0000000..b93235f
--- /dev/null
@@ -0,0 +1,49 @@
+Procedure to create a new GLM Members add-on plugin
+----------------------------------------------------
+
+* Checkout glm-member-db-sample and rename directory to glm-member-db-{add-on name}
+
+* From a bash prompt, run "SETUP_SCRIPT" 
+
+* Create new repository named WP-Plugins/glm-member-db-{name of add-on}.git
+
+* If there are any databases associated with this add-on, setup the database scripts and
+  data under the "setup/databaseScripts" directory. If there are no database tables
+  with this add-on, remove all but the "readme.txt" file from that directory. 
+  NOTE: No "update_database..." files should be there for a new add-on with new tables.
+  NOTE: There should be only one entry in the "dbVersions.php" file.
+
+* Carefully review "defines.php" file and update as needed.
+
+* Do a quick review of the readme.txt file and update as desired.
+
+* TEST - At this point the add-on should install and activate but not do anything.
+    - If there are any database tables, make sure they were created and are correct.
+    - Go to "Members" -> "Management" -> "Add-Ons" and make sure the add-on was
+      properly registered with the main plugin and that any database data is shown.
+
+* Adding menus
+    - Update "setup/adminMenus.php" and add menu section as described there.
+    - Add an entry in the validActions.php file. Pay attention to how slug name is 
+      constructed ("glm-members-admin-{page}-{action}").
+    - If needed add a database table to the create_database_V...sql file
+      Also add a "classes/data/data{Table}.php file
+    - Add a model file as "models/admin/{page}/{action}.php
+    - Add any desired view file as "views/admin/{page}/{action}.html
+        Note that additional possible view files should be named as...
+            "views/admin/{page}/{action}{Name}.html
+    - Test that when add-on is activated that the menu shows and is functional.
+    
+* Adding tabs
+    - Update "setup/admin/Tabs.php" and add new tab filter as described there.
+    - Add an entry in the validActions.php file. Pay attention to how slug name is 
+      constructed ("glm-members-admin-{page}-{action}").
+    - If needed add a database table to the create_database_V...sql file
+      Also add a "classes/data/data{Table}.php file
+    - Add a model file as "models/admin/{page}/{action}.php
+    - Add any desired view file as "views/admin/{page}/{action}.html
+        Note that additional possible view files should be named as...
+            "views/admin/{page}/{action}{Name}.html
+    - Test that when add-on is activated that the tab shows and is functional.
+    
+ * 
\ No newline at end of file
diff --git a/models/admin/forSale/index.php b/models/admin/forSale/index.php
new file mode 100644 (file)
index 0000000..5d8e26a
--- /dev/null
@@ -0,0 +1,295 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * Buy Sell
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Load Contacts data abstract
+require_once GLM_MEMBERS_FOR_SALE_PLUGIN_CLASS_PATH .'/data/dataForSale.php';
+require_once GLM_MEMBERS_PLUGIN_CLASS_PATH .'/data/dataMembers.php';
+
+class GlmMembersAdmin_forSale_index extends GlmDataForSale
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * item ID
+     *
+     * @var $item ID
+     * @access public
+     */
+    public $item_id = false;
+
+    /*
+     * 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 the Contacts data class
+         *
+         * Note, the third parameter is a flag that indicates to the Contacts
+         * data class that it should flag a group of fields as 'view_only'.
+         */
+        parent::__construct(false, false, true);
+    }
+
+    public function modelAction($actionData = false)
+    {
+        $members     = new GlmDataMembers($this->wpdb, $this->config);
+        $member_list = $members->getList();
+    
+        
+        $success_message    = "";
+        $haveItem            = false;
+        $option             = false;
+        $item                = false;
+        $item_data           = false;
+        $itemUpdated         = false;
+        $itemUpdateError     = false;
+        $itemAdded           = false;
+        $itemAddError        = false;
+        $view_file          = 'index';
+        $lockedToMember     = false;
+        $isModerated        = false;
+        $memberID           = false;
+        $haveMember         = false;
+        $where              = '';
+
+        // Check if there's a logged in user who is locked to their own entity
+        $lockedToMember = apply_filters('glm_members_locked_to_member_id', false);
+        if ($lockedToMember) {
+
+            $isModerated = apply_filters('glm_user_is_moderated', $lockedToMember);
+            $memberID = $lockedToMember;
+       
+            $this->fields['admin_name']['required']  = true;
+            $this->fields['admin_email']['required'] = true;
+            $this->fields['admin_phone']['required'] = true;
+
+            // Check for Member Menu Use
+        } elseif (defined('GLM_item_MEMBER_MENU')) {
+
+            // Try to get member ID
+            $memberID = (isset($_REQUEST['member']) ? $_REQUEST['member'] : 0);
+
+            // If there's no valid member ID, we can't continue
+            if ($memberID == 0) {
+                return array(
+                    'status'           => false,
+                    'menuItemRedirect' => 'error',
+                    'modelRedirect'    => 'index',
+                    'view'             => 'admin/error/index.html',
+                    'data'             => array(
+                        'reason' => 'No member ID was provided.'
+                    )
+                );
+            }
+        }
+
+        // If not a valid member ID
+        if ($memberID > 0) {
+
+            // Get base member information
+            require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataMembers.php';
+        
+            $memberData = $members->getEntry($memberID);
+            $where .= "member = $memberID";
+            if (!$memberData) {
+                return array(
+                    'status'           => false,
+                    'menuItemRedirect' => 'error',
+                    'modelRedirect'    => 'index',
+                    'view'             => 'admin/error/index.html',
+                    'data'             => array(
+                        'reason' => 'No member data found for provided member ID.'
+                    )
+                );
+            } else{
+                $haveMember = true;
+                $memberName = $memberData['name'];
+            }
+
+        }
+
+        if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+            $option = $_REQUEST['option'];
+        }
+        
+        // get the item id for use in the edit, add and delete options
+        // Get obit ID if supplied
+        if (isset($_REQUEST['item'])) {
+
+            // Make sure it's numeric
+            $this->item_id= ($_REQUEST['item'] - 0);
+
+            if ($this->item_id <= 0) {
+                $this->item_id = false;
+            }
+        }
+
+        $item_data = $this->getList($where);
+        
+//        echo '<pre>', print_r($this->getList()), '</pre>';
+        // echo '<pre>', print_r($_REQUEST), '</pre>';
+        
+        switch ($option) {
+
+            case 'add':
+                $item = $this->newEntry();
+                $view_file = 'edit';
+                
+                break;
+
+            case 'insert':
+                $item = $this->insertEntry();
+                $this->item_id = $item['fieldData']['id'];
+
+                if ($item['status']) {
+                    $haveItem = true;
+                    $itemAdded = true;
+
+                    // Update created timestamp and name slug for URLs
+                    //$this->updateSlug($this->itemID);
+
+                    // Get this again so we have the created date
+                    $item = $this->editEntry($this->item_id);
+                    
+                    $option = 'edit';
+                    $itemAdded = true;
+
+                } else {
+                    $option = 'add';
+                    $itemAddError = true;
+                }
+
+                $view_file = 'edit';
+
+                break;
+
+            case 'edit':
+                $item = $this->editEntry($this->item_id);
+                
+                // If we have a good item
+                if ($item['status']) {
+                    $haveItem = true;
+                }
+
+                $view_file = 'edit';
+                break;
+
+            case 'update':
+                // Try to update this item
+                $item = $this->updateEntry($this->item_id);
+      
+                // Check if that was successful
+                if ($item['status']) {
+                    $itemUpdated = true;
+
+                    $item = $this->editEntry($this->item_id);
+                } else {
+                    $itemUpdateError = true;
+                }
+
+                $haveItem = true;
+                $view_file     = 'edit';
+                
+                break;
+
+            case 'delete':
+                $item = $this->deleteEntry($this->item_id,true);
+
+                if ($item) {
+                    $itemDeleted = true;
+                } else {
+                    $itemDeleteError = true;
+                }
+                $view_file = "list";
+                $item_data = $this->getList();
+                break;
+            default:
+                $item_data = $this->getList($where);
+                $view_file = 'list';
+                break;
+        }
+//        echo '<pre>', print_r($this->getList()), '</pre>';
+        // Compile template data
+        $templateData = array(
+            'itemData'        => $item_data,
+            'memberList'     => $member_list,
+            'lockedToMember' => $lockedToMember,
+            'haveMember'     => $haveMember,
+            'memberID'       => $memberID,
+            'itemID'          => $this->item_id,
+            'haveItem'        => $haveItem,
+            'itemUpdated'     => $itemUpdated,
+            'itemUpdateError' => $itemUpdateError,
+            'itemAdded'       => $itemAdded,
+            'itemAddError'    => $itemAddError,
+            'option'         => $option,
+            'item'            => $item,
+            'assetsUrl'      => GLM_MEMBERS_FOR_SALE_PLUGIN_URL . 'assets/',
+            
+        );
+
+        // Return status, any suggested view, and any data to controller
+        return array(
+                'status' => true,
+                'modelRedirect' => false,
+                'view' => 'admin/forSale/'.$view_file.'.html',
+                'data' => $templateData
+        );
+    }
+}
diff --git a/models/admin/readme.txt b/models/admin/readme.txt
new file mode 100644 (file)
index 0000000..e9a199d
--- /dev/null
@@ -0,0 +1,5 @@
+The admin controller executes models under this directory.
+
+Typically you should add a directory here that matches the page where the action should take place.
+
+Under that directory place the model for the various actions.
\ No newline at end of file
diff --git a/models/front/forSale/detail.php b/models/front/forSale/detail.php
new file mode 100644 (file)
index 0000000..d1eff1a
--- /dev/null
@@ -0,0 +1,146 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * Buy Sell
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Load Contacts data abstract
+require_once GLM_MEMBERS_FOR_SALE_PLUGIN_CLASS_PATH.'/data/dataForSale.php';
+
+
+class GlmMembersFront_forSale_detail extends GlmDataForSale
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Contact Info
+     *
+     * @var $contactInfo
+     * @access public
+     */
+    public $contactInfo = false;
+    /**
+     * Member ID
+     *
+     * @var $memberID
+     * @access public
+     */
+    public $memberID = false;
+    /**
+     * Contact ID
+     *
+     * @var $contactID
+     * @access public
+     */
+    public $contactID = false;
+    public $item_id;
+
+    /*
+     * 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 the Contacts data class
+         *
+         * Note, the third parameter is a flag that indicates to the Contacts
+         * data class that it should flag a group of fields as 'view_only'.
+         */
+        parent::__construct(false, false, true);
+
+
+    }
+
+    public function modelAction($actionData = false)
+    {
+        echo "ASF";
+        $success_message = "";
+        $option = false;
+        if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+            $option = $_REQUEST['option'];
+        }
+        // get the Item id for use in the edit, add and delete options
+        // Get obit ID if supplied
+        if (isset($_REQUEST['item'])) {
+
+            // Make sure it's numeric
+            $this->item_id= ($_REQUEST['item'] - 0);
+
+            if ($this->item_id <= 0) {
+                $this->item_id = false;
+            }
+        }
+        $where = "id = $this->item_id";
+        
+        $item = $this->getList($where);
+      
+        foreach($item as $i){
+            $item = $i;
+        }
+        // Compile template data
+        $templateData = array(
+            'itemData'       => $item,
+            'siteBaseUrl'   => GLM_MEMBERS_FOR_SALE_SITE_BASE_URL, 
+            'currentUrl'    => GLM_MEMBERS_FOR_SALE_PLUGIN_CURRENT_URL,
+        );
+
+        // Return status, any suggested view, and any data to controller
+        return array(
+                'status' => true,
+                'modelRedirect' => false,
+                'view' => 'front/forSale/detail.html',
+                'data' => $templateData
+        );
+    }
+}
diff --git a/models/front/forSale/list.php b/models/front/forSale/list.php
new file mode 100644 (file)
index 0000000..22c99c7
--- /dev/null
@@ -0,0 +1,137 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * For Sale
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  index.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Load Contacts data abstract
+require_once GLM_MEMBERS_FOR_SALE_PLUGIN_CLASS_PATH.'/data/dataForSale.php';
+
+class GlmMembersFront_forSale_list extends GlmDataForSale
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * Plugin Configuration Data
+     *
+     * @var $config
+     * @access public
+     */
+    public $config;
+    /**
+     * Contact Info
+     *
+     * @var $contactInfo
+     * @access public
+     */
+    public $contactInfo = false;
+    /**
+     * Member ID
+     *
+     * @var $memberID
+     * @access public
+     */
+    public $memberID = false;
+    /**
+     * Contact ID
+     *
+     * @var $contactID
+     * @access public
+     */
+    public $contactID = false;
+
+
+    /*
+     * 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 the Contacts data class
+         *
+         * Note, the third parameter is a flag that indicates to the Contacts
+         * data class that it should flag a group of fields as 'view_only'.
+         */
+        parent::__construct(false, false, true);
+
+
+    }
+
+    public function modelAction($actionData = false)
+    {
+        $where = "";
+
+        $success_message = "";
+        $option = false;
+        if (isset($_REQUEST['option']) && trim($_REQUEST['option']) != '') {
+            $option = $_REQUEST['option'];
+        }
+        $where .= "CURDATE() <= DATE_ADD(post_date, INTERVAL item_expiration DAY) ";
+
+        $item_data = $this->getList($where);
+    
+
+        $view_file = 'list';
+
+        // Compile template data
+        $templateData = array(
+            'itemData'    => $item_data,
+            'siteBaseUrl'   => GLM_MEMBERS_FOR_SALE_SITE_BASE_URL, 
+            'currentUrl'    => GLM_MEMBERS_FOR_SALE_PLUGIN_CURRENT_URL,
+        );
+
+        // Return status, any suggested view, and any data to controller
+        return array(
+                'status' => true,
+                'modelRedirect' => false,
+                'view' => 'front/forSale/'.$view_file.'.html',
+                'data' => $templateData
+        );
+
+    }
+
+}
diff --git a/models/front/readme.txt b/models/front/readme.txt
new file mode 100644 (file)
index 0000000..4c54852
--- /dev/null
@@ -0,0 +1,7 @@
+The front controller executes models under this directory.
+
+Typically you should add a directory here that matches the category of actions that will take place.
+
+Under that directory place the model for the various actions.
+
+Actions under this directory would normally be called due to processing of a shortcode.
\ No newline at end of file
diff --git a/package.json b/package.json
new file mode 100644 (file)
index 0000000..b25296d
--- /dev/null
@@ -0,0 +1,21 @@
+{
+  "name": "glm-member-db-buy-sell",
+  "version": "1.0.0",
+  "description": "=== GLM Members Database Buy Sell === Contributors: cscott@gaslightmedia.com Donate link: http://www.gaslightmedia.com Tags: Gaslight Media,Plugin,Buy Sell Requires at least: 3.0.1 Tested up to: 3.4 Stable tag: 4.3 License: GPLv2 or later License URI: http://www.gnu.org/licenses/gpl-2.0.html",
+  "main": "index.js",
+  "scripts": {
+    "test": "echo \"Error: no test specified\" && exit 1"
+  },
+  "repository": {
+    "type": "git",
+    "url": "git@cvs2:WP-Plugins/glm-member-db-buy-sell"
+  },
+  "author": "",
+  "license": "ISC",
+  "dependencies": {
+    "gulp": "^3.9.1",
+    "gulp-rename": "^1.2.2",
+    "gulp-sass": "^3.1.0",
+    "gulp-sourcemaps": "^2.6.1"
+  }
+}
diff --git a/readme.txt b/readme.txt
new file mode 100644 (file)
index 0000000..25993c8
--- /dev/null
@@ -0,0 +1,27 @@
+=== GLM Members Database Buy Sell ===
+Contributors: cscott@gaslightmedia.com
+Donate link: http://www.gaslightmedia.com
+Tags: Gaslight Media,Plugin,Buy Sell
+Requires at least: 3.0.1
+Tested up to: 3.4
+Stable tag: 4.3
+License: GPLv2 or later
+License URI: http://www.gnu.org/licenses/gpl-2.0.html
+
+This is the GLM Members Database Buy Sell.
+
+== Description ==
+
+The GLM Members Database Buy Sell is an add-on to the Gaslight Media Members Database,
+which is required to install and run this plugin
+
+== Installation ==
+
+This section describes how to install the plugin and get it working.
+
+e.g.
+
+1. Upload `plugin-name.php` to the `/wp-content/plugins/` directory
+1. Activate the plugin through the 'Plugins' menu in WordPress
+
+
diff --git a/scss/admin.scss b/scss/admin.scss
new file mode 100644 (file)
index 0000000..f57cb99
--- /dev/null
@@ -0,0 +1,50 @@
+#glm-admin-content-container .admin-item-label,
+#glm-admin-content-container .admin-item-input,
+#glm-admin-content-container .admin-item-list{
+    padding: 0;
+}
+.itemTitle-record{
+    float: left;
+}
+.admin-item-input textarea{
+   
+}
+.admin-new-item{
+    margin-bottom: 15px;
+}
+.admin-new-item .admin-new-item-link{
+    padding: 5px;
+    background: #3D84D0;
+    color: white;
+    text-decoration: none;
+    border-radius: 4px;
+}
+.no-padding{
+    padding: 0;
+}
+.no-margin{
+    margin: 0;
+}
+#glm-admin-content-container .admin-item-list-header{
+    margin-bottom: 20px;
+    padding-bottom: 2px;
+    border-bottom: 1px solid lightgray;
+}
+.admin-item-list-row{
+    padding-bottom: 5px;
+/*    border-bottom: 1px solid lightgray;*/
+}
+.item-company-list-header,.item-date-list-header, .item-title-list-header{
+    font-weight: bold;
+    font-size: 16px;
+}
+.admin-item-list-row:nth-child(odd){
+    background: #e3e3e5;
+}
+.item-image{
+    display: block;
+}
+.item-image-row{
+    border-bottom: 1px solid lightgray;
+    padding-bottom: 10px;
+}
diff --git a/scss/front.scss b/scss/front.scss
new file mode 100644 (file)
index 0000000..b0898c1
--- /dev/null
@@ -0,0 +1,30 @@
+.no-padding{
+    padding: 0;
+}
+.front-item-list-wrapper{
+    span{
+        font-weight: bold;
+    }
+    .front-list-item{
+        padding: 10px 0;
+        border-bottom: 1px solid lightgray;
+    }
+    div{
+        line-height: 1.1;
+        padding: 5px;
+    }
+    .front-list-topic{
+        padding: 5px;
+        width: 100px;
+        text-align: center;
+        color: white;
+        border-radius: 5px;
+        margin-bottom: 10px;
+    }
+    .item-wanted{
+        background: green;
+    }
+    .item-sale{
+        background: red;
+    }
+}
\ No newline at end of file
diff --git a/setup/adminHooks.php b/setup/adminHooks.php
new file mode 100644 (file)
index 0000000..879384b
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * GLM Members Database Buy Sell
+ * GLM Members Misc Admin Hooks and Filters
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  adminHooks.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Place Misc Hooks and Filters here. If this file exists, it will be included
+ * by the add-on main plugin script.
+ *
+ * Note that filter and hook callback functions must be included in-line as shown below...
+ *
+ *  add_filter( 'filter_title', function( $parameter ) {
+ *     // Function code
+ *  });
+ *
+ *  Also note that parameters will be in the context of the main admin controller constructor.
+  */
diff --git a/setup/adminMenus.php b/setup/adminMenus.php
new file mode 100644 (file)
index 0000000..a36caaf
--- /dev/null
@@ -0,0 +1,70 @@
+<?php
+/**
+ * GLM Members Database Buy Sell
+ * GLM Members DB - Buy Sell - Admin Menus
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Added menus or sub-menus examples
+ *
+ * // Add a main menu item
+ * add_menu_page(
+ *     'GLM Sample',                                       // Page Title
+ *     'GLM Sample',                                       // Menu Title
+ *     'glm-members-members',                              // Capability
+ *     'glm-members-admin-menu-glm-sample',                // Menu Slug
+ *     function() {$this->controller('sample');},          // Called function - typically controller() with the menu name
+ *     false,                                              // Icon URL
+ *     '92'                                                // Menu Position
+ * );
+ *
+ * // Add a sub-menu item
+ * add_submenu_page(
+ *     'glm-members-admin-menu-sample',                    // Parent slug
+ *     'Sample',                                           // Page title
+ *     'Sample',                                           // Menu Title
+ *     'glm_members_edit',                                 // Capability required
+ *     'glm-members-admin-menu-sample',                    // Menu slug
+ *     function() {$this->controller('sample');}
+ * );
+ *
+ * If creating a main menu item with add_menu_page(), please document
+ * that structure here.
+ *
+ * NOTE: The menu slug is the link for the page. It is also parsed by
+ * the controller and used to find the model to load. The
+ * "glm-members-admin-menu-" portion should not change, the last
+ * segment is the model directory name. By default the "index.php" file
+ * in that directory is executed. If the URL includes a "glm_action"
+ * parameter, then the model file called is in the same directory but
+ * is named the same as the "glm_action" parameter.
+ *
+ */
+ if (isset($this->config['loggedInUser']) && isset($this->config['loggedInUser']['contactUser']) && $this->config['loggedInUser']['contactUser']) {
+    add_submenu_page(
+        $mainMenuSlug,
+        'For Sale',
+        'For Sale',
+        'glm_members_edit_my_entity',
+        'glm-members-admin-menu-for-sale-index',
+        function(){$this->controller('forSale');}
+    );
+} else {
+    add_submenu_page(
+        'glm-members-admin-menu-members',
+        'For Sale',
+        'For Sale',
+        'edit_posts',
+        'glm-members-admin-menu-for-sale-index',
+        function(){$this->controller('forSale');}
+    );
+}
diff --git a/setup/adminTabs.php b/setup/adminTabs.php
new file mode 100644 (file)
index 0000000..d3d0d5c
--- /dev/null
@@ -0,0 +1,35 @@
+<?php
+/**
+ * GLM Members Database Buy Sell
+ * GLM Members DB - Buy Sell - Admin Tabs
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * To add a new tab to an existing Member DB page use a block
+ * like this and replace the {} parameters.
+ *
+ * add_filter('glm-member-db-add-tab-for-{menu name}',
+ *     function($addOnTabs) {
+ *         $newTabs = array(
+ *             array(
+ *                 'text' => '{text for display on tab}',
+ *                 'menu' => '{menu name}',
+ *                 'action' => '{action to perform}'
+ *             )
+ *         );
+ *         $addOnTabs = array_merge($addOnTabs, $newTabs);
+ *         return $addOnTabs;
+ *     }
+ * );
+ *
+
+} */
\ No newline at end of file
diff --git a/setup/databaseScripts/create_database_V0.0.1.sql b/setup/databaseScripts/create_database_V0.0.1.sql
new file mode 100644 (file)
index 0000000..fd297ce
--- /dev/null
@@ -0,0 +1,46 @@
+-- Gaslight Media Members Database - For Sale
+-- File Created: 12/02/15 15:27:15
+-- Database Version: 0.0.1
+-- Database Creation Script
+--
+-- This file is called to create a new set of tables for this
+-- add-on for the most receint database version for this add-on.
+--
+-- There should only be one such file in this directory
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+-- Conditions Table
+CREATE TABLE {prefix}items (
+    id INT NOT NULL AUTO_INCREMENT,
+    topic int NULL ,
+    title TEXT NULL ,
+    company TINYTEXT NULL ,
+    location TEXT NULL ,
+    descr TEXT NULL ,
+    contact_email TINYTEXT NULL ,
+    contact_name TINYTEXT NULL ,
+    contact_phone TINYTEXT NULL ,
+    post_date DATETIME NULL DEFAULT NOW(),
+    visible BOOL NULL,
+    terms TEXT NULL,
+    post TEXT NULL,
+    item_expiration INT NULL,
+    image_1 TINYTEXT NULL ,
+    image_2 TINYTEXT NULL ,
+    image_3 TINYTEXT NULL ,
+    member INT NULL,
+    PRIMARY KEY (id)
+);
+
+----
+
+--  default entries in table
+INSERT INTO {prefix}items ( 
+id,title,descr,topic,contact_email,contact_name,contact_phone,post_date,visible, 
+terms,location,item_expiration,image_3,post,image_1,
+company,member,image_2
+) VALUES ( 1, "TITLE", "DESCR", 1, "CONTACT_EMAIL", "CONTACT_NAME", "CONTACT_PHONE", NOW(), true, "TERMS", "LOCATION", 60, "IMAGE_3.jpg", "POST", 
+"IMAGE_1.jpg", "COMPANY", 1, "IMAGE_2.jpg"
+);
\ No newline at end of file
diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php
new file mode 100644 (file)
index 0000000..373e2ef
--- /dev/null
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members Buy Sell DB Versions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  dbVersions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+
+/**********************************************************************
+ *  NOTE: THIS IS A BUY SELL FILE - DO NOT USE UNMODIFIED
+ *
+ *  Please change all references to conditions, Conditions, or CONDITIONS to a name
+ *  appropriate for your new Add-On.
+ *
+ *  This file lists all versions of the database tables for this add-on.
+ *  The last entry in the array below should be for the most recent
+ *  version and should match the "create_database_V..." file in this
+ *  directory.
+ *
+ *  NOTE: When first creating a new add-on with database tables, there
+ *  should only be one line in the array below and there should be no
+ *  "update_database..." files in this directory.
+ *
+ *  Remove this message before using this file in production!
+ **********************************************************************/
+
+
+$glmMembersForSaleDbVersions = array(
+    '0.0.1' => array('version' => '0.0.1', 'tables' => 1, 'date' => '09/15/2017'),
+);
diff --git a/setup/frontHooks.php b/setup/frontHooks.php
new file mode 100644 (file)
index 0000000..efafbb5
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * GLM Members Database Buy Sell
+ * Misc Hooks and Filters
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  frontHooks.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Place Misc Hooks and Filters here. If this file exists, it will be included
+ * by the add-on main plugin script.
+ *
+ * Note that filter and hook callback functions must be included in-line as shown below...
+ *
+ *  add_filter( 'filter_title', function( $parameter ) {
+ *     // Function code
+ *  });
+ *
+ *  *** Also note that parameters will be in the context of the main front controller constructor. ***
+ */
diff --git a/setup/hooksHelp.html b/setup/hooksHelp.html
new file mode 100644 (file)
index 0000000..bbe0e75
--- /dev/null
@@ -0,0 +1,16 @@
+<!-- Hooks Help for {descrName} with Example
+
+        <tr><th colspan="3" class="glm-notice"><p>Sample Add-On</p></th></tr>
+        
+        <tr><th colspan="3">User Permission Hooks</td></tr>
+        
+        <tr>
+            <td>some_hook_name</td>
+            <td>FILTER or ACTION</td>
+            <td></td>
+            <td>
+                What this hook does.
+            </td>
+        </tr>
+
+-->
\ No newline at end of file
diff --git a/setup/permissions.php b/setup/permissions.php
new file mode 100644 (file)
index 0000000..b814f09
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+/**
+ * {descrName
+ * Permissions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  permissions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+
+/*
+ * Below are permission checks for various specific things in this add-on and
+ * elsewhere in the Member DB main plugin and add-ons.
+ *
+ * Each location where a permission might be required has an apply_filters()
+ * hook with a tag name that includes the plugin or add-on name, the menu,
+ * the action, and a name for the specific thing that needs permissions.
+ *
+ * This can be included in code or in a Smarty template used in these plugins.
+ * For example, to check permissions for the main Members menu and it's "index"
+ * action to see if a member search is permitted, the template includes the
+ * following code...
+ *
+ * {if $membersList && apply_filters('glm_members_permit_admin_members_index_member_search', true)}
+ *      --- some template output ---
+ * {/if}
+ *
+ * In the case above, it's also checking to see if the members list even exists
+ * before checking the permissions. The default value of "true" in the hook ensures
+ * that the permission is granted if nothing has linked into the hook to say otherwise.
+ *
+ * Note that each add_filter() below first checks if the permission has already
+ * been retracted by prior hook. This requires all that are attached to the hook
+ * to permit the action.
+ *
+ * Of course any of these may test more than one capability if that's desired.
+ *
+ * Since we have capabilities that only exist if a particular add-on (such as Contacts)
+ * has been loaded and activated, it can be helpful to be able to test for a capability
+ * for the current user and permit some action if that capability doesn't exist. The
+ * main plugin therefore provides the following globally accessible function that will
+ * return true if the capability doesn't exist, otherwise it respects the capability.
+ *
+ *  glmMembersUserCan('glm_members_edit_any_member', $permit);
+ *
+ *  $permit is a boolean set before this function call for passing on permissions.
+*/
+add_filter('glm_members_permit_admin_members_for_sale',
+function($permit) {
+    return glmMembersUserCan('glm_members_edit_any_member', $permit);
+}
+);
+
+// Logged in member user may edit an event only for their own entity
+add_filter('glm_members_permit_admin_member_for_sale',
+function($permit) {
+    return glmMembersUserCan('glm_members_edit_my_member', $permit);
+}
+);
\ No newline at end of file
diff --git a/setup/rolesAndCapabilities.php b/setup/rolesAndCapabilities.php
new file mode 100644 (file)
index 0000000..085e17e
--- /dev/null
@@ -0,0 +1,19 @@
+<?php
+/**
+ * GLM Members Database Buy Sell
+ * Roles & Capabilities
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersBuySell
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  rolesAndPermissions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/**
+ * NOTE: This file is only included in the activate.php process.
+ *       It is not regularly used during operation.
+ */
diff --git a/setup/shortcodes.php b/setup/shortcodes.php
new file mode 100644 (file)
index 0000000..198c6f4
--- /dev/null
@@ -0,0 +1,114 @@
+<?php
+/**
+ * GLM Members Database Buy Sell
+ * Short Codes
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersForSale
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  shortcodes.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Array of short-code
+ *
+ * This array lists all of the short-codes available from the main
+ * member plugin and all add-ons that provide short-code features.
+ *
+ * This array is merged with the data from any registered add-ons
+ * providing short-code features. The plugin providing the short-code
+ * is designated in the 'plugin' elemeent.
+ *
+ * A shortcode is unique to a particular plugin. To provide additional
+ * data and features to a short-code, an add-on should use filters
+ * provided by the short-code to insert data into the template array,
+ * to insert additional format into the template, or to insert
+ * text directly into the completed template output.
+ *
+ * The "attributes" array is a list of available attributes for this
+ * shortcode and their default values. If a database table is provided,
+ * then the value for each attribute is a table column where we get
+ * the default value. If no table is provided, then the value for
+ * each attribute is the actual default value for that attribute.
+ * In the case that the data is taken from the database table, the
+ * "id" for the table entry where the data is stored is assumed to
+ * be 1.
+ *
+ * Note that if the value for a particular attribute is false, then
+ * it is not read from the database even if the table is specified
+ * but might be supplied at run-time as an attribute in the short-code.
+ * All attributes that might be specified in the shortcode must be
+ * listed in the 'attributes' array below. If an attribute is not
+ * specified here, it can't be read from the short-code.
+ *
+ * The following is an explanation of this array.
+ *
+ * array(
+ *      '{shortcode-slug} => array(
+ *          'plugin' => '{plugin (add-on) slug}',       // Identifies which plugin is providing the short-code
+ *          'menu' => '{menu name}',                    // Menu name in this context is simply where to find the action
+ *          'action' => '{shortcode action name},       // Action used to execute this shortcode
+ *          'table' => '{table prefix}{table name}',    // Database table where default attribute values are stored
+ *          'attributes' => array(                      // An array of all shortcode attributes (options)
+ *              '{attr name}' => '{field name}',        // Available attribute names and the database field names with the default value
+ *              ....
+ *          ),
+ *      ... additional short-codes
+ * )
+ *
+ * Shortcode descriptions sample
+ *
+ *      <tr>
+ *           <th>[glm-members-sample-shortcode]</th>
+ *           <td>&nbsp;</td>
+ *           <td width="50%">
+ *               Displays something related to this add-on.
+ *           </td>
+ *       </tr>
+ *       <tr>
+ *           <td>&nbsp;</td>
+ *           <th>type="{types}"</th>
+ *           <td>
+ *               The "type" attribute is used to select the type of data to be displayed.
+ *               Below is a list of available list types.
+ *               <p>
+ *                   <table width="100%">
+ *                       <tr><th colspan=3">List Types</th></tr>
+ *                       <tr><td>one</td><td>Type One</td></tr>
+ *                       <tr><td>two</td><td>Type Two</td></tr>
+ *                   </table>
+ *               </p>
+ *           </td>
+ *       </tr>
+ */
+
+ $glmMembersForSaleShortcodes = array(
+    'glm-members-for-sale-list' => array(
+        'plugin'     => GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG,
+        'menu'       => 'forSale',
+        'action'     => 'list',
+        'table'      => false,
+        'attributes' => array(
+            'id'         => false,
+            'member_only' => false
+        )
+    ),
+    'glm-members-for-sale-detail' => array(
+        'plugin'     => GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG,
+        'menu'       => 'forSale',
+        'action'     => 'detail',
+        'table'      => false,
+        'attributes' => array(
+            'id'         => false,
+            'member_only' => false
+        )
+    ),
+);
+
+
+$glmMembersForSaleShortcodesDescription = '';
+
diff --git a/setup/validActions.php b/setup/validActions.php
new file mode 100644 (file)
index 0000000..688ce03
--- /dev/null
@@ -0,0 +1,75 @@
+<?php
+/**
+ * GLM Members Database Buy Sell
+ * Valid Actions
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersForSale
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+/*
+ * Array of valid menu items and actions.
+ *
+ * The higher level elements are valid menu items. These correlate to
+ * actual menu or sub menu items that are hooks back to this controller
+ * class.
+ *
+ * The lower level items below each menu item are actions that may be specified
+ * by a "glmMembersAction" form field.
+ *
+ * The string after the action is the slug of the plugin where the model/view
+ * is to perform that action.
+ *
+ * This array is integrated into the valid actions array in the main GLM Member
+ * DB plugin when this plugin registers itself.
+ *
+ * EXAMPLE
+ *
+ * $glmMembersForSaleAddOnValidActions = array(
+ *     'adminActions' => array(
+ *         'members' => array(
+ *             'sample' => GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG,
+ *         ),
+ *         'sample' => array(
+ *             'index' => GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG,
+ *             'more' => GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG,
+ *         ),
+ *         'info' => array(
+ *             'index' => GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG
+ *         )
+ *     ),
+ *     'frontActions' => array(
+ *         'sample' => array(
+ *             'list' => GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG,
+ *             'detail' => GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG
+ *         )
+ *     )
+ * );
+ *
+ *
+ *
+ *
+ */
+
+
+ $glmMembersForSaleAddOnValidActions = array(
+    'adminActions' => array(
+        'forSale' => array( 
+            'index' => GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG,
+        ),
+    ),
+    'frontActions' => array(
+        'forSale' => array( 
+            'list' => GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG,
+            'detail'   => GLM_MEMBERS_FOR_SALE_PLUGIN_SLUG,
+        ),
+    )
+);
+
+?>
\ No newline at end of file
diff --git a/uninstall.php b/uninstall.php
new file mode 100644 (file)
index 0000000..ae78787
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+die('uninstall not configured - See plugin uninstall.php script!');
+
+/**
+ * GLM Members Database Buy Sell
+ * Uninstall Plugin
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersBuySell
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  admin.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Check that we're being called by WordPress.
+if (!defined('ABSPATH')) {
+    die("Please do not call this code directly!");
+}
+
+//if uninstall not called from WordPress exit
+if (!defined('WP_UNINSTALL_PLUGIN')) {
+    die("Sorry, uninstall must be called by WordPress!");
+}
diff --git a/views/admin/forSale/edit.html b/views/admin/forSale/edit.html
new file mode 100644 (file)
index 0000000..009af91
--- /dev/null
@@ -0,0 +1,237 @@
+{include file='admin/header.html'}
+
+{if ($option == 'add' || $haveItem)}
+    <a href="{$thisUrl}?page={$thisPage}&glm_action=index" class="button button-secondary glm-button glm-right">Return to items List</a>
+
+  {if $option == 'edit' || $option == 'update'}
+    <a id="deleteItemButton" class="button button-secondary glm-button glm-right">Delete this Item</a>
+    <h2>Edit Item Posting
+  {else}
+    <h2>Add New Item Posting
+  {/if}
+        &nbsp;&nbsp;&nbsp;
+        {if $itemUpdated}<span class="glm-notice glm-flash-updated">Item Updated</span>{/if}
+        {if $itemUpdateError}<span class="glm-error glm-flash-updated">Item Update Error</span>{/if}
+        {if $itemAdded}<span class="glm-notice glm-flash-updated">Item Added</span>{/if}
+        {if $itemAddError}<span class="glm-error glm-flash-updated">Item Add Error</span>{/if}
+    </h2>
+
+    {if $itemUpdateError || $itemAddError}
+      <h1 class="glm-error">NOTICE: Your Item has not yet been submitted.<br>Please select the tabs indicating a problem, correct the indicated fields and resubmit.</h1>
+    {else}
+    {/if}
+    <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+        <input type="hidden" name="glm_action" value="index">
+    {if $haveItem}
+        <input type="hidden" name="option" value="update">
+        <input type="hidden" name="item" value="{$item.fieldData.id}">
+    {else}
+        <input type="hidden" name="option" value="insert">
+    {/if}
+
+        <h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
+            <a id="glm-item-descr" data-show-table="glm-table-descr" class="glm-item-tab nav-tab nav-tab-active">Item Postings</a>
+        </h2>
+        <div class="glm-item-row glm-row">
+            <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+                Topic
+            </div>
+         
+            <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
+                <select id="topic" data-id="item-topic" name="topic">
+                    <option value="">Topic</option>
+                    {foreach $item.fieldData.topic.list as $topic}
+                        <option value="{$topic.value}" {if $item.fieldData.topic.value == {$topic.value}} selected="selected"{/if}>
+                        {$topic.name}
+                        </option>
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+        
+        <!-- ITEM TITLE -->
+        <div class="glm-item-row glm-row">
+            <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+                Item 
+            </div>
+            <div class="glm-small-12 glm-medium-8 glm-columns admin-item-input">
+                <input type="text" name="title" {if $item.fieldData.title} value='{$item.fieldData.title}' {/if}>
+            </div>
+        </div>
+        <!-- MEMBER for admins only-->
+        {if !$lockedToMember && $memberList}
+        <!-- <pre>{$item.fieldData|@print_r:true}</pre> -->
+        <div class="glm-item-row glm-row">
+            <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+                    Member
+            </div>
+            <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
+                <select id="member" data-id="member" name="member">
+                    <option value="">Select a Member</option>
+                    {foreach from=$memberList item=m}
+                        <option value="{$m.id}" {if $item.fieldData.member.value == {$m.id}} selected="selected"{/if}>
+                            {$m.name}
+                        </option>
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+        {else}
+        <!-- hidden MEMBER ID field here -->
+        <input type="hidden" name="member" value="{$item.fieldData.member.value}">
+        {/if}
+
+        <!-- COMPANY -->
+        <div class="glm-item-row glm-row">
+            <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+                   Company
+            </div>
+            <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
+                <input type="text" name="company" {if $item.fieldData.company} value='{$item.fieldData.company}' {/if}>
+            </div>
+        </div>
+        <!-- DESCRIPTION -->
+        <div class="glm-item-row glm-row">
+            <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+                   Description
+            </div>
+            <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
+                {php}
+                    wp_editor(
+                  
+                        '{$item.fieldData.descr|escape:quotes}', 
+              
+                    'descr', array(
+                        'media_buttons' => false,
+                        'tinymce'      => false,
+                        // 'quicktags' => false,
+                        // 'wpautop' => false,  NOTE: Dont's use. Problem when numerous spaces before text.
+                        'textarea_name' => 'descr',
+                        'editor_height' => 200,     // Height in px, overrides editor_rows
+                            // 'textarea_rows' => 8
+                    ));
+                {/php}
+            </div>
+        </div>
+       <!-- CONTACT NAME -->
+        <div class="glm-item-row glm-row">
+            <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+                    Contact Name
+            </div>
+            <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
+                <input type="text" name="contact_name" {if $item.fieldData.contact_name} value='{$item.fieldData.contact_name}' {/if}>
+            </div>
+        </div>
+       <!-- EMAIL TO -->
+        <div class="glm-item-row glm-row">
+            <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+                    Contact Email
+            </div>
+            <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
+                <input type="text" name="contact_email" {if $item.fieldData.contact_email} value='{$item.fieldData.contact_email}' {/if}>
+            </div>
+        </div>
+       <!-- CONTACT PHONE -->
+        <div class="glm-item-row glm-row">
+            <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+                    Contact Phone
+            </div>
+            <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
+                <input type="text" name="contact_phone" {if $item.fieldData.contact_phone} value='{$item.fieldData.contact_phone}' {/if}>
+            </div>
+        </div>
+        <br>
+        {include file='admin/forSale/parts/image_input.html'}
+        <br>
+       <!-- VISIBLE -->
+        <div class="glm-item-row glm-row">
+            <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+                    Visible
+            </div>
+            <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
+                    <input id="item-visible" data-id="item-visible" type="checkbox" name="visible" class="visible-checkbox" {if $item.fieldData.visible.value} checked{/if}>
+            </div>
+        </div>
+        <!-- ITEM EXPIRATION-->
+        <div class="glm-item-row glm-row">
+            <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+                Item Expiration    
+            </div>
+            <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
+                <select id="item_expiration" data-id="item_expiration" name="item_expiration">
+                    <option value="">Number of Days</option>
+                    {foreach $item.fieldData.item_expiration.list as $exp}
+                        {if 'fieldData'|array_key_exists:$item}
+                                <option value="{$exp.value}" {if $item.fieldData.item_expiration.value == {$exp.value}} selected="selected"{/if}>
+                            {else if}
+                                <option value="{$exp.value}">
+                            {/if}
+                            {$exp.name}
+                        </option>
+                    {/foreach}
+                </select>
+            </div>
+        </div>
+        
+        
+        <input id="updateItem" type="submit" value="{if $haveItem}Update Item{else}Save New Item{/if}">
+    </form>
+
+{else} <!-- Can just display -->
+
+    <h3>Sorry, no Item found or permission not granted.</h3>
+
+{/if}
+
+    <!-- Delete Item Dialog Box -->
+
+    <div id="deleteItemDialog" class="glm-dialog-box" title="Delete Item">
+        <center>
+            <p><a id="deleteItemCancel" class="button button-primary">Cancel</a></p>
+            <p><input id="deleteitemubmit" type="submit" value="Delete this Item"></p>
+        </center>
+        <div class="glm-item-container">
+            <p><center><span class="glm-error">WARNING:</span></center></p>
+            <p>
+                <span class="glm-warning">Clicking the "Delete this Item" button above will
+                delete all of the data and images associated with this Item.
+                </span>
+            </p>
+            <p>
+                <span class="glm-error">
+                    Once deleted, this information will no longer be available and cannot be retrieved!
+                    If you are unsure that you want to completely remove this data, consider changing the status
+                    of this Item to "Archived" instead.
+                </span>
+            </p>
+        </div>
+    </div>
+    <script type="text/javascript">
+        jQuery(document).ready(function($) {
+
+        {if $haveItem}
+            // Delete Item dialog
+            $("#deleteItemDialog").dialog({
+                autoOpen: false,
+                minWidth: 400,
+                dialogClass: "glm-dialog-no-close"
+            });
+            $('#deleteItemButton').click( function() {
+                $('#deleteItemDialog').dialog('open');
+            });
+            $('#deleteItemCancel').click( function() {
+                $("#deleteItemDialog").dialog("close");
+            });
+            $('#deleteitemubmit').click( function() {
+                window.location.replace("{$thisUrl}?page={$thisPage}&glm_action=index&option=delete&item={$item.fieldData.id}");
+            });
+        {/if}
+            
+            // 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);
+
+        });
+    </script>
+
+
+{include file='admin/footer.html'}
diff --git a/views/admin/forSale/list.html b/views/admin/forSale/list.html
new file mode 100644 (file)
index 0000000..1c683ef
--- /dev/null
@@ -0,0 +1,44 @@
+{include file='admin/header.html'}
+{if $haveMember}
+<input type="hidden" name="member" value="{$memberID}">
+{if !$lockedToMember}
+<input type="hidden" name="glm_action" value="item">
+{/if}
+<input type="hidden" name="option" value="list">
+{/if}
+    {if $itemData}
+        <div class="admin-new-item">
+            <a class="admin-new-item-link" href="{$thisUrl}?page={$thisPage}&glm_action=index&option=add">New item</a>
+        </div>
+        <div class="admin-item-list-header glm-row">
+            <div class="item-title-list-header glm-small-12 glm-medium-4 glm-large-3 glm-columns no-padding">Topic</div>
+            <div class="item-company-list-header glm-small-12 glm-medium-4 glm-large-3 glm-columns no-padding">Forsale Item</div>
+            <div class="item-date-list-header glm-small-12 glm-medium-4 glm-large-3 glm-columns no-padding">Item Post Date</div>
+            <div class="item-date-list-header glm-small-12 glm-medium-4 glm-large-3 glm-columns no-padding">Post For</div>
+        </div>
+       
+        {foreach $itemData as $item=>$data}
+            <div class='glm-row admin-item-list-row'>
+                <div class="glm-small-12 glm-columns admin-item-list">
+                    <div class="glm-row admin-item-data">
+                        <div class="item-title-list glm-small-12 glm-large-3 glm-columns no-padding">{$data.topic.name}</div>
+                        <div class="item-company-list glm-small-12 glm-large-3 glm-columns no-padding">{$data.title}</div>
+                        <div class="item-date-list glm-small-12 glm-large-3 glm-columns no-padding">{$data.post_date.timestamp|date_format:"%Y-%m-%d"}</div>
+                        <div class="item-date-list glm-small-12 glm-large-3 glm-columns no-padding">{$data.item_expiration.name}</div>
+                    </div>
+                </div>
+                <div class="glm-small-12 glm-columns admin-item-list">
+                    <a href="{$thisUrl}?page={$thisPage}&glm_action=index&option=edit&item={$data.id}">Edit</a>
+                    <a href="{$thisUrl}?page={$thisPage}&glm_action=index&option=delete&item={$data.id}">Delete</a>
+                </div>
+            </div>
+        {/foreach}
+        <script>
+            jQuery(document).ready(function($) {
+              
+            });
+        </script>
+    {else if}
+        <div class="no-item-data"> No Items</div>
+    {/if}
+{include file='admin/footer.html'}
\ No newline at end of file
diff --git a/views/admin/forSale/parts/image_input.html b/views/admin/forSale/parts/image_input.html
new file mode 100644 (file)
index 0000000..26fbffd
--- /dev/null
@@ -0,0 +1,42 @@
+<div class="glm-item-row glm-row item-image-row">
+    <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+        Image 1: 
+    </div>
+    <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
+        {if $item.fieldData.image_1}
+            <img class="item-image" src="{$glmPluginMediaUrl}/images/small/{$item.fieldData.image_1}">
+        {/if}
+        <b>New image:</b> <input type="file" name="image_1_new">
+        <div>
+            <input type="checkbox" name="image_1_delete"> Delete Image<br>
+        </div>
+    </div>
+</div>
+<div class="glm-item-row glm-row item-image-row">
+    <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label">
+        Image 2: 
+    </div>
+    <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
+        {if $item.fieldData.image_2}
+            <img class="item-image" src="{$glmPluginMediaUrl}/images/small/{$item.fieldData.image_2}">
+        {/if}
+        <b>New image:</b> <input type="file" name="image_2_new">
+        <div>
+            <input type="checkbox" name="image_2_delete"> Delete Image<br>
+        </div>
+    </div>
+</div>
+<div class="glm-item-row glm-row item-image-row">
+    <div class="glm-small-12 glm-medium-2 glm-columns admin-item-label ">
+        Image 3: 
+    </div>
+    <div class="glm-small-12 glm-medium-5 glm-columns admin-item-input">
+        {if $item.fieldData.image_3}
+            <img class="item-image" src="{$glmPluginMediaUrl}/images/small/{$item.fieldData.image_3}">
+        {/if}
+        <b>New image:</b> <input type="file" name="image_3_new">
+        <div>
+            <input type="checkbox" name="image_3_delete"> Delete Image<br>
+        </div>
+    </div>
+</div>
\ No newline at end of file
diff --git a/views/admin/header.html b/views/admin/header.html
new file mode 100644 (file)
index 0000000..69d6081
--- /dev/null
@@ -0,0 +1,8 @@
+<div class="wrap">
+    <h2>Items</h2>
+    <h2 class="nav-tab-wrapper">
+        <a href="{$thisUrl}?page={$thisPage}&glm_action=index" class="nav-tab{if $thisAction==index} nav-tab-active{/if}">Dashboard</a>
+    </h2>
+    <div id="glm-admin-content-container">
+
+
diff --git a/views/admin/readme.txt b/views/admin/readme.txt
new file mode 100644 (file)
index 0000000..5a9d7ea
--- /dev/null
@@ -0,0 +1,5 @@
+The admin controller uses views (templates) under this directory to generate final output.
+
+Typically you should add a directory here that matches the page where the view is used.
+
+Under that directory place the view (template) for the various actions.
\ No newline at end of file
diff --git a/views/front/forSale/detail.html b/views/front/forSale/detail.html
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/views/front/forSale/list.html b/views/front/forSale/list.html
new file mode 100644 (file)
index 0000000..2bd0717
--- /dev/null
@@ -0,0 +1,48 @@
+
+<div class="front-item-list-wrapper">
+    {if !empty($itemData)}
+        {foreach $itemData as $item=>$data}
+            <div class="front-list-item glm-row">
+                <!-- <pre>{$data|@print_r}</pre> -->
+                <div class="glm-small-12 glm-medium-9 glm-columns no-padding">
+                    <div class="glm-small-12 glm-columns front-item-title no-padding">
+                        
+                        <span>{$data.title}</span>
+                    </div>
+                    <div class="glm-small-12 glm-columns front-item-company no-padding">
+                        <span>Company: </span>
+                        {$data.company}
+                    </div>
+                    <div class="glm-small-12 glm-columns front-item-description no-padding">
+                        <span>Description: </span>
+                        {$data.descr}
+                    </div>
+                    <div class="glm-small-12 glm-columns front-item-name no-padding">
+                        <span>Contact: </span>
+                        {$data.contact_name}
+                    </div>
+                    <div class="glm-small-12 glm-columns front-item-phone no-padding">
+                        <span>Contact Phone: </span>
+                        {$data.contact_phone}
+                    </div>
+                    <div class="glm-small-12 glm-columns front-item-email no-padding">
+                        <a href="mailto:{$data.contact_email}">{$data.contact_email}</a>
+                    </div>
+                </div>
+                <div class="glm-small-12 glm-medium-3 glm-columns">
+                    {if $data.topic.value == 1}
+                    <div class="front-list-topic item-wanted">Wanted</div>
+                    {else}
+                    <div class="front-list-topic item-sale">For Sale</div>
+                    {/if}
+                    {if $data.image_1}
+                        <img src="{$glmPluginMediaUrl}/images/small/{$data.image_1}" alt=""> 
+                    {/if}
+                    <a href="{$siteBaseUrl}for-sale-detail/?item={$data.id}">Item Details</a> 
+                </div>
+            </div>
+        {/foreach}
+    {else}
+        No Items Found
+    {/if}
+</div>
\ No newline at end of file
diff --git a/views/front/readme.txt b/views/front/readme.txt
new file mode 100644 (file)
index 0000000..1138d90
--- /dev/null
@@ -0,0 +1,7 @@
+The front controller uses views (templates) under this directory to generate final output.
+
+Typically you should add a directory here that matches the category of actions that will use these views.
+
+Under that directory place the view (template) for the various actions.
+
+Views under this directory would normally be called due to processing of a shortcode.
\ No newline at end of file