From 8a4fae3daedfc69e9549d42c2d2075226940f1fc Mon Sep 17 00:00:00 2001 From: Chuck Scott Date: Mon, 27 Nov 2017 16:45:44 -0500 Subject: [PATCH] Added active and non_time_specific flags to reg_time table and added new date/time form to reg event dashboard. Updated database version to 0.0.19 and added active and non_time_specific boolean fields. Added Active checkbox to time edit dialog box and code to change entry background color in calendar in eventDashboard.html Added storage of Active flag to updateAvailability.php. Adding dialog box for adding a date/time entry. Added new mask input jQuery add-on with more flexibility, added to time input fields for adding date/time entries. Updated checkout page to use new mask input. Started added AJAX processing for new date/time entry. --- classes/data/dataRegTime.php | 14 ++ index.php | 2 +- models/admin/ajax/DELETE-cartLinkWidget.php | 79 ------- models/admin/ajax/updateAvailability.php | 30 ++- models/admin/registrations/events.php | 12 + models/front/registrations/checkout.php | 6 +- ...0.0.18.sql => create_database_V0.0.19.sql} | 6 +- setup/databaseScripts/dbVersions.php | 3 +- ..._V0.0.18.sql => drop_database_V0.0.19.sql} | 2 +- .../update_database_V0.0.19.sql | 26 +++ views/admin/registrations/eventDashboard.html | 208 +++++++++++++----- views/front/registrations/checkout.html | 6 +- 12 files changed, 251 insertions(+), 143 deletions(-) delete mode 100644 models/admin/ajax/DELETE-cartLinkWidget.php rename setup/databaseScripts/{create_database_V0.0.18.sql => create_database_V0.0.19.sql} (99%) rename setup/databaseScripts/{drop_database_V0.0.18.sql => drop_database_V0.0.19.sql} (95%) create mode 100644 setup/databaseScripts/update_database_V0.0.19.sql diff --git a/classes/data/dataRegTime.php b/classes/data/dataRegTime.php index 0113596..53c41a9 100644 --- a/classes/data/dataRegTime.php +++ b/classes/data/dataRegTime.php @@ -116,6 +116,20 @@ class GlmDataRegistrationsRegTime extends GlmDataAbstract 'use' => 'a' ), + // Active flag + 'active' => array ( + 'field' => 'active', + 'type' => 'checkbox', + 'use' => 'lgneud' + ), + + // Non-Time-Specific flag + 'non_time_specific' => array ( + 'field' => 'non_time_specific', + 'type' => 'checkbox', + 'use' => 'lgneud' + ), + // Pointer to reg_event table entry 'reg_event' => array ( 'field' => 'reg_event', diff --git a/index.php b/index.php index ff1b589..1bf1fd9 100644 --- a/index.php +++ b/index.php @@ -44,7 +44,7 @@ if (!defined('ABSPATH')) { * version from this plugin. */ define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_VERSION', '0.0.1'); -define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '0.0.18'); +define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_DB_VERSION', '0.0.19'); // This is the minimum version of the GLM Members DB plugin require for this plugin. define('GLM_MEMBERS_REGISTRATIONS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.10.17'); diff --git a/models/admin/ajax/DELETE-cartLinkWidget.php b/models/admin/ajax/DELETE-cartLinkWidget.php deleted file mode 100644 index 1dedda5..0000000 --- a/models/admin/ajax/DELETE-cartLinkWidget.php +++ /dev/null @@ -1,79 +0,0 @@ - - * @license http://www.gaslightmedia.com Gaslightmedia - * @version 0.1 - */ - -require_once GLM_MEMBERS_REGISTRATIONS_PLUGIN_PATH . '/models/front/registrations/cartLinkWidget.php'; -/** - * Steve Note... - * - * You can get to this using the following URL. - * - * {host}/wp-admin/admin-ajax.php?action=glm_members_admin_ajax&glm_action=login - * - * You should be able to do this as POST or GET and should be able to add and read additional parameters. - * I added a "mystuff" parameter to the URL above and it does output from the code in the - * modelAction() function below. - * - * To add another model under models/admin/ajax all you need to do is create it and add it to the - * setup/validActions.php file. - * - */ - -/** - * This class performs the work of handling images passed to it via - * an AJAX call that goes through the WorPress AJAX Handler. - * - */ -class GlmMembersAdmin_ajax_cartLinkWidget extends GlmMembersFront_registrations_cartLinkWidget -{ - - /** - * WordPress Database Object - * - * @var $wpdb - * @access public - */ - public $wpdb; - /** - * Plugin Configuration Data - * - * @var $config - * @access public - */ - public $config; - - /* - * Constructor - * - * This contructor sets up this model. At this time that only includes - * storing away the WordPress data object. - * - * @return object Class object - * - */ - public function __construct ($wpdb, $config) - { - - // Save WordPress Database object - $this->wpdb = $wpdb; - - // Save plugin configuration object - $this->config = $config; - - // Run constructor for data class - // parent::__construct(false, false); - - } - -} diff --git a/models/admin/ajax/updateAvailability.php b/models/admin/ajax/updateAvailability.php index 1447373..b23abf1 100644 --- a/models/admin/ajax/updateAvailability.php +++ b/models/admin/ajax/updateAvailability.php @@ -59,9 +59,31 @@ public function modelAction($actionData = false) { - +trigger_error(123123123,E_USER_NOTICE); $haveRequest = false; + // Get new time flag + if (!isset($_REQUEST['newTime'])) { + wp_die(); + } + $newTime = false; + if ($_REQUEST['newTime'] == 'true') { + $newTime = true; +echo "123456"; +exit; + } + + + + // Get the active value + if (!isset($_REQUEST['active'])) { + wp_die(); + } + $active = false; + if ($_REQUEST['active'] == 'true') { + $active = true; + } + // Get the max attendees value if (!isset($_REQUEST['max'])) { wp_die(); @@ -92,11 +114,13 @@ $this->wpdb->update( $this->table, array( - 'attendee_max' => $max, - 'attendees_available' => $avail + 'active' => $active, + 'attendee_max' => $max, + 'attendees_available' => $avail ), array('id' => $regTimeId), array( + '%d', '%d', '%d' ), diff --git a/models/admin/registrations/events.php b/models/admin/registrations/events.php index 16057c5..b3a5b33 100644 --- a/models/admin/registrations/events.php +++ b/models/admin/registrations/events.php @@ -117,6 +117,18 @@ class GlmMembersAdmin_registrations_events extends GlmDataRegistrationsRegEvent $regTimesJSON = false; $regEventDeleted = false; + // Register the masked input script that we need for input controls + wp_dequeue_script('glm-members-admin-maskedinput'); + wp_register_script( + 'glm-members-reg-admin-mask', + GLM_MEMBERS_PLUGIN_JS_URL . '/jquery.mask.min-1.7.7.js', + array( + 'jquery' + ), + GLM_MEMBERS_PLUGIN_VERSION + ); + wp_enqueue_script('glm-members-reg-admin-mask'); + // Get any provided option if (isset($_REQUEST['option'])) { $option = $_REQUEST['option']; diff --git a/models/front/registrations/checkout.php b/models/front/registrations/checkout.php index 269b0b8..2effa3e 100644 --- a/models/front/registrations/checkout.php +++ b/models/front/registrations/checkout.php @@ -65,14 +65,14 @@ class GlmMembersFront_registrations_checkout extends GlmRegCartSupport // Register the masked input script that we need for input controls wp_register_script( - 'glm-members-admin-maskedinput', - GLM_MEMBERS_PLUGIN_JS_URL . '/jquery.maskedinput-1.2.2.js', + 'glm-members-reg-front-mask', + GLM_MEMBERS_PLUGIN_JS_URL . '/jquery.mask.min-1.7.7.js', array( 'jquery' ), GLM_MEMBERS_PLUGIN_VERSION ); - wp_enqueue_script('glm-members-admin-maskedinput'); + wp_enqueue_script('glm-members-reg-front-mask'); $Account = new GlmDataRegistrationsAccount($this->wpdb, $this->config); diff --git a/setup/databaseScripts/create_database_V0.0.18.sql b/setup/databaseScripts/create_database_V0.0.19.sql similarity index 99% rename from setup/databaseScripts/create_database_V0.0.18.sql rename to setup/databaseScripts/create_database_V0.0.19.sql index 270736d..a0c4f9d 100644 --- a/setup/databaseScripts/create_database_V0.0.18.sql +++ b/setup/databaseScripts/create_database_V0.0.19.sql @@ -1,6 +1,6 @@ -- Gaslight Media Registration Database -- File Created: 01/18/2017 14:40:00 --- Database Version: 0.0.16 +-- Database Version: 0.0.19 -- Database Creation Script -- -- To permit each query below to be executed separately, @@ -240,8 +240,8 @@ CREATE TABLE {prefix}reg_event ( -- One or more for each event CREATE TABLE {prefix}reg_time ( id INT NOT NULL AUTO_INCREMENT, -+ active -- Flag. True if registrations is available for this time -+ non_time_specific -- Flag. True if this is a pseudo time for non-time-specific events - Other informational times for the event will have this flag off + active -- Flag. True if registrations is available for this time + non_time_specific -- Flag. True if this is a pseudo time for non-time-specific events - Other informational times for the event will have this flag off reg_event INT NULL, -- Pointer to reg_event table event_time INT NULL, -- ID of events times table entry in Events add-on - If false (0), then this is a pseudo entry to use for all registrations (non-date/time specific) start_datetime DATETIME NULL, -- Date and time when event instance starts diff --git a/setup/databaseScripts/dbVersions.php b/setup/databaseScripts/dbVersions.php index e1b0d38..3db96ef 100644 --- a/setup/databaseScripts/dbVersions.php +++ b/setup/databaseScripts/dbVersions.php @@ -31,7 +31,8 @@ $glmMembersRegistrationsDbVersions = array( '0.0.15' => array('version' => '0.0.15', 'tables' => 15, 'date' => '10/18/2017'), '0.0.16' => array('version' => '0.0.16', 'tables' => 15, 'date' => '10/24/2017'), '0.0.17' => array('version' => '0.0.17', 'tables' => 15, 'date' => '11/3/2017'), - '0.0.18' => array('version' => '0.0.18', 'tables' => 15, 'date' => '11/7/2017') + '0.0.18' => array('version' => '0.0.18', 'tables' => 15, 'date' => '11/7/2017'), + '0.0.19' => array('version' => '0.0.19', 'tables' => 15, 'date' => '11/22/2017') ); diff --git a/setup/databaseScripts/drop_database_V0.0.18.sql b/setup/databaseScripts/drop_database_V0.0.19.sql similarity index 95% rename from setup/databaseScripts/drop_database_V0.0.18.sql rename to setup/databaseScripts/drop_database_V0.0.19.sql index 1451bb2..602ae27 100644 --- a/setup/databaseScripts/drop_database_V0.0.18.sql +++ b/setup/databaseScripts/drop_database_V0.0.19.sql @@ -1,6 +1,6 @@ -- Gaslight Media Members Database -- File Created: 12/09/14 15:27:15 --- Database Version: 1.1.23 +-- Database Version: 0.0.19 -- Database Deletion Script -- Note: Tables with DELETE CASCADE must appear before referenced table diff --git a/setup/databaseScripts/update_database_V0.0.19.sql b/setup/databaseScripts/update_database_V0.0.19.sql new file mode 100644 index 0000000..f8fe36d --- /dev/null +++ b/setup/databaseScripts/update_database_V0.0.19.sql @@ -0,0 +1,26 @@ +-- Gaslight Media Members Database - Registratiuons Add-On +-- File Created: 10/03/17 11:00:00 +-- Database Version: 0.0.16 +-- Database Update From Previous Version Script +-- +-- To permit each query below to be executed separately, +-- all queries must be separated by a line with four dashes + +ALTER TABLE {prefix}reg_time ADD COLUMN active BOOLEAN; + +---- + +ALTER TABLE {prefix}reg_time ADD COLUMN non_time_specific BOOLEAN; + +---- + +UPDATE {prefix}reg_time SET active = true; + +---- + +UPDATE {prefix}reg_time SET non_time_specific = false; + +---- + +UPDATE {prefix}reg_time SET non_time_specific = true WHERE event_time = 0; + diff --git a/views/admin/registrations/eventDashboard.html b/views/admin/registrations/eventDashboard.html index 7c2f14f..bdf510f 100644 --- a/views/admin/registrations/eventDashboard.html +++ b/views/admin/registrations/eventDashboard.html @@ -30,7 +30,7 @@

First Event Time:

-
+
{$regEventFirstTime.start_time.datetime}
@@ -254,15 +254,19 @@

Did not find selected event.

{/if} -
+
- - - - - + + + + + + + + +
Maximum Attendees:
Registered Attendees:
Pending in Carts:
Available for Registration:
Active:
All Day:
Start Time:
End Time:
Maximum Attendees: 0 = Unlimited
Registered Attendees:
Pending in Carts:
Available for Registration:
-
Upate
+
Upate
@@ -271,13 +275,58 @@ -- 2.17.1