Save management settings. Payment Gateway settings.
authorSteve Sutton <steve@gaslightmedia.com>
Tue, 12 Dec 2017 20:33:28 +0000 (15:33 -0500)
committerSteve Sutton <steve@gaslightmedia.com>
Tue, 12 Dec 2017 20:33:28 +0000 (15:33 -0500)
Saving the gateway and payment options for billing into the management
db table.

classes/data/dataManagement.php [new file with mode: 0644]
models/admin/management/billing.php [new file with mode: 0644]
setup/adminTabs.php
setup/databaseScripts/create_database_V0.0.3.sql
setup/databaseScripts/update_database_V0.0.3.sql
views/admin/management/billing.html [new file with mode: 0644]
views/admin/management/footer.html [new file with mode: 0644]

diff --git a/classes/data/dataManagement.php b/classes/data/dataManagement.php
new file mode 100644 (file)
index 0000000..d930f0a
--- /dev/null
@@ -0,0 +1,227 @@
+<?php
+/**
+ * GLM Member-DB WordPress Add-On Plugin
+ * Billing Management data class
+ *
+ * PHP version 5.3
+ *
+ * @category Data
+ * @package  GLM Member-DB
+ * @author   Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  SVN: $Id: dataManagement.php,v 1.0 2011/01/25 19:31:47 cscott Exp $
+ */
+
+/**
+ * GlmDataBillingManagement 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: dataManagement.php,v 1.0 2011/01/25 19:31:47 cscott
+ *          Exp $
+ */
+class GlmDataBillingManagement 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_BILLING_PLUGIN_DB_PREFIX . 'management';
+
+        /*
+         * Table Data Fields
+         */
+
+        $this->fields = array (
+
+            'id' => array (
+                'field' => 'id',
+                'type' => 'integer',
+                'view_only' => true,
+                'use' => 'a'
+            ),
+
+            // Payment Methods Selected - Bitmap
+            'payment_methods' => array (
+                'field' => 'payment_methods',
+                'type'     => 'bitmap',
+                'bitmap'    => $this->config['payment_method'],
+                'default'  => 0, // none selected
+                'use'      => 'a'
+            ),
+
+            // Processing Methods Selected - Bitmap
+            'proc_methods' => array (
+                'field'    => 'proc_methods',
+                'type'     => 'list',
+                'list'     => $this->config['proc_method'],
+                'default'  => $this->config['proc_method_numb']['Merchant'],
+                'use'      => 'a'
+            ),
+
+            // Credit Cards Accepted Selected - Bitmap
+            'cc_accepts' => array (
+                'field' => 'cc_accepts',
+                'type'     => 'bitmap',
+                'bitmap'    => $this->config['credit_card'],
+                'default'  => 0, // none selected
+                'use'      => 'a'
+            ),
+
+            // Authorize.net Login
+            'authorize_net_login' => array (
+                'field' => 'authorize_net_login',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+
+            // Authorize.net Key
+            'authorize_net_key' => array (
+                'field' => 'authorize_net_key',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+
+            // Authorize.net Test Mode
+            'authorize_net_test' => array (
+                'field' => 'authorize_net_test',
+                'type' => 'list',
+                'list' => $this->config['proc_test_mode'],
+                'default' => $this->config['proc_test_mode_numb']['Local Approval Test'],
+                'use' => 'a'
+            ),
+
+            // Always Use Full Billing Info
+            'authorize_net_conf' => array (
+                'field' => 'authorize_net_conf',
+                'type' => 'checkbox',
+                'use' => 'a',
+                'default'  => 0,
+            ),
+
+            // Authorize.net Merchant Email
+            'authorize_net_merchant_email' => array (
+                'field' => 'authorize_net_merchant_email',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+
+            // Merchant Solutions Account ID
+            'merchant_solutions_acctid' => array (
+                'field' => 'merchant_solutions_acctid',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+
+            // Merchant Solutions Merchant PIN
+            'merchant_solutions_merchantpin' => array (
+                'field' => 'merchant_solutions_merchantpin',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+
+            // Merchant Solutions Test Mode
+            'merchant_solutions_test' => array (
+                'field' => 'merchant_solutions_test',
+                'type' => 'list',
+                'list' => $this->config['proc_test_mode'],
+                'default' => $this->config['proc_test_mode_numb']['Local Approval Test'],
+                'use' => 'a'
+            ),
+
+            // Always Use Full Billing Info
+            'merchant_solutions_conf' => array (
+                'field' => 'merchant_solutions_conf',
+                'type' => 'checkbox',
+                'use' => 'a',
+                'default'  => 0,
+            ),
+
+            // Merchant Email
+            'merchant_solutions_merchant_email' => array (
+                'field' => 'merchant_solutions_merchant_email',
+                'type' => 'text',
+                'use' => 'a'
+            ),
+
+        );
+
+    }
+
+}
+
+?>
diff --git a/models/admin/management/billing.php b/models/admin/management/billing.php
new file mode 100644 (file)
index 0000000..9456246
--- /dev/null
@@ -0,0 +1,206 @@
+<?php
+/**
+ * Gaslight Media Members Database
+ * GLM Members DB - Billing Add-on - Management Billing Tab
+ *
+ * PHP version 5.5
+ *
+ * @category glmWordPressPlugin
+ * @package  glmMembersDatabase
+ * @author     Chuck Scott <cscott@gaslightmedia.com>
+ * @license  http://www.gaslightmedia.com Gaslightmedia
+ * @release  billing.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
+ * @link     http://dev.gaslightmedia.com/
+ */
+
+// Load Management Billing data abstract
+require_once GLM_MEMBERS_BILLING_PLUGIN_CLASS_PATH.'/data/dataManagement.php';
+
+/**
+ * GlmMembersAdmin_management_billing
+ *
+ * PHP version 5
+ *
+ * @category Model
+ * @package GLM Member DB
+ * @author    Chuck Scott <cscott@gaslightmedia.com>
+ * @license http://www.gaslightmedia.com Gaslightmedia
+ *            @release SVN: $Id: packaging.php,v 1.0 2011/01/25 19:31:47 cscott
+ *            Exp $
+ */
+class GlmMembersAdmin_management_billing extends GlmDataBillingManagement
+{
+
+    /**
+     * WordPress Database Object
+     *
+     * @var $wpdb
+     * @access public
+     */
+    public $wpdb;
+    /**
+     * dbh Postgres database connection
+     *
+     * @var mixed
+     * @access public
+     */
+    public $config;
+    /**
+     * settings used for the schema and tablenames
+     *
+     * @var mixed
+     * @access public
+     */
+//    public $settings = array();
+//    /**
+//     * billing
+//     *
+//     * @var bool
+//     * @access public
+//     */
+//    public $billing = array();
+
+    /**
+     * Constructor
+     *
+     * This contructor performs the work for this model. This model returns
+     * an array containing the following.
+     *
+     * 'status'
+     *
+     * True if successfull and false if there was a fatal failure.
+     *
+     * 'view'
+     *
+     * A suggested view name that the contoller should use instead of the
+     * default view for this model or false to indicate that the default view
+     * should be used.
+     *
+     * 'data'
+     *
+     * Data that the model is returning for use in merging with the view to
+     * produce output.
+     *
+     * @wpdb object WordPress database object
+     *
+     * @return array Array containing status, suggested view, and any data
+     */
+    public function __construct ($wpdb, $config)
+    {
+
+        // Save WordPress Database object
+        $this->wpdb = $wpdb;
+
+        // Save plugin configuration object
+        $this->config = $config;
+
+        // Run constructor for members data class
+        parent::__construct(false, false);
+
+    }
+
+    /**
+     * modelAction
+     *
+     * @param bool $actionData
+     * @access public
+     * @return void
+     */
+    public function modelAction($actionData = false)
+    {
+
+        $option              = false;
+        $settingsUpdated     = false;
+        $settingsUpdateError = false;
+        $regSettings         = false;
+
+        // General settings are always stored in a record with ID=1.
+        $id = 1;
+
+        // Determine if current user can edit configurations
+        if (!current_user_can('glm_members_management')) {
+            return array(
+                'status'           => false,
+                'menuItemRedirect' => 'error',
+                'modelRedirect'    => 'index',
+                'view'             => 'admin/error/index.html',
+                'data'             => array(
+                    'reason' => 'User does not have rights to make configuration changes.'
+                )
+            );
+        }
+
+        // Check for submission option
+        $option = '';
+        if (isset($_REQUEST['option']) && $_REQUEST['option'] == 'submit') {
+            $option = $_REQUEST['option'];
+        }
+
+        switch( $option ) {
+
+            // Update the settings and redisplay the form
+            case 'submit':
+
+                // Update the general settings
+                $regSettings = $this->updateEntry( $id );
+
+                // Check if we were successful
+                if ($regSettings['status']) {
+
+                    $settingsUpdated = true;
+                    $regSettings = $this->editEntry( $id );
+
+                } else {
+                    $settingsUpdateError = true;
+                }
+
+                break;
+
+            // Default is to get the current settings and display the form
+            default:
+
+                // Try to get the first (should be only) entry for general settings.
+                $regSettings = $this->editEntry( $id );
+
+                // Check if we didn't get the settings
+                if ($regSettings === false) {
+
+                    $errorMsg = "Unable to load the Billing management settings";
+
+                    trigger_error($errorMsg, E_USER_NOTICE);
+
+                    return array(
+                        'status'           => false,
+                        'menuItemRedirect' => 'error',
+                        'modelRedirect'    => 'index',
+                        'view'             => 'admin/error/index.html',
+                        'data'             => array(
+                            'reason' => $errorMsg
+                        )
+                    );
+                }
+
+                break;
+
+        }
+
+        // Compile template data
+        $template_data = array(
+            'regSettings'         => $regSettings,
+            'settingsUpdated'     => $settingsUpdated,
+            'settingsUpdateError' => $settingsUpdateError
+        );
+
+        // echo "<pre>" . print_r($regSettings, true) . "</pre>";
+
+        // Return status, suggested view, and data to controller
+        return array(
+            'status'           => true,
+            'menuItemRedirect' => false,
+            'modelRedirect'    => false,
+            'view'             => 'admin/management/billing.html',
+            'data'             => $template_data
+        );
+    }
+}
+?>
index 261a5cc..a90ccdb 100644 (file)
  *
  */
 if ( current_user_can( 'glm_members_members' ) ) {
+
+    add_filter('glm-member-db-add-tab-for-management',
+        function($addOnTabs) {
+            $newTabs = array(
+                array(
+                    'text'   => 'Billing',
+                    'menu'   => 'management',
+                    'action' => 'billing'
+                )
+            );
+            $addOnTabs = array_merge($addOnTabs, $newTabs);
+            return $addOnTabs;
+        }
+    );
+
     add_filter( 'glm-member-db-add-tab-for-settings',
         function( $addOnTabs ) {
             $newTabs = array(
index 914094e..95dc181 100644 (file)
@@ -181,21 +181,21 @@ INSERT INTO {prefix}settings
 -- Management
 CREATE TABLE {prefix}management (
     id INT NOT NULL AUTO_INCREMENT,
-    reg_payment_methods SMALLINT NULL,                              -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini
-    reg_proc_methods SMALLINT NULL,                                 -- Creadit Cart payment processing methods available - Bitmap - see proc_method in plugin.ini
-    reg_cc_accepts SMALLINT NULL,                                   -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini
+    payment_methods SMALLINT NULL,                              -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini
+    proc_methods SMALLINT NULL,                                 -- Creadit Cart payment processing methods available - Bitmap - see proc_method in plugin.ini
+    cc_accepts SMALLINT NULL,                                   -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini
     -- Authorize.net Credentials
-    reg_authorize_net_login TINYTEXT NULL,
-    reg_authorize_net_key TINYTEXT NULL,
-    reg_authorize_net_test TINYINT NULL,                            -- Authorize.net test mode - List - see proc_test_mode in plugin.ini
-    reg_authorize_net_conf BOOLEAN NULL,                            -- Flag to send payment confirmation Email from Authorize.net
-    reg_authorize_net_merchant_email TINYTEXT NULL,                 -- E-Mail Authorize.net will send copy of confirmation E-Mail
+    authorize_net_login TINYTEXT NULL,
+    authorize_net_key TINYTEXT NULL,
+    authorize_net_test TINYINT NULL,                            -- Authorize.net test mode - List - see proc_test_mode in plugin.ini
+    authorize_net_conf BOOLEAN NULL,                            -- Flag to send payment confirmation Email from Authorize.net
+    authorize_net_merchant_email TINYTEXT NULL,                 -- E-Mail Authorize.net will send copy of confirmation E-Mail
     -- Merchant Solutions Credentials
-    reg_merchant_solutions_acctid TINYTEXT NULL,                    -- Merchant Solutions credentials
-    reg_merchant_solutions_merchantpin TINYTEXT NULL,
-    reg_merchant_solutions_test TINYINT NULL,                       -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini
-    reg_merchant_solutions_conf BOOLEAN NULL,                       -- Flag to send payment confirmation Email
-    reg_merchant_solutions_merchant_email TINYTEXT NULL,            -- Merchant Solutions will send copy of confirmation E-Mail
+    merchant_solutions_acctid TINYTEXT NULL,                    -- Merchant Solutions credentials
+    merchant_solutions_merchantpin TINYTEXT NULL,
+    merchant_solutions_test TINYINT NULL,                       -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini
+    merchant_solutions_conf BOOLEAN NULL,                       -- Flag to send payment confirmation Email
+    merchant_solutions_merchant_email TINYTEXT NULL,            -- Merchant Solutions will send copy of confirmation E-Mail
     PRIMARY KEY (id)
 );
 
index afc68e9..98f6dc9 100644 (file)
@@ -8,21 +8,21 @@
 -- Management
 CREATE TABLE {prefix}management (
     id INT NOT NULL AUTO_INCREMENT,
-    reg_payment_methods SMALLINT NULL,                              -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini
-    reg_proc_methods SMALLINT NULL,                                 -- Creadit Cart payment processing methods available - Bitmap - see proc_method in plugin.ini
-    reg_cc_accepts SMALLINT NULL,                                   -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini
+    payment_methods SMALLINT NULL,                              -- Payment methods available for all registrations - Bitmap - see payment_method in plugin.ini
+    proc_methods SMALLINT NULL,                                 -- Creadit Cart payment processing methods available - Bitmap - see proc_method in plugin.ini
+    cc_accepts SMALLINT NULL,                                   -- Credit Cards Accepted - Bitmap - See credit_card in plugin.ini
     -- Authorize.net Credentials
-    reg_authorize_net_login TINYTEXT NULL,
-    reg_authorize_net_key TINYTEXT NULL,
-    reg_authorize_net_test TINYINT NULL,                            -- Authorize.net test mode - List - see proc_test_mode in plugin.ini
-    reg_authorize_net_conf BOOLEAN NULL,                            -- Flag to send payment confirmation Email from Authorize.net
-    reg_authorize_net_merchant_email TINYTEXT NULL,                 -- E-Mail Authorize.net will send copy of confirmation E-Mail
+    authorize_net_login TINYTEXT NULL,
+    authorize_net_key TINYTEXT NULL,
+    authorize_net_test TINYINT NULL,                            -- Authorize.net test mode - List - see proc_test_mode in plugin.ini
+    authorize_net_conf BOOLEAN NULL,                            -- Flag to send payment confirmation Email from Authorize.net
+    authorize_net_merchant_email TINYTEXT NULL,                 -- E-Mail Authorize.net will send copy of confirmation E-Mail
     -- Merchant Solutions Credentials
-    reg_merchant_solutions_acctid TINYTEXT NULL,                    -- Merchant Solutions credentials
-    reg_merchant_solutions_merchantpin TINYTEXT NULL,
-    reg_merchant_solutions_test TINYINT NULL,                       -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini
-    reg_merchant_solutions_conf BOOLEAN NULL,                       -- Flag to send payment confirmation Email
-    reg_merchant_solutions_merchant_email TINYTEXT NULL,            -- Merchant Solutions will send copy of confirmation E-Mail
+    merchant_solutions_acctid TINYTEXT NULL,                    -- Merchant Solutions credentials
+    merchant_solutions_merchantpin TINYTEXT NULL,
+    merchant_solutions_test TINYINT NULL,                       -- Merchant Solutions test mode - List - see proc_test_mode in plugin.ini
+    merchant_solutions_conf BOOLEAN NULL,                       -- Flag to send payment confirmation Email
+    merchant_solutions_merchant_email TINYTEXT NULL,            -- Merchant Solutions will send copy of confirmation E-Mail
     PRIMARY KEY (id)
 );
 
diff --git a/views/admin/management/billing.html b/views/admin/management/billing.html
new file mode 100644 (file)
index 0000000..aaf240b
--- /dev/null
@@ -0,0 +1,191 @@
+{include file='admin/management/header.html'}
+
+<h2 class="nav-tab-wrapper" style="margin-bottom: 1em;">
+    <a href="{$thisUrl}?page=glm-members-admin-menu-management&glm_action=billing" class="glm-settings-tab nav-tab nav-tab-active">General Settings</a>
+</h2>
+
+<table class="glm-admin-table glm-settings-table">
+    <tr>
+        <td colspan="2">
+            {if $settingsUpdated}<h2 class="glm-notice glm-flash-updated glm-right">Settings Updated</h2>{/if}
+            {if $settingsUpdateError}<span class="glm-error glm-flash-updated glm-right">Settings Update Error</span>{/if}
+            <h3>Management Settings</h3>
+        </td>
+    </tr>
+    <tr>
+        <td>
+            <form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
+                <input type="hidden" name="glm_action" value="billing">
+                <input type="hidden" name="option" value="submit">
+
+                <table>
+
+                    <tr>
+                        <td></td>
+                        <th><p>Payment</p></th>
+                    </tr>
+                    <tr>
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.payment_methods} glm­-required{/if}">Payment Methods:</th>
+                        <td {if $regSettings.fieldFail.payment_methods}class="glm­form­bad­input" data­tabid="glm-reg-payment-methods"{/if}>
+                      {foreach from=$regSettings.fieldData.payment_methods.bitmap item=v}
+                            <input type="checkbox" name="payment_methods[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}>{$v.name}<br>
+                      {/foreach}
+                            {if $regSettings.fieldFail.payment_methods}<p>{$regSettings.fieldFail.payment_methods}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr>
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.cc_accepts} glm­-required{/if}">Credit Card Accepted:</th>
+                        <td {if $regSettings.fieldFail.cc_accepts}class="glm­form­bad­input" data­tabid="glm-reg-cc-accepts"{/if}>
+                      {foreach from=$regSettings.fieldData.cc_accepts.bitmap item=v}
+                            <input type="checkbox" name="cc_accepts[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}>{$v.name}<br>
+                      {/foreach}
+                            {if $regSettings.fieldFail.cc_accepts}<p>{$regSettings.fieldFail.cc_accepts}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr>
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.proc_methods} glm­-required{/if}">Credit Card Processor:</th>
+                        <td>
+                            <select id="proc_methods" data-id="proc_methods" name="proc_methods">
+                                <option value=""></option>
+                                {foreach from=$regSettings.fieldData.proc_methods.list item=v}
+                                <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
+                                    {$v.name}
+                                </option>
+                                {/foreach}
+                            </select>
+                        </td>
+                    </tr>
+                    <tr class="authorize-net">
+                        <td></td>
+                        <th><p>Authorize.net</p></th>
+                    </tr>
+                    <tr class="authorize-net">
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.authorize_net_login} glm-required{/if}">Login:</th>
+                        <td {if $regSettings.fieldFail.authorize_net_login}class="glm-form-bad-input"{/if}>
+                            <input type="text" name="authorize_net_login" value="{$regSettings.fieldData.authorize_net_login}" class="glm-form-text-input-medium">
+                            {if $regSettings.fieldFail.authorize_net_login}<p>{$regSettings.fieldFail.authorize_net_login}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr class="authorize-net">
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.authorize_net_key} glm-required{/if}">Key:</th>
+                        <td {if $regSettings.fieldFail.authorize_net_key}class="glm-form-bad-input"{/if}>
+                            <input type="text" name="authorize_net_key" value="{$regSettings.fieldData.authorize_net_key}" class="glm-form-text-input-medium">
+                            {if $regSettings.fieldFail.authorize_net_key}<p>{$regSettings.fieldFail.authorize_net_key}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr class="authorize-net">
+                        <th>Test Mode:</th>
+                        <td>
+                            <select id="default-authorize-net-test" data-id="authorize_net_test" name="authorize_net_test">
+                                <option value=""></option>
+                                {foreach from=$regSettings.fieldData.authorize_net_test.list item=v}
+                                <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
+                                    {$v.name}
+                                </option>
+                                {/foreach}
+                            </select>
+                        </td>
+                    </tr>
+                    <tr class="authorize-net">
+                        <th>Send Confirmation E-Mail</th>
+                        <td>
+                            <input type="checkbox" name="authorize_net_conf"{if $regSettings.fieldData.authorize_net_conf.value} checked="checked"{/if}>
+                        </td>
+                    </tr>
+                    <tr class="authorize-net">
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.authorize_net_merchant_email} glm-required{/if}">Merchant Email:</th>
+                        <td {if $regSettings.fieldFail.authorize_net_merchant_email}class="glm-form-bad-input"{/if}>
+                            <input type="text" name="authorize_net_merchant_email" value="{$regSettings.fieldData.authorize_net_merchant_email}" class="glm-form-text-input-medium">
+                            {if $regSettings.fieldFail.authorize_net_merchant_email}<p>{$regSettings.fieldFail.authorize_net_merchant_email}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr class="merchant-solutions">
+                        <td></td>
+                        <th><p>Merchant Solutions</p></th>
+                    </tr>
+                    <tr class="merchant-solutions">
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.merchant_solutions_acctid} glm-required{/if}"> Account ID:</th>
+                        <td {if $regSettings.fieldFail.merchant_solutions_acctid}class="glm-form-bad-input"{/if}>
+                            <input type="text" name="merchant_solutions_acctid" value="{$regSettings.fieldData.merchant_solutions_acctid}" class="glm-form-text-input-medium">
+                            {if $regSettings.fieldFail.merchant_solutions_acctid}<p>{$regSettings.fieldFail.merchant_solutions_acctid}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr class="merchant-solutions">
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.merchant_solutions_merchantpin} glm-required{/if}">Merchant PIN:</th>
+                        <td {if $regSettings.fieldFail.merchant_solutions_merchantpin}class="glm-form-bad-input"{/if}>
+                            <input type="text" name="merchant_solutions_merchantpin" value="{$regSettings.fieldData.merchant_solutions_merchantpin}" class="glm-form-text-input-medium">
+                            {if $regSettings.fieldFail.merchant_solutions_merchantpin}<p>{$regSettings.fieldFail.merchant_solutions_merchantpin}</p>{/if}
+                        </td>
+                    </tr>
+                    <tr class="merchant-solutions">
+                        <th>Test Mode:</th>
+                        <td>
+                            <select id="default-merchant-solutions-test" data-id="merchant_solutions_test" name="merchant_solutions_test">
+                                <option value=""></option>
+                                {foreach from=$regSettings.fieldData.merchant_solutions_test.list item=v}
+                                <option value="{$v.value}"{if $v.default} selected="selected"{/if}>
+                                    {$v.name}
+                                </option>
+                                {/foreach}
+                            </select>
+                        </td>
+                    </tr>
+                    <tr class="merchant-solutions">
+                        <th>Send Confirmation E-Mail</th>
+                        <td>
+                            <input type="checkbox" name="merchant_solutions_conf"{if $regSettings.fieldData.merchant_solutions_conf.value} checked="checked"{/if}>
+                        </td>
+                    </tr>
+                    <tr class="merchant-solutions">
+                        <th class="glm-nowrap-left-align{if $regSettings.fieldRequired.merchant_solutions_merchant_email} glm-required{/if}">Merchant Email:</th>
+                        <td {if $regSettings.fieldFail.merchant_solutions_merchant_email}class="glm-form-bad-input"{/if}>
+                            <input type="text" name="merchant_solutions_merchant_email" value="{$regSettings.fieldData.merchant_solutions_merchant_email}" class="glm-form-text-input-medium">
+                            {if $regSettings.fieldFail.merchant_solutions_merchant_email}<p>{$regSettings.fieldFail.merchant_solutions_merchant_email}</p>{/if}
+                        </td>
+                    </tr>
+
+                </table>
+                <input type="submit" value="Update Settings" class="button-primary">
+
+            </form>
+
+        </td>
+    </tr>
+</table>
+
+<script type="text/javascript">
+    jQuery(function($){
+
+        function showSelectedCardProcessor() {
+
+            // Get the value from the selected Payment Method
+            var processor = $('#proc_methods').val();
+
+            // This is a hack, we should be looking at the plugin.ini for these numbers but I'm just too lazy today
+            if (processor == 2) {
+                $('.authorize-net').removeClass('glm-hidden');
+                $('.merchant-solutions').addClass('glm-hidden');
+            } else if (processor == 3) {
+                $('.authorize-net').addClass('glm-hidden');
+                $('.merchant-solutions').removeClass('glm-hidden');
+            } else {
+                $('.authorize-net').addClass('glm-hidden');
+                $('.merchant-solutions').addClass('glm-hidden');
+            }
+
+        }
+
+        // When payment method selection changes
+        $('#proc_methods').on('change', function() {
+            showSelectedCardProcessor();
+        });
+
+        // Start with all pay method inputs dissabled
+        $( document ).ready(function() {
+            showSelectedCardProcessor();
+        });
+
+    });
+</script>
+
+{include file='admin/management/footer.html'}
diff --git a/views/admin/management/footer.html b/views/admin/management/footer.html
new file mode 100644 (file)
index 0000000..f491223
--- /dev/null
@@ -0,0 +1,17 @@
+    <script type="text/javascript">
+
+        jQuery(document).ready(function($) {
+
+            /*
+             * Edit area tabs
+             */
+            // Flash certain elements for a short time after display
+            $(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
+            if('{literal}{$registrationsSettings.fieldData.calendar_view}{/literal}'){
+                $("#calendar-view").val('{literal}{$registrationsSettings.fieldData.calendar_view}{/literal}');
+            } else {
+                $("#calendar-view").val("agenda");
+            }
+        });
+    </script>