Add more db options for events
authorSteve Sutton <steve@gaslightmedia.com>
Thu, 11 Oct 2018 20:19:48 +0000 (16:19 -0400)
committerSteve Sutton <steve@gaslightmedia.com>
Thu, 11 Oct 2018 20:31:15 +0000 (16:31 -0400)
Adding the border color option for the event container.
Adding flag for disabling target blank for event detail url's.
Adding option to set which default agenda view will be used.

14 files changed:
classes/data/dataManagement.php
config/plugin.ini
index.php
models/front/events/list.php
setup/databaseScripts/create_database_V0.1.8.sql [deleted file]
setup/databaseScripts/create_database_V0.1.9.sql [new file with mode: 0644]
setup/databaseScripts/dbVersions.php
setup/databaseScripts/steve_V0.1.9.sql [deleted file]
setup/databaseScripts/update_database_V0.1.9.sql [new file with mode: 0644]
views/admin/management/events.html
views/front/events/agenda.html
views/front/events/agenda_new.html [new file with mode: 0644]
views/front/events/agenda_old.html [deleted file]
views/front/events/detail.html

index ad2f7b2..d3c8d97 100644 (file)
@@ -263,6 +263,24 @@ class GlmDataEventsManagement extends GlmDataAbstract
                 'use'     => 'a'
             ),
 
+            // Turn on to keep from adding target blank to detail page url's
+            'detail_ext_links_same_window' => array(
+                'field'   => 'detail_ext_links_same_window',
+                'type'    => 'checkbox',
+                'default' => false,
+                'use'     => 'a'
+            ),
+
+            // Default view file for agenda views
+            'default_agenda_view' => array (
+                'field'      => 'default_agenda_view',
+                'type'       => 'list',
+                'list'       => $this->config['event_default_view_file'],
+                'default'    => 'agenda_new',
+                'force_list' => true,
+                'use'        => 'a'
+            ),
+
             // Color of the search button
             'event_back_to_search_color' => array(
                 'field'    => 'event_back_to_search_color',
@@ -295,7 +313,7 @@ class GlmDataEventsManagement extends GlmDataAbstract
                 'use'      => 'a',
             ),
 
-            // Color of the search button
+            // Color of the event container background
             'agenda_container_background_color' => array(
                 'field'    => 'agenda_container_background_color',
                 'type'     => 'text',
@@ -303,6 +321,14 @@ class GlmDataEventsManagement extends GlmDataAbstract
                 'use'      => 'a',
             ),
 
+            // Color of the border for event container
+            'agenda_container_border_color' => array(
+                'field'    => 'agenda_container_border_color',
+                'type'     => 'text',
+                'required' => false,
+                'use'      => 'a',
+            ),
+
             // Max Width of Agenda View
             'agenda_view_max_width' => array(
                 'field'    => 'agenda_view_max_width',
index 7976a31..88f021d 100644 (file)
@@ -28,3 +28,5 @@ event_image_sizes['small'] = 'Small'
 event_image_sizes['thumb'] = 'Thumbnail'
 event_image_sizes['grid'] = 'Grid'
 
+event_default_view_file['agenda']     = 'Old Agenda View'
+event_default_view_file['agenda_new'] = 'New Agenda View'
index 4ddb209..df665ee 100644 (file)
--- a/index.php
+++ b/index.php
@@ -44,7 +44,7 @@ if (!defined('ABSPATH')) {
  *  version from this plugin.
  */
 define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '1.7.0');
-define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.8');
+define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.1.9');
 
 // This is the minimum version of the GLM Members DB plugin require for this plugin.
 define('GLM_MEMBERS_EVENTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '2.9.15');
index c384384..72d0cb3 100644 (file)
@@ -75,6 +75,7 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction
         $this->notInCat  = array();
         $pdfCategoryList = '';
 
+        $defaultViewFile = ( $this->config['settings']['default_agenda_view'] ) ? $this->config['settings']['default_agenda_view'] . '.html' : 'agenda.html';
 
         // get list cities to search by
         require_once GLM_MEMBERS_PLUGIN_CLASS_PATH.'/data/dataCities.php';
@@ -399,7 +400,7 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction
             $events = $this->getModelEventsData( $event_config );
             $this->postAddRecurrences = false;
             if ( !$view ) {
-                $view = 'agenda.html';
+                $view = $defaultViewFile;
             }
             break;
         case 'event-list':
@@ -407,7 +408,7 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction
             $this->postAddRecurrences = true;
             $events = $this->getModelEventsData( $event_config );
             if ( !$view ) {
-                $view = 'agenda.html';
+                $view = $defaultViewFile;
             }
             $this->postAddRecurrences = false;
              $this->postAddLocations   = false;
@@ -455,7 +456,7 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction
             if ( isset ( $actionData['request']['template'] ) && $actionData['request']['template'] ) {
                 $view = $actionData['request']['template'];
             } else {
-                $view = 'agenda.html';
+                $view = $defaultViewFile;
             }
             break;
         case 'pdf':
@@ -467,7 +468,7 @@ class GlmMembersFront_events_list extends GlmMembersFront_events_baseAction
             $this->postAddLocations   = true;
             $this->postAddRecurrences = true;
             if ( !$view ) {
-                $view = 'agenda.html';
+                $view = $defaultViewFile;
             }
             $events = $this->getModelEventsData( $event_config );
             $this->postAddRecurrences = false;
diff --git a/setup/databaseScripts/create_database_V0.1.8.sql b/setup/databaseScripts/create_database_V0.1.8.sql
deleted file mode 100644 (file)
index f7da756..0000000
+++ /dev/null
@@ -1,288 +0,0 @@
--- Gaslight Media Members Database - Events Add-On
--- File Created: 08/18/17
--- Database Version: 0.1.7
--- Database Creation Script
---
--- This file is called to create a new set of tables for this
--- add-on for the most recent 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
-
-
--- Amenities
-CREATE TABLE {prefix}amenities (
-    id INT NOT NULL AUTO_INCREMENT,
-    active TINYINT(1) NULL,                   -- Amenity is active flag
-    name TINYTEXT NULL,                       -- Name of amenity
-    descr TEXT NULL,                          -- Description of amenity
-    short_descr TINYTEXT NULL,                -- Short description of amenity
-    uses_value BOOLEAN NULL,                  -- Flag indicating whether the amenity requires a quantity number
-    PRIMARY KEY (id),
-    INDEX(name(20))
-);
-
-----
-
--- Amenity Reference - Links a specific amenity to a specific entity of type ref_type
-CREATE TABLE {prefix}amenity_event (
-    id INT NOT NULL AUTO_INCREMENT,
-    amenity INT NULL,
-    event INT NULL,
-    PRIMARY KEY (id),
-    INDEX(event)
-);
-
-----
-
--- groups
-CREATE TABLE {prefix}amenity_groups (
-    id INT NOT NULL AUTO_INCREMENT,
-    name TINYTEXT NULL,                     -- Name of the Group
-    PRIMARY KEY (id),
-    INDEX(name(20))
-);
-
-----
-
--- Amenity Group - Links a specific amenity to groups
-CREATE TABLE {prefix}grouped_amenities (
-    id INT NOT NULL AUTO_INCREMENT,
-    group_id INT,                              -- Pointer to the group
-    amenity_id INT,                            -- Pointer to the Amenity
-    searchable BOOLEAN DEFAULT '0',         -- Flag indicating whether the amenity group will show in the search form
-    PRIMARY KEY (id)
-);
-
-----
-
--- Categories - Categories for events
-CREATE TABLE {prefix}categories (
-    id INT NOT NULL AUTO_INCREMENT,
-    name TINYTEXT NULL,                                   -- Name of event category
-    descr TINYTEXT NULL,                                  -- Description of this category
-    parent INT NULL,                                      -- Parent category, null or 0 if this is a top level category
-    PRIMARY KEY (id),
-    INDEX(parent)
-);
-
-----
-
--- Event-Category - Categories for specific event records
-CREATE TABLE {prefix}event_categories (
-    id INT NOT NULL AUTO_INCREMENT,
-    event INT NULL,                                       -- Pointer to the event
-    category INT NULL,                                    -- Pointer to the category
-    PRIMARY KEY (id),
-    INDEX(event),
-    INDEX(category)
-);
-
-----
-
--- Event Recurrence - Defines how an event recurs
-CREATE TABLE {prefix}recurrences (
-    id INT NOT NULL AUTO_INCREMENT,
-    event INTEGER NULL,                                   -- Pointer to event
-    name TINYTEXT NULL,                                   -- Name of this recurrence schedule - used on admin calendar
-    start_time TIME NULL,                                 -- Start time of day for event
-    start_time_only BOOLEAN NULL,                         -- Use end of first occurrence flag
-    end_time TIME NULL,                                   -- End time of day for event - If less than start time, assume a date boundry
-    all_day BOOLEAN NULL,                                 -- Flag indicating if this is an all-day event (informational only)
-    start_date DATE NULL,                                 -- Starting Date (if all_day is selected) Used instead of start_time
-    from_date DATE NULL,                                  -- From Date for recurrences
-    to_date DATE NULL,                                    -- To Date for recurrences
-    recurring BOOLEAN NULL,                               -- Flag indicating that event recurs on a schedule rather than all dates
-    month_of_year SMALLINT UNSIGNED NULL,                 -- Month of year (bitmap)
-    week_of_month TINYINT UNSIGNED NULL,                  -- Week of the month (bitmap)
-    day_of_week TINYINT UNSIGNED NULL,                    -- Day of the week (bitmap)
-    by_day_of_month BOOLEAN NULL,                         -- Flag indicating if selecting by days of the month
-    day_of_month INTEGER UNSIGNED NULL,                   -- Day of the month (bitmap)
-    last_day_of_month BOOLEAN NULL,                       -- Last day of the month
-    specific_dates TEXT NULL,                             -- Serialized array of specific dates added to the recurrence
-    holiday INT NULL,                                     -- Pointer to holidays list (for future development)
-    holiday_offset TINYINT,                               -- Offset from holiday (from -128 to +127 days)
-    PRIMARY KEY (id),
-    INDEX(event)
-);
-
-----
-
--- Times - List of actual event times for single and recurring events
-CREATE TABLE {prefix}times (
-    id INT NOT NULL AUTO_INCREMENT,
-    event INT NULL,                                       -- Pointer to the primary record for the event
-    custom_event INT NULL,                                -- Pointer to a customized copy of the event record (if set)
-    recur_id INT NULL,                                    -- Pointer to recurrence entry
-    active BOOLEAN NULL,                                  -- Active flag - normally set but used to temporarily disable a specific date
-    start_time DATETIME NULL,                             -- Date and time event starts
-    end_time DATETIME NULL,                               -- Date and time event ends
-    all_day BOOLEAN NULL,                                 -- All Day flag
-    PRIMARY KEY (id),
-    INDEX(event),
-    INDEX(start_time),
-    INDEX(end_time)
-);
-
-----
-
--- Locations - Locations for event - If there's no location pointing to an event try to use the referenced entity in events table
-CREATE TABLE {prefix}locations (
-    id INT NOT NULL AUTO_INCREMENT,
-    event INT NULL,                                       -- Pointer to the primary or custom event record
-    name TINYTEXT NULL,                                   -- Name of location
-    address TINYTEXT NULL,                                -- Street Address
-    city INT NULL,                                        -- Pointer to city - references main plugin city table
-    state TINYTEXT NULL,                                  -- Two character state abbreviation
-    zip TINYTEXT NULL,                                    -- ZIP/Postal code
-    country TINYTEXT NULL,                                -- Country Code
-    lat FLOAT NULL,                                       -- Latitude of location
-    lon FLOAT NULL,                                       -- Longitude of location
-    region INT NULL,                                      -- Pointer to Region - references main plugin region table
-    phone TINYTEXT NULL,                                  -- Location Phone #
-    url TINYTEXT NULL,                                    -- Location URL
-    email TINYTEXT NULL,                                  -- Location E-Mail Address
-    contact_addon_id INT NULL,                            -- ID of Contact from contact add-on (optional and if available)
-    contact_fname TINYTEXT NULL,                          -- Contact first name for this location (optional)
-    contact_lname TINYTEXT NULL,                          -- Contact last name for this location (optional)
-    contact_phone TINYTEXT NULL,                          -- Contact phone for this location (optional)
-    contact_email TINYTEXT NULL,                          -- Contact E-Mail address (optional)
-    PRIMARY KEY (id)
-);
-
-----
-
--- Events - Base event information - May also be entries here referenced by the "times" table for a custom date.
-CREATE TABLE {prefix}events (
-    id INT NOT NULL AUTO_INCREMENT,
-    status INT NULL,                                      -- Status for this event, see config['status']
-    custom_time INT NULL,                                 -- If this is a custom record for a specific instance (date) this points to that times table entry
-    root_event INT NULL,                                  -- Root event pointer if this is a custom record for a specific instance (date) (if custom_time is set)
-    created DATETIME NULL,                                -- Date/Time event was created or date custom event record was created if custom record
-    updated DATETIME NULL,                                -- Date/Time this event record was last updated
-    approved DATETIME NULL,                               -- Date/Ttime this event record was approved
-    ref_type INT NULL,                                    -- Type of entity this event is associated with - See config['ref_type']
-    ref_dest INT NULL,                                    -- Pointer to the specific entity of ref_type this event is associated with
-    hide_address BOOLEAN NULL,                            -- Option to hide address on front-end
-    featured BOOLEAN NULL,                                -- Option to mark as featured event
-    slideshow BOOLEAN NULL,                               -- Option to mark for use in slide show
-    major BOOLEAN NULL,                                   -- Option to mark as a major event
-    name TINYTEXT NULL,                                   -- Name of this event
-    name_slug TINYTEXT NULL,                              -- Slug for this event
-    header TINYTEXT NULL,                                 -- Header text for front-end display - NOT CURRENTLY USED
-    intro TINYTEXT NULL,                                  -- Intro text for front-end display
-    descr TEXT NULL,                                      -- Full description text
-    image TINYTEXT NULL,                                  -- Image file name
-    file1 TINYTEXT NULL,                                  -- File name for a single uploaded file #1
-    file1_descr TINYTEXT NULL,                            -- Description for file uploaded in field "file" #1
-    file2 TINYTEXT NULL,                                  -- File name for a single uploaded file #2
-    file2_descr TINYTEXT NULL,                            -- Description for file uploaded in field "file" #2
-    file3 TINYTEXT NULL,                                  -- File name for a single uploaded file #3
-    file3_descr TINYTEXT NULL,                            -- Description for file uploaded in field "file" #3
-    url TINYTEXT NULL,                                    -- Event URL
-    ticket_url TINYTEXT NULL,                             -- Ticket URL
-    registration_url TINYTEXT NULL,                       -- Registration URL
-    cost TINYTEXT NULL,                                   -- Description of event cost
-    admin_ref_type INT NULL,                              -- Type of admin contact if using a member contact
-    admin_ref_dest INT NULL,                              -- Pointer to admin contact record if using a member contact
-    admin_name TINYTEXT NULL,                             -- Admin Contact Name if not using a member contact
-    admin_org TINYTEXT NULL,                              -- Admin Contact Organization if not using a member contact
-    admin_email TINYTEXT NULL,                            -- Admin Contact E-Mail if not using a member contact
-    admin_phone TINYTEXT NULL,                            -- Admin Contact Phone if not using a member contact
-    free BOOLEAN NULL,                                    -- Event is Free
-    contact_email TINYTEXT NULL,                          -- Contact E-mail address
-    contact_name TINYTEXT NULL,                           -- Contact name
-    contact_phone TINYTEXT NULL,                          -- Event Phone
-    use_member_location BOOLEAN NULL,                     -- Use location of the member (if provided) rather than location table data
-    other_ref_dest INT NULL,                              -- Set location of the event to another member
-    old_event_id INT NULL,                                -- ID of event from old site for reference
-    ical_uid TINYTEXT NULL,                               -- The ical UID for this event.
-    notes TEXT NULL,                                      -- Internal notes for this event
-    PRIMARY KEY (id),
-    INDEX(custom_time),
-    INDEX(root_event),
-    INDEX(ref_type),
-    INDEX(ref_dest),
-    INDEX(featured),
-    INDEX(slideshow),
-    INDEX(major)
-);
-
-----
-
--- Event Management Settings
-CREATE TABLE {prefix}management (
-    id INT NOT NULL AUTO_INCREMENT,
-    canonical_event_page TINYTEXT NULL,                   -- Canonical page slug for event detail
-    pdf_logo TINYTEXT NULL,                               -- Image for the Top of the PDF
-    footer_text TINYTEXT NULL,                            -- Image for the Top of the PDF
-    to_email TINYTEXT NULL,                               -- Email address of the recipient
-    from_email TINYTEXT NULL,                             -- Email address of the sender
-    email_notification TEXT NULL,                         -- Email notification message
-    calendar_view TINYTEXT NULL,                          -- Default calendar view
-    event_default_state TINYTEXT NULL,                    -- Default calendar view
-    term_event_amenities_singular TINYTEXT NULL,          -- Singular term to use for event amenities
-    term_event_amenities_plural TINYTEXT NULL,            -- Plural term to use for event amenities
-    use_event_amenities BOOLEAN NULL,                     -- Whether amenities are used at all for events
-    use_venue_locations BOOLEAN NULL,                     -- To use Other members as the location of event
-    member_events_allowed BOOLEAN NULL,                   -- If members are allowed to add events.
-    member_events_moderated BOOLEAN DEFAULT '0',          -- If member edits are moderated.
-    ical_feed_image_size TINYTEXT NULL,                   -- Image size to use in iCal Feed
-    event_display_member_message BOOLEAN DEFAULT '0',     -- Boolean to show member message or not
-    event_member_message TEXT NULL,                       -- Member Message
-    event_add_button_color TINYTEXT NULL,                 -- Color of the search button
-    event_add_button_hidden BOOLEAN NULL,                 -- Option to hide the add event button
-    event_back_to_search_color TINYTEXT NULL,             -- Background Color of the search
-    agenda_date_background_color TINYTEXT NULL,           -- Background Color of the date
-    agenda_date_text_color TINYTEXT NULL,                 -- Text Color of the date
-    agenda_title_color TINYTEXT NULL,                     -- Color of the Event Title
-    agenda_container_background_color TINYTEXT NULL,      -- Event Container Border Color
-    agenda_view_max_width TINYTEXT NULL,                  -- Max Width of agenda view
-    PRIMARY KEY (id)
-);
-
-----
-
--- Set default event management entry
-INSERT INTO {prefix}management
-    ( id, canonical_event_page, term_event_amenities_singular, term_event_amenities_plural, member_events_allowed, ical_feed_image_size, event_display_member_message, event_member_message )
-   VALUES
-    ( 1, 'event-detail', 'Amenity', 'Amenities', 1, 'large', 0, '')
-;
-
-----
-
--- Event iCal Feed imports
-CREATE TABLE {prefix}feed_import (
-    id INT NOT NULL AUTO_INCREMENT,
-    feed_url TEXT NOT NULL,            -- The ical feed url to import
-    created DATETIME NULL,             -- The date this feed was created
-    updated DATETIME NULL,             -- Last time this feed was updated
-    duration INT NULL,                 -- The time it took to fetch the feed
-    events INT NULL,                   -- The number of events last fetched
-    PRIMARY KEY (id)
-);
-
-----
-
--- Event Email Notifications
-CREATE TABLE {prefix}email_notifications (
-    id INT NOT NULL AUTO_INCREMENT,
-    declined_message TEXT NULL,    -- Event declined message
-    approved_message TEXT NULL,    -- Event approved message
-    to_email TINYTEXT NULL,        -- To Email Address
-    from_email TINYTEXT NULL,      -- From Email Address
-    email_notification TEXT NULL,  -- Email notification message
-    PRIMARY KEY (id)
-);
-
-----
-
--- Set default event email settings
-INSERT INTO {prefix}email_notifications
-    ( id, declined_message, approved_message )
-   VALUES
-    ( 1, 'The Event parameters do not comply with our event guidelines.', 'Your event has been approved.' )
-;
diff --git a/setup/databaseScripts/create_database_V0.1.9.sql b/setup/databaseScripts/create_database_V0.1.9.sql
new file mode 100644 (file)
index 0000000..7d9bbaa
--- /dev/null
@@ -0,0 +1,291 @@
+-- Gaslight Media Members Database - Events Add-On
+-- File Created: 08/18/17
+-- Database Version: 0.1.7
+-- Database Creation Script
+--
+-- This file is called to create a new set of tables for this
+-- add-on for the most recent 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
+
+
+-- Amenities
+CREATE TABLE {prefix}amenities (
+    id INT NOT NULL AUTO_INCREMENT,
+    active TINYINT(1) NULL,                   -- Amenity is active flag
+    name TINYTEXT NULL,                       -- Name of amenity
+    descr TEXT NULL,                          -- Description of amenity
+    short_descr TINYTEXT NULL,                -- Short description of amenity
+    uses_value BOOLEAN NULL,                  -- Flag indicating whether the amenity requires a quantity number
+    PRIMARY KEY (id),
+    INDEX(name(20))
+);
+
+----
+
+-- Amenity Reference - Links a specific amenity to a specific entity of type ref_type
+CREATE TABLE {prefix}amenity_event (
+    id INT NOT NULL AUTO_INCREMENT,
+    amenity INT NULL,
+    event INT NULL,
+    PRIMARY KEY (id),
+    INDEX(event)
+);
+
+----
+
+-- groups
+CREATE TABLE {prefix}amenity_groups (
+    id INT NOT NULL AUTO_INCREMENT,
+    name TINYTEXT NULL,                     -- Name of the Group
+    PRIMARY KEY (id),
+    INDEX(name(20))
+);
+
+----
+
+-- Amenity Group - Links a specific amenity to groups
+CREATE TABLE {prefix}grouped_amenities (
+    id INT NOT NULL AUTO_INCREMENT,
+    group_id INT,                              -- Pointer to the group
+    amenity_id INT,                            -- Pointer to the Amenity
+    searchable BOOLEAN DEFAULT '0',         -- Flag indicating whether the amenity group will show in the search form
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Categories - Categories for events
+CREATE TABLE {prefix}categories (
+    id INT NOT NULL AUTO_INCREMENT,
+    name TINYTEXT NULL,                                   -- Name of event category
+    descr TINYTEXT NULL,                                  -- Description of this category
+    parent INT NULL,                                      -- Parent category, null or 0 if this is a top level category
+    PRIMARY KEY (id),
+    INDEX(parent)
+);
+
+----
+
+-- Event-Category - Categories for specific event records
+CREATE TABLE {prefix}event_categories (
+    id INT NOT NULL AUTO_INCREMENT,
+    event INT NULL,                                       -- Pointer to the event
+    category INT NULL,                                    -- Pointer to the category
+    PRIMARY KEY (id),
+    INDEX(event),
+    INDEX(category)
+);
+
+----
+
+-- Event Recurrence - Defines how an event recurs
+CREATE TABLE {prefix}recurrences (
+    id INT NOT NULL AUTO_INCREMENT,
+    event INTEGER NULL,                                   -- Pointer to event
+    name TINYTEXT NULL,                                   -- Name of this recurrence schedule - used on admin calendar
+    start_time TIME NULL,                                 -- Start time of day for event
+    start_time_only BOOLEAN NULL,                         -- Use end of first occurrence flag
+    end_time TIME NULL,                                   -- End time of day for event - If less than start time, assume a date boundry
+    all_day BOOLEAN NULL,                                 -- Flag indicating if this is an all-day event (informational only)
+    start_date DATE NULL,                                 -- Starting Date (if all_day is selected) Used instead of start_time
+    from_date DATE NULL,                                  -- From Date for recurrences
+    to_date DATE NULL,                                    -- To Date for recurrences
+    recurring BOOLEAN NULL,                               -- Flag indicating that event recurs on a schedule rather than all dates
+    month_of_year SMALLINT UNSIGNED NULL,                 -- Month of year (bitmap)
+    week_of_month TINYINT UNSIGNED NULL,                  -- Week of the month (bitmap)
+    day_of_week TINYINT UNSIGNED NULL,                    -- Day of the week (bitmap)
+    by_day_of_month BOOLEAN NULL,                         -- Flag indicating if selecting by days of the month
+    day_of_month INTEGER UNSIGNED NULL,                   -- Day of the month (bitmap)
+    last_day_of_month BOOLEAN NULL,                       -- Last day of the month
+    specific_dates TEXT NULL,                             -- Serialized array of specific dates added to the recurrence
+    holiday INT NULL,                                     -- Pointer to holidays list (for future development)
+    holiday_offset TINYINT,                               -- Offset from holiday (from -128 to +127 days)
+    PRIMARY KEY (id),
+    INDEX(event)
+);
+
+----
+
+-- Times - List of actual event times for single and recurring events
+CREATE TABLE {prefix}times (
+    id INT NOT NULL AUTO_INCREMENT,
+    event INT NULL,                                       -- Pointer to the primary record for the event
+    custom_event INT NULL,                                -- Pointer to a customized copy of the event record (if set)
+    recur_id INT NULL,                                    -- Pointer to recurrence entry
+    active BOOLEAN NULL,                                  -- Active flag - normally set but used to temporarily disable a specific date
+    start_time DATETIME NULL,                             -- Date and time event starts
+    end_time DATETIME NULL,                               -- Date and time event ends
+    all_day BOOLEAN NULL,                                 -- All Day flag
+    PRIMARY KEY (id),
+    INDEX(event),
+    INDEX(start_time),
+    INDEX(end_time)
+);
+
+----
+
+-- Locations - Locations for event - If there's no location pointing to an event try to use the referenced entity in events table
+CREATE TABLE {prefix}locations (
+    id INT NOT NULL AUTO_INCREMENT,
+    event INT NULL,                                       -- Pointer to the primary or custom event record
+    name TINYTEXT NULL,                                   -- Name of location
+    address TINYTEXT NULL,                                -- Street Address
+    city INT NULL,                                        -- Pointer to city - references main plugin city table
+    state TINYTEXT NULL,                                  -- Two character state abbreviation
+    zip TINYTEXT NULL,                                    -- ZIP/Postal code
+    country TINYTEXT NULL,                                -- Country Code
+    lat FLOAT NULL,                                       -- Latitude of location
+    lon FLOAT NULL,                                       -- Longitude of location
+    region INT NULL,                                      -- Pointer to Region - references main plugin region table
+    phone TINYTEXT NULL,                                  -- Location Phone #
+    url TINYTEXT NULL,                                    -- Location URL
+    email TINYTEXT NULL,                                  -- Location E-Mail Address
+    contact_addon_id INT NULL,                            -- ID of Contact from contact add-on (optional and if available)
+    contact_fname TINYTEXT NULL,                          -- Contact first name for this location (optional)
+    contact_lname TINYTEXT NULL,                          -- Contact last name for this location (optional)
+    contact_phone TINYTEXT NULL,                          -- Contact phone for this location (optional)
+    contact_email TINYTEXT NULL,                          -- Contact E-Mail address (optional)
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Events - Base event information - May also be entries here referenced by the "times" table for a custom date.
+CREATE TABLE {prefix}events (
+    id INT NOT NULL AUTO_INCREMENT,
+    status INT NULL,                                      -- Status for this event, see config['status']
+    custom_time INT NULL,                                 -- If this is a custom record for a specific instance (date) this points to that times table entry
+    root_event INT NULL,                                  -- Root event pointer if this is a custom record for a specific instance (date) (if custom_time is set)
+    created DATETIME NULL,                                -- Date/Time event was created or date custom event record was created if custom record
+    updated DATETIME NULL,                                -- Date/Time this event record was last updated
+    approved DATETIME NULL,                               -- Date/Ttime this event record was approved
+    ref_type INT NULL,                                    -- Type of entity this event is associated with - See config['ref_type']
+    ref_dest INT NULL,                                    -- Pointer to the specific entity of ref_type this event is associated with
+    hide_address BOOLEAN NULL,                            -- Option to hide address on front-end
+    featured BOOLEAN NULL,                                -- Option to mark as featured event
+    slideshow BOOLEAN NULL,                               -- Option to mark for use in slide show
+    major BOOLEAN NULL,                                   -- Option to mark as a major event
+    name TINYTEXT NULL,                                   -- Name of this event
+    name_slug TINYTEXT NULL,                              -- Slug for this event
+    header TINYTEXT NULL,                                 -- Header text for front-end display - NOT CURRENTLY USED
+    intro TINYTEXT NULL,                                  -- Intro text for front-end display
+    descr TEXT NULL,                                      -- Full description text
+    image TINYTEXT NULL,                                  -- Image file name
+    file1 TINYTEXT NULL,                                  -- File name for a single uploaded file #1
+    file1_descr TINYTEXT NULL,                            -- Description for file uploaded in field "file" #1
+    file2 TINYTEXT NULL,                                  -- File name for a single uploaded file #2
+    file2_descr TINYTEXT NULL,                            -- Description for file uploaded in field "file" #2
+    file3 TINYTEXT NULL,                                  -- File name for a single uploaded file #3
+    file3_descr TINYTEXT NULL,                            -- Description for file uploaded in field "file" #3
+    url TINYTEXT NULL,                                    -- Event URL
+    ticket_url TINYTEXT NULL,                             -- Ticket URL
+    registration_url TINYTEXT NULL,                       -- Registration URL
+    cost TINYTEXT NULL,                                   -- Description of event cost
+    admin_ref_type INT NULL,                              -- Type of admin contact if using a member contact
+    admin_ref_dest INT NULL,                              -- Pointer to admin contact record if using a member contact
+    admin_name TINYTEXT NULL,                             -- Admin Contact Name if not using a member contact
+    admin_org TINYTEXT NULL,                              -- Admin Contact Organization if not using a member contact
+    admin_email TINYTEXT NULL,                            -- Admin Contact E-Mail if not using a member contact
+    admin_phone TINYTEXT NULL,                            -- Admin Contact Phone if not using a member contact
+    free BOOLEAN NULL,                                    -- Event is Free
+    contact_email TINYTEXT NULL,                          -- Contact E-mail address
+    contact_name TINYTEXT NULL,                           -- Contact name
+    contact_phone TINYTEXT NULL,                          -- Event Phone
+    use_member_location BOOLEAN NULL,                     -- Use location of the member (if provided) rather than location table data
+    other_ref_dest INT NULL,                              -- Set location of the event to another member
+    old_event_id INT NULL,                                -- ID of event from old site for reference
+    ical_uid TINYTEXT NULL,                               -- The ical UID for this event.
+    notes TEXT NULL,                                      -- Internal notes for this event
+    PRIMARY KEY (id),
+    INDEX(custom_time),
+    INDEX(root_event),
+    INDEX(ref_type),
+    INDEX(ref_dest),
+    INDEX(featured),
+    INDEX(slideshow),
+    INDEX(major)
+);
+
+----
+
+-- Event Management Settings
+CREATE TABLE {prefix}management (
+    id INT NOT NULL AUTO_INCREMENT,
+    canonical_event_page TINYTEXT NULL,                   -- Canonical page slug for event detail
+    pdf_logo TINYTEXT NULL,                               -- Image for the Top of the PDF
+    footer_text TINYTEXT NULL,                            -- Image for the Top of the PDF
+    to_email TINYTEXT NULL,                               -- Email address of the recipient
+    from_email TINYTEXT NULL,                             -- Email address of the sender
+    email_notification TEXT NULL,                         -- Email notification message
+    calendar_view TINYTEXT NULL,                          -- Default calendar view
+    event_default_state TINYTEXT NULL,                    -- Default calendar view
+    term_event_amenities_singular TINYTEXT NULL,          -- Singular term to use for event amenities
+    term_event_amenities_plural TINYTEXT NULL,            -- Plural term to use for event amenities
+    use_event_amenities BOOLEAN NULL,                     -- Whether amenities are used at all for events
+    use_venue_locations BOOLEAN NULL,                     -- To use Other members as the location of event
+    member_events_allowed BOOLEAN NULL,                   -- If members are allowed to add events.
+    member_events_moderated BOOLEAN DEFAULT '0',          -- If member edits are moderated.
+    ical_feed_image_size TINYTEXT NULL,                   -- Image size to use in iCal Feed
+    event_display_member_message BOOLEAN DEFAULT '0',     -- Boolean to show member message or not
+    event_member_message TEXT NULL,                       -- Member Message
+    event_add_button_color TINYTEXT NULL,                 -- Color of the search button
+    event_add_button_hidden BOOLEAN NULL,                 -- Option to hide the add event button
+    event_back_to_search_color TINYTEXT NULL,             -- Background Color of the search
+    default_agenda_view TINYTEXT NULL,                    -- Default view file for agenda views
+    agenda_date_background_color TINYTEXT NULL,           -- Background Color of the date
+    agenda_date_text_color TINYTEXT NULL,                 -- Text Color of the date
+    agenda_title_color TINYTEXT NULL,                     -- Color of the Event Title
+    agenda_container_background_color TINYTEXT NULL,      -- Event Container Background Color
+    agenda_container_border_color TINYTEXT NULL,          -- Event Container Border Color
+    agenda_view_max_width TINYTEXT NULL,                  -- Max Width of agenda view
+    detail_ext_links_same_window BOOLEAN DEFAULT '0',     -- Turn on to keep from adding target blank to detail page url's
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Set default event management entry
+INSERT INTO {prefix}management
+    ( id, canonical_event_page, term_event_amenities_singular, term_event_amenities_plural, member_events_allowed, ical_feed_image_size, event_display_member_message, event_member_message, default_agenda_view )
+   VALUES
+    ( 1, 'event-detail', 'Amenity', 'Amenities', 1, 'large', 0, '', 'agenda')
+;
+
+----
+
+-- Event iCal Feed imports
+CREATE TABLE {prefix}feed_import (
+    id INT NOT NULL AUTO_INCREMENT,
+    feed_url TEXT NOT NULL,            -- The ical feed url to import
+    created DATETIME NULL,             -- The date this feed was created
+    updated DATETIME NULL,             -- Last time this feed was updated
+    duration INT NULL,                 -- The time it took to fetch the feed
+    events INT NULL,                   -- The number of events last fetched
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Event Email Notifications
+CREATE TABLE {prefix}email_notifications (
+    id INT NOT NULL AUTO_INCREMENT,
+    declined_message TEXT NULL,    -- Event declined message
+    approved_message TEXT NULL,    -- Event approved message
+    to_email TINYTEXT NULL,        -- To Email Address
+    from_email TINYTEXT NULL,      -- From Email Address
+    email_notification TEXT NULL,  -- Email notification message
+    PRIMARY KEY (id)
+);
+
+----
+
+-- Set default event email settings
+INSERT INTO {prefix}email_notifications
+    ( id, declined_message, approved_message )
+   VALUES
+    ( 1, 'The Event parameters do not comply with our event guidelines.', 'Your event has been approved.' )
+;
index fea850f..4273488 100644 (file)
@@ -44,5 +44,6 @@ $glmMembersEventsDbVersions = array(
     '0.1.6' => array('version' => '0.1.6', 'tables' => 13, 'date' => '08/06/2018'),
     '0.1.7' => array('version' => '0.1.7', 'tables' => 13, 'date' => '09/14/2018'),
     '0.1.8' => array('version' => '0.1.8', 'tables' => 13, 'date' => '10/09/2018'),
+    '0.1.9' => array('version' => '0.1.9', 'tables' => 13, 'date' => '10/11/2018'),
 );
 
diff --git a/setup/databaseScripts/steve_V0.1.9.sql b/setup/databaseScripts/steve_V0.1.9.sql
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/setup/databaseScripts/update_database_V0.1.9.sql b/setup/databaseScripts/update_database_V0.1.9.sql
new file mode 100644 (file)
index 0000000..4a44746
--- /dev/null
@@ -0,0 +1,21 @@
+-- Gaslight Media Members Database  - Events Add-On
+-- File Created: 09/14/18
+-- Database Version: 0.1.7
+-- 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}management ADD COLUMN default_agenda_view TINYTEXT NULL;                 -- Default view file for agenda view
+
+----
+
+ALTER TABLE {prefix}management ADD COLUMN agenda_container_border_color TINYTEXT NULL;       -- Event Container Border Color
+
+----
+
+ALTER TABLE {prefix}management ADD COLUMN detail_ext_links_same_window BOOLEAN NULL;         -- Turn on to keep from adding target blank to detail page url's
+
+----
+
+UPDATE {prefix}management SET default_agenda_view = 'agenda';
index bc2cbb9..0f5334d 100644 (file)
                             </td>
                         </tr>
 
+                        <tr>
+                            <th>Front-End Default Agenda View</th>
+                            <td>
+                                <select name="default_agenda_view">
+                                    {foreach from=$eventsSettings.fieldData.default_agenda_view.list item=v}
+                                    <option value="{$v.value}"
+                                            {if $eventsSettings.fieldData.default_agenda_view.value == $v.value}
+                                                selected="selected"
+                                            {/if}>
+                                        {$v.name}
+                                    </option>
+                                    {/foreach}
+                                </select>
+                            </td>
+                        </tr>
                         <tr>
                             <th>Front-End Event Options</th>
                             <td>
                                 <label> <input type="checkbox" name="event_add_button_hidden" {if $eventsSettings.fieldData.event_add_button_hidden.value}checked{/if}> Hide Add Event Button</label><br><br>
+                                <label> <input type="checkbox" name="detail_ext_links_same_window" {if $eventsSettings.fieldData.detail_ext_links_same_window.value}checked{/if}> Open detail links in same window</label><br><br>
                             </td>
                         </tr>
                         <tr>
                                         </td>
                                     </tr>
                                     <tr>
-                                        <th {if $eventsSettings.fieldRequired.agenda_container_background_color}class="glm-required"{/if}>Event Container Border Color:</th>
+                                        <th {if $eventsSettings.fieldRequired.agenda_container_background_color}class="glm-required"{/if}>Event Container Background Color:</th>
                                         <td {if $eventsSettings.fieldFail.agenda_container_background_color}class="glm-form-bad-input"{/if}>
-                                            <input type="text" data-wcp-format="css" class="colorpicker" name="agenda_container_background_color" value="{$eventsSettings.fieldData.agenda_container_background_color}" placeholder="#37426E" />
+                                            <input type="text" data-wcp-format="css" class="colorpicker" name="agenda_container_background_color" value="{$eventsSettings.fieldData.agenda_container_background_color}" placeholder="#ffffff" />
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                        <th {if $eventsSettings.fieldRequired.agenda_container_border_color}class="glm-required"{/if}>Event Container Border Color:</th>
+                                        <td {if $eventsSettings.fieldFail.agenda_container_border_color}class="glm-form-bad-input"{/if}>
+                                            <input type="text" data-wcp-format="css" class="colorpicker" name="agenda_container_border_color" value="{$eventsSettings.fieldData.agenda_container_border_color}" placeholder="#37426E" />
                                         </td>
                                     </tr>
                                 </table>
index b10419d..f239435 100644 (file)
@@ -1,69 +1,29 @@
-<style>
-#glm-event-wrapper .glm-event-cal-new {
-    border: 1px solid {if $settings.agenda_date_background_color}{$settings.agenda_date_background_color}{else}#37426E{/if};
-    font-size: 19px;
-    margin: 0 auto;
-    width: 275px;
-    border-radius: 5px;
-    text-align: center;
-}
-.glm-event-cal-day-container-new {
-    background: {if $settings.agenda_date_background_color}{$settings.agenda_date_background_color}{else}#37426E{/if};
-    color: {if $settings.agenda_date_text_color}{$settings.agenda_date_text_color}{else}white{/if};
-    padding: 10px 20px;
-}
-.glm-event-day-event::before {
-    display: none !important;
-}
-#glm-event-wrapper .glm-event-day-event {
-    border: 1px solid {if $settings.agenda_container_background_color}{$settings.agenda_container_background_color}{else}#37426E{/if} !important;
-}
-#glm-event-wrapper h2 {
-    color: {if $settings.agenda_title_color}{$settings.agenda_title_color}{else}#37426E{/if};
-    font-weight: bold;
-}
-{if $settings.event_add_button_hidden}
-#glm-event-add-event {
-    display: none !important;
-}
-{/if}
-.glm-agenda-city {
-    font-size: 13px;
-}
-</style>
-
 <div id="glm-event-wrapper">
-    <div class="row">
+    <div class="row collapse">
         {include file='front/events/searchForm.html'}
     </div>
 
-    <div id="glm-event-agenda-view" class="row" style="max-width: {if $settings.agenda_view_max_width}{$settings.agenda_view_max_width}{else}1000px{/if}; margin: 0 auto;">
+    <div id="glm-event-agenda-view" class="row">
         <div class="small-12 columns">
             {foreach $eventsByDate as $date => $key}
-                <div class="row glm-event-day-row-new open">
-                    <div class="small-12 medium-12 columns">
-                        <div class="glm-event-cal-new">
-                            <div class="glm-event-cal-day-container-new">
-                                <span>{$date|date_format:"%A %B %e"}</span>
+                <div class="row glm-event-day-row">
+                    <div class="small-12 medium-2 columns">
+                        <div class="glm-event-cal">
+                            <div class="glm-event-cal-month">{$date|date_format:"%b"}</div>
+                            <div class="glm-event-cal-day-container">
+                                <span class="glm-event-cal-day">{$date|date_format:"%e"}</span>
+                                <span class="glm-event-cal-dow">{$date|date_format:"%a"}</span>
                             </div>
-
                         </div>
                     </div>
-                    <div class="small-12 medium-12 columns">
+                    <div class="small-12 medium-10 columns">
                         {foreach $key as $events}
                             {foreach $events as $event}
-
                                 {$showTime = true}
-
-                                <div class="row glm-event-day-event" data-url="{$siteBaseUrl}{$pageSlug}/{if !$customPage}{$event.name_slug}/{else}?eventId={$event.id}{/if}">
-                                    <div class="small-12 large-8 columns">
-
-                                        <a class="glm-link" href="{$siteBaseUrl}{$pageSlug}/{if !$customPage}{$event.name_slug}/{else}?eventId={$event.id}{/if}">
-                                            <h2 class="agenda-event-name">{$event.name}</h2>
-                                        </a>
-
-                                        {$eventDateTime = $event.starting_date|date_format:"%I:%M %P"}
-
+                            <div class="row glm-event-day-event">
+                                <div class="small-12 columns">
+                                    <h2 class="agenda-event-name">{$event.name}</h2>
+                                    {$eventDateTime = $event.starting_date|date_format:"%I:%M %P"}
                                         {foreach $event.recurrences as $rec}
                                             {$start_time = $rec.start_time.time}
                                             {if $start_time == $eventDateTime}
                                                     <div class='date-range-container'>
                                                         {if !$event.all_day}
                                                             {$showTime = false}
-                                                            {if $event.starting_date|date_format:"%l:%M %P" == $event.ending_date|date_format:"%l:%M %P"}
-                                                                {$event.starting_date|date_format:"%l:%M %P"}
+                                                            {$event_start_time = $event.starting_date|date_format:"%m/%d/%Y"}
+                                                            {$event_start_time = $event_start_time|cat:' '}
+                                                            {$event_start_time = $event_start_time|cat:$rec.start_time.time}
+                                                            {$event_end_time = $event.starting_date|date_format:"%m/%d/%Y"}
+                                                            {$event_end_time = $event_end_time|cat:' '}
+                                                            {$event_end_time = $event_end_time|cat:$rec.end_time.time}
+                                                            {if $event_start_time|date_format:"%l:%M %P" == $event_end_time|date_format:"%l:%M %P" or $rec.start_time_only.value == '1'}
+                                                                {$event_start_time|date_format:"%l:%M %P"}
                                                             {else}
-                                                                {$event.starting_date|date_format:"%l:%M %P"} - {$event.ending_date|date_format:"%l:%M %P"}
+                                                                {$event_start_time|date_format:"%l:%M %P"} - {$event_end_time|date_format:"%l:%M %P"}
                                                             {/if}
 
                                                         {/if}
                                                 {/if}
                                             {/if}
                                         {/foreach}
-
-                                        {if $event.locations.city.name}
-                                           <div class="glm-agenda-city">City: {$event.locations.city.name}</div>
-                                        {/if}
-
-                                        <div class="day-times-wrapper">
-                                            {if !$event.all_day && $showTime}
-                                                {if $event.starting_date|date_format:"%l:%M %P" == $event.ending_date|date_format:"%l:%M %P"}
-                                                <div class="agenda-event-times">{$event.starting_date|date_format:"%l:%M %P"}</div>
-                                                {else}
-                                                <div class="agenda-event-times"> {$event.starting_date|date_format:"%l:%M %P"} - {$event.ending_date|date_format:"%l:%M %P"}</div>
-                                                {/if}
+                                    <div class="day-times-wrapper">
+                                        {if !$event.all_day && $showTime}
+                                            {if $event.starting_date|date_format:"%l:%M %P" == $event.ending_date|date_format:"%l:%M %P"}
+                                            <div class="agenda-event-times">{$event.starting_date|date_format:"%l:%M %P"}</div>
+                                            {else}
+                                            <div class="agenda-event-times"> {$event.starting_date|date_format:"%l:%M %P"} - {$event.ending_date|date_format:"%l:%M %P"}</div>
                                             {/if}
-                                        </div>
-                                        <div class="event-contents clearfix">
-                                            {if isset( $event.locations.name ) && $event.locations.name}
-                                                <div class="glm-agenda-city">Location: {$event.locations.name}</div>
-                                            {/if}
-
-                                            {$event.intro}
-
-                                        </div>
+                                        {/if}
                                     </div>
-                                    <div class="small-12 large-4 columns glm-events-agenda-image">
-                                        {if $event.image}<img class="" style="float:none;" src="{$imgUrl}{$event.image}">{/if}
+                                    <div class="event-content glm-hide clearfix">
+                                        {if $event.image}<img style="float:right;" data-src="{$imgUrl}{$event.image}">{/if}
+                                        {$event.intro}
+                                        <div>
+                                            <a class="glm-read-more" href="{$siteBaseUrl}{$pageSlug}/{if !$customPage}{$event.name_slug}/{else}?eventId={$event.id}{/if}">Read More</a>
+                                        </div>
                                     </div>
                                 </div>
+                            </div>
                             {/foreach}
                         {/foreach}
                     </div>
     </div>
 </div>
 
-<script>
-jQuery(document).ready(function($) {
-
-    var fullCalendarLoaded  = false;
-    var recurrencesInited   = false;
-    var locationsInited     = false;
-    var table               = 'glm-table-calendar';
-    var post_start, post_end, month_obj;
-    var rows                = $(".glm-event-day-row");
-    var agenda              = $("#glm-event-agenda-view");
-    var view_select         = $("#glm-event-view-select");
-    var search              = $("#glm-events-search-form");
-    var calendar            = $("#eventCalendar");
-    var event_search        = $(".glm-search-icon");
-    var main_content        = $("#main-content");
-    var member_id           = '{$memberId}';
-    var view                = '{$cal_view}';
-    var months              = '{$json_months}';
-    var category            = $('#glm-event-category').val();
-    var current_month       = $('{$current_month}');
-    var current_year        = $('{$current_year}');
-    var custom_page         = '{$customPage}';
-    var page_slug           = '{$pageSlug}';
-    var retain_date;
-
-    if(!member_id){
-        member_id = null;
-    }
-
-    // add 7 days to ensure we always get the current month and not any other month view that may
-    // be visible (last few days of previous month or first few days of next month)
-    function get_current_view(){
+
+
+<script type="text/javascript">
+    jQuery(document).ready(function($) {
+
+        var fullCalendarLoaded  = false;
+        var recurrencesInited   = false;
+        var locationsInited     = false;
+        var table               = 'glm-table-calendar';
+        var post_start, post_end, month_obj;
+        var rows                = $(".glm-event-day-row");
+        var agenda              = $("#glm-event-agenda-view");
+        var view_select         = $("#glm-event-view-select");
+        var search              = $("#glm-events-search-form");
+        var calendar            = $("#eventCalendar");
+        var event_search        = $(".glm-search-icon");
+        var main_content        = $("#main-content");
+        var member_id           = '{$memberId}';
+        var view                = '{$cal_view}';
+        var months              = '{$json_months}';
+        var category            = $('#glm-event-category').val();
+        var current_month       = $('{$current_month}');
+        var current_year        = $('{$current_year}');
+        var custom_page         = '{$customPage}';
+        var page_slug           = '{$pageSlug}';
         var retain_date;
-        var calCurrDate = $('#eventCalendar').fullCalendar('getView').start;
-        var d = moment(calCurrDate).add(7, 'days').format('YYYY-MM-01');
-
-        return retain_date = d;
-    }
-    function in_mobile(){
-        if($(window).width() < 641 ){
-            return true;
-        } else {
-            return false;
+
+        if(!member_id){
+            member_id = null;
         }
-    }
 
-    $('#glm-event-from').on("change", function(){
-        var from_date = $(this).val();
-        $('#glm-event-to').val(from_date);
+        // add 7 days to ensure we always get the current month and not any other month view that may
+        // be visible (last few days of previous month or first few days of next month)
+        function get_current_view(){
+            var retain_date;
+            var calCurrDate = $('#eventCalendar').fullCalendar('getView').start;
+            var d = moment(calCurrDate).add(7, 'days').format('YYYY-MM-01');
 
-    });
+            return retain_date = d;
+        }
+        function in_mobile(){
+            if($(window).width() < 641 ){
+                return true;
+            } else {
+                return false;
+            }
+        }
 
-    months = JSON.parse(months);
+        $('#glm-event-from').on("change", function(){
+            var from_date = $(this).val();
+            $('#glm-event-to').val(from_date);
 
-    event_search.on('click', function(){
-        sessionStorage.override = 'yes';
-    });
+        });
+
+        months = JSON.parse(months);
+
+        event_search.on('click', function(){
+            sessionStorage.override = 'yes';
+        });
+
+        if( sessionStorage.view && sessionStorage.override === 'no' && !in_mobile()){
+            view = sessionStorage.view;
+        } else if( sessionStorage.override === 'yes' || in_mobile()){
+            view = 'agenda';
+        }
 
-    if( sessionStorage.view && sessionStorage.override === 'no' && !in_mobile()){
-        view = sessionStorage.view;
-    } else if( sessionStorage.override === 'yes' || in_mobile()){
-        view = 'agenda';
-    }
-
-    // AJAX FUNCTION ************************************************
-    // Get calendar month via AJAX
-    function eventsCalMonthAJAX(month) {
-        var dat = {
-
-            action: 'glm_members_admin_ajax',
-            glm_action: 'eventsCalMonthAJAX',
-            month: month,
-            category: category,
-            member_id: member_id,
-            custom_page: custom_page,
-            page_slug: page_slug
-        };
-        $('.fc-event').remove();
-
-         jQuery.ajax({
-            type: 'POST',
-            url: '{$ajaxUrl}',
-            data: dat,
-            beforeSend: function(){
-                $(".event-overlay").show();
-                $(".loading").show();
+        // AJAX FUNCTION ************************************************
+        // Get calendar month via AJAX
+        function eventsCalMonthAJAX(month) {
+            var dat = {
+
+                action: 'glm_members_admin_ajax',
+                glm_action: 'eventsCalMonthAJAX',
+                month: month,
+                category: category,
+                member_id: member_id,
+                custom_page: custom_page,
+                page_slug: page_slug
+            };
+            $('.fc-event').remove();
+
+             jQuery.ajax({
+                type: 'POST',
+                url: '{$ajaxUrl}',
+                data: dat,
+                beforeSend: function(){
+                    $(".event-overlay").show();
+                    $(".loading").show();
+                },
+                complete: function(){
+                    $(".event-overlay").hide();
+                    $(".loading").hide();
+                },
+                cache: false,
+                success: function (response){
+                    var buildingEvents = [];
+                    //var events_obj = jQuery.parseJSON(response);
+                    var events_obj = response;
+                    var events = events_obj.events;
+                    buildingEvents = $.map(events, function(i, val) {
+                        return {
+                            title:   i.title,
+                            start:   i.start,
+                            end:     i.last,
+                            allDay:  i.all_day,
+                            url:     i.url,
+                            recurs:  i.recurs
+                        };
+                    });
+                    $("#eventCalendar").fullCalendar('removeEvents');
+                    $("#eventCalendar").fullCalendar('addEventSource', buildingEvents);
+                }
+            });
+            var timestamp = $.now();
+            var url = '{$ajaxUrl}' + '?t=' + timestamp;
+        }
+        var height = 900;
+        // Calendar *****************************************************
+        $('#eventCalendar').fullCalendar({
+            eventOrder: 'allDay',
+            height: height,
+            contentHeight: height,
+            eventRender: function(event, element){
+                element.attr('title', event.title);
             },
-            complete: function(){
-                $(".event-overlay").hide();
-                $(".loading").hide();
+            viewRender: function (view, element){
+                post_start = view.start._d;
+                post_end = view.end._d;
+                {literal}month_obj = {start: view.start._d, last: view.end._d};{/literal}
             },
-            cache: false,
-            success: function (response){
-                var buildingEvents = [];
-                //var events_obj = jQuery.parseJSON(response);
-                var events_obj = response;
-                var events = events_obj.events;
-                buildingEvents = $.map(events, function(i, val) {
-                    return {
-                        title:   i.title,
-                        start:   i.start,
-                        end:     i.last,
-                        allDay:  i.all_day,
-                        url:     i.url,
-                        recurs:  i.recurs
-                    };
-                });
-                $("#eventCalendar").fullCalendar('removeEvents');
-                $("#eventCalendar").fullCalendar('addEventSource', buildingEvents);
-            }
-        });
-        var timestamp = $.now();
-        var url = '{$ajaxUrl}' + '?t=' + timestamp;
-    }
-    var height = 900;
-    // Calendar *****************************************************
-    $('#eventCalendar').fullCalendar({
-        eventOrder: 'allDay',
-        height: height,
-        contentHeight: height,
-        eventRender: function(event, element){
-            element.attr('title', event.title);
-        },
-        viewRender: function (view, element){
-            post_start = view.start._d;
-            post_end = view.end._d;
-            {literal}month_obj = {start: view.start._d, last: view.end._d};{/literal}
-        },
-        header: {
-            left: 'prev,next,today',
-            center: 'title',
-            right: ''
-        },
-        dayClick: function(date, jsEvent, view) {
-            //$('#eventCalendar').fullCalendar('changeView', 'agendaDay');
-            //$('#eventCalendar').fullCalendar('gotoDate', date);
-        },
-        editable: false,
-        handleWindowResize: true,
-        lazyFetching: true,
-        eventClick : function (event){
-
-            sessionStorage.current_calendar_view = get_current_view();
-
-
-            if(custom_page !== ''){
-                location.href = event.url + '&glm_event_from=' + event.start.format();
-            } else {
-                location.href = event.url + '?glm_event_from=' + event.start.format();
-            }
+            header: {
+                left: 'prev,next,today',
+                center: 'title',
+                right: ''
+            },
+            dayClick: function(date, jsEvent, view) {
+                //$('#eventCalendar').fullCalendar('changeView', 'agendaDay');
+                //$('#eventCalendar').fullCalendar('gotoDate', date);
+            },
+            editable: false,
+            handleWindowResize: true,
+            lazyFetching: true,
+            eventClick : function (event){
+
+                sessionStorage.current_calendar_view = get_current_view();
+
 
-            return false;
-        },
-        eventLimit: true,
-        views: {
-            month: {
-                eventLimit: 4,
-                eventBackgroundColor: 'transparent',
-                eventTextColor: '#3A87AD',
-                eventBorderColor: 'transparent',
+                if(custom_page !== ''){
+                    location.href = event.url + '&glm_event_from=' + event.start.format();
+                } else {
+                    location.href = event.url + '?glm_event_from=' + event.start.format();
+                }
+
+                return false;
             },
-            agenda: {
-                eventLimit: 4
+            eventLimit: true,
+            views: {
+                month: {
+                    eventLimit: 4,
+                    eventBackgroundColor: 'transparent',
+                    eventTextColor: '#3A87AD',
+                    eventBorderColor: 'transparent',
+                },
+                agenda: {
+                    eventLimit: 4
+                }
             }
-        }
-    });
+        });
 
-    if(view === "calendar"){
-        eventsCalMonthAJAX(month_obj);
-        main_content.removeClass("small-8").addClass("small-12");
-        calendar.show();
-        view_select.val('calendar');
-
-    } else if ( view === "agenda"){
-        calendar.hide();
-        agenda.css("display", "block");
-        view_select.val('agenda');
-    }
-    $("#glm-event-view-select").on("change", function (){
-        sessionStorage.override = 'no';
-        sessionStorage.setItem("view", $(this).attr("value"));
-        if($("#glm-event-view-select option:selected").val() === "calendar"){
+        if(view === "calendar"){
             eventsCalMonthAJAX(month_obj);
-            agenda.css("display","none");
-            calendar.fadeIn('slow', function(){});
-            calendar.fullCalendar('render');
+            main_content.removeClass("small-8").addClass("small-12");
+            calendar.show();
+            view_select.val('calendar');
 
-        } else if ( $("#glm-event-view-select option:selected").val() === "agenda"){
+        } else if ( view === "agenda"){
+            calendar.hide();
             agenda.css("display", "block");
-            calendar.fadeOut('slow', function(){});
+            view_select.val('agenda');
         }
-    });
-    $(window).on("load", function(){
+        $("#glm-event-view-select").on("change", function (){
+            sessionStorage.override = 'no';
+            sessionStorage.setItem("view", $(this).attr("value"));
+            if($("#glm-event-view-select option:selected").val() === "calendar"){
+                eventsCalMonthAJAX(month_obj);
+                agenda.css("display","none");
+                calendar.fadeIn('slow', function(){});
+                calendar.fullCalendar('render');
+
+            } else if ( $("#glm-event-view-select option:selected").val() === "agenda"){
+                agenda.css("display", "block");
+                calendar.fadeOut('slow', function(){});
+            }
+        });
+        $(window).on("load", function(){
 
-        if(sessionStorage.current_calendar_view){
-            $('#event-date-toggle option').each(function(){
-                if( $(this).val() === sessionStorage.current_calendar_view){
-                    $(this).prop('selected', true);
-                }
-            });
-        }
+            if(sessionStorage.current_calendar_view){
+                $('#event-date-toggle option').each(function(){
+                    if( $(this).val() === sessionStorage.current_calendar_view){
+                        $(this).prop('selected', true);
+                    }
+                });
+            }
 
-        $('#event-date-toggle-container').insertAfter( $('.fc-left')).fadeTo('slow', 1);
+            $('#event-date-toggle-container').insertAfter( $('.fc-left')).fadeTo('slow', 1);
 
-        $('#event-date-toggle').on("change", function(){
-            var selected_date = $(this).val();
+            $('#event-date-toggle').on("change", function(){
+                var selected_date = $(this).val();
 
-            $('#eventCalendar').fullCalendar('gotoDate', selected_date);
+                $('#eventCalendar').fullCalendar('gotoDate', selected_date);
+                 eventsCalMonthAJAX(month_obj);
+                 if(sessionStorage.current_calendar_view){
+                    sessionStorage.current_calendar_view = '';
+                }
+            });
+        });
+        if(sessionStorage.current_calendar_view){
+             $('#eventCalendar').fullCalendar('gotoDate', sessionStorage.current_calendar_view);
              eventsCalMonthAJAX(month_obj);
-             if(sessionStorage.current_calendar_view){
+        }
+        // initialize calendar with AJAX calls *************************************
+        $(document).on("click", "button.fc-button", function () {
+            if(sessionStorage.current_calendar_view){
                 sessionStorage.current_calendar_view = '';
             }
+
+            eventsCalMonthAJAX(month_obj);
         });
-    });
-    if(sessionStorage.current_calendar_view){
-         $('#eventCalendar').fullCalendar('gotoDate', sessionStorage.current_calendar_view);
-         eventsCalMonthAJAX(month_obj);
-    }
-    // initialize calendar with AJAX calls *************************************
-    $(document).on("click", "button.fc-button", function () {
-        if(sessionStorage.current_calendar_view){
-            sessionStorage.current_calendar_view = '';
-        }
 
-        eventsCalMonthAJAX(month_obj);
-    });
+       $('#eventCalendar').find('.fc-today-button').on("click", function(){
+           eventsCalMonthAJAX(month_obj);
+           var current_view = get_current_view();
+           $('#event-date-toggle option').each(function(){
+                if( $(this).val() === current_view){
+                    $(this).prop('selected', true);
+                }
+            });
+       });
 
-   $('#eventCalendar').find('.fc-today-button').on("click", function(){
-       eventsCalMonthAJAX(month_obj);
-       var current_view = get_current_view();
-       $('#event-date-toggle option').each(function(){
-            if( $(this).val() === current_view){
-                $(this).prop('selected', true);
-            }
+        var dates = $(".agenda-event-recur-dates");
+        dates.each( function (){
+           if( $(this).text().indexOf('-') < 0 ){
+               $(this).remove();
+           }
         });
-   });
-
-    var dates = $(".agenda-event-recur-dates");
-    dates.each( function (){
-       if( $(this).text().indexOf('-') < 0 ){
-           $(this).remove();
-       }
-    });
 
-    // Event agenda view container click, go to event url
-    $('.glm-event-day-event').on("click", function(){
-        window.location = $(this).data('url');
     });
-
-
-});
 </script>
diff --git a/views/front/events/agenda_new.html b/views/front/events/agenda_new.html
new file mode 100644 (file)
index 0000000..8dd7b78
--- /dev/null
@@ -0,0 +1,424 @@
+<style>
+#glm-event-wrapper .glm-event-cal-new {
+    border: 1px solid {if $settings.agenda_date_background_color}{$settings.agenda_date_background_color}{else}#37426E{/if};
+    font-size: 19px;
+    margin: 0 auto;
+    width: 275px;
+    border-radius: 5px;
+    text-align: center;
+}
+.glm-event-cal-day-container-new {
+    background: {if $settings.agenda_date_background_color}{$settings.agenda_date_background_color}{else}#37426E{/if};
+    color: {if $settings.agenda_date_text_color}{$settings.agenda_date_text_color}{else}white{/if};
+    padding: 10px 20px;
+}
+.glm-event-day-event::before {
+    display: none !important;
+}
+#glm-event-wrapper .glm-event-day-event {
+    background: {if $settings.agenda_container_background_color}{$settings.agenda_container_background_color}{else}#ffffff{/if} !important;
+    border: 1px solid {if $settings.agenda_container_border_color}{$settings.agenda_container_border_color}{else}#37426E{/if} !important;
+}
+#glm-event-wrapper h2 {
+    color: {if $settings.agenda_title_color}{$settings.agenda_title_color}{else}#37426E{/if};
+    font-weight: bold;
+}
+{if $settings.event_add_button_hidden}
+#glm-event-add-event {
+    display: none !important;
+}
+{/if}
+.glm-agenda-city {
+    font-size: 13px;
+}
+</style>
+
+<div id="glm-event-wrapper">
+    <div class="row">
+        {include file='front/events/searchForm.html'}
+    </div>
+
+    <div id="glm-event-agenda-view" class="row" style="max-width: {if $settings.agenda_view_max_width}{$settings.agenda_view_max_width}{else}1000px{/if}; margin: 0 auto;">
+        <div class="small-12 columns">
+            {foreach $eventsByDate as $date => $key}
+                <div class="row glm-event-day-row-new open">
+                    <div class="small-12 medium-12 columns">
+                        <div class="glm-event-cal-new">
+                            <div class="glm-event-cal-day-container-new">
+                                <span>{$date|date_format:"%A %B %e"}</span>
+                            </div>
+
+                        </div>
+                    </div>
+                    <div class="small-12 medium-12 columns">
+                        {foreach $key as $events}
+                            {foreach $events as $event}
+
+                                {$showTime = true}
+
+                                <div class="row glm-event-day-event" data-url="{$siteBaseUrl}{$pageSlug}/{if !$customPage}{$event.name_slug}/{else}?eventId={$event.id}{/if}">
+                                    <div class="small-12 large-8 columns">
+
+                                        <a class="glm-link" href="{$siteBaseUrl}{$pageSlug}/{if !$customPage}{$event.name_slug}/{else}?eventId={$event.id}{/if}">
+                                            <h2 class="agenda-event-name">{$event.name}</h2>
+                                        </a>
+
+                                        {$eventDateTime = $event.starting_date|date_format:"%I:%M %P"}
+
+                                        {foreach $event.recurrences as $rec}
+                                            {$start_time = $rec.start_time.time}
+                                            {if $start_time == $eventDateTime}
+                                                {if ($rec.from_date.timestamp == $rec.to_date.timestamp && $rec.from_date.timestamp == $date)
+                                                or ($date <= $rec.to_date.timestamp && $date >= $rec.from_date.timestamp )}
+                                                    <div class='date-range-container'>
+                                                        {if !$event.all_day}
+                                                            {$showTime = false}
+                                                            {if $event.starting_date|date_format:"%l:%M %P" == $event.ending_date|date_format:"%l:%M %P"}
+                                                                {$event.starting_date|date_format:"%l:%M %P"}
+                                                            {else}
+                                                                {$event.starting_date|date_format:"%l:%M %P"} - {$event.ending_date|date_format:"%l:%M %P"}
+                                                            {/if}
+
+                                                        {/if}
+                                                        {if $rec.name && $rec.name != 'Imported' && $rec.name != 'Imported Event Schedule' }
+                                                            {$rec.name}
+                                                        {/if}
+                                                        ( {if $event.times|@count > 1} Occurring {/if}
+                                                        {$rec.from_date.date} <span class="agenda-event-recur-dates">
+                                                          {if $rec.from_date.date != $rec.to_date.date}
+                                                            - {$rec.to_date.date}
+                                                           {else if $rec.specific_dates}
+                                                            - {$rec.specific_dates|@end|date_format:"%m/%d/%Y"}
+                                                          {/if}
+                                                        </span>
+
+                                                    {if $rec.day_of_week.names|@count < 7 && $rec.day_of_week.names|@count > 0 }
+                                                    <span class="agenda-days-of-week">
+                                                        on
+                                                        {foreach $rec.day_of_week.names as $day}
+                                                            {if $day == "Thursday"}
+                                                                <span class="agenda-event-weekday"> {$day|substr:0:4} </span>
+                                                             {else}
+                                                                <span class="agenda-event-weekday"> {$day|substr:0:3} </span>
+                                                             {/if}
+                                                         {/foreach}
+
+                                                    </span>
+                                                    {/if}
+                                                     )
+                                                    </div>
+                                                {/if}
+                                            {/if}
+                                        {/foreach}
+
+                                        {if $event.locations.city.name}
+                                           <div class="glm-agenda-city">City: {$event.locations.city.name}</div>
+                                        {/if}
+
+                                        <div class="day-times-wrapper">
+                                            {if !$event.all_day && $showTime}
+                                                {if $event.starting_date|date_format:"%l:%M %P" == $event.ending_date|date_format:"%l:%M %P"}
+                                                <div class="agenda-event-times">{$event.starting_date|date_format:"%l:%M %P"}</div>
+                                                {else}
+                                                <div class="agenda-event-times"> {$event.starting_date|date_format:"%l:%M %P"} - {$event.ending_date|date_format:"%l:%M %P"}</div>
+                                                {/if}
+                                            {/if}
+                                        </div>
+                                        <div class="event-contents clearfix">
+                                            {if isset( $event.locations.name ) && $event.locations.name}
+                                                <div class="glm-agenda-city">Location: {$event.locations.name}</div>
+                                            {/if}
+
+                                            {$event.intro}
+
+                                        </div>
+                                    </div>
+                                    <div class="small-12 large-4 columns glm-events-agenda-image">
+                                        {if $event.image}<img class="" style="float:none;" src="{$imgUrl}{$event.image}">{/if}
+                                    </div>
+                                </div>
+                            {/foreach}
+                        {/foreach}
+                    </div>
+                </div>
+            {/foreach}
+
+        </div>
+    </div>
+    {assign var="current_year" value=$smarty.now|date_format:"%Y"}
+    {assign var="current_month" value=$smarty.now|date_format:"%m"}
+    <div id="event-date-toggle-container">
+        <label class="date-toggle-label" for="#event-date-toggle"> Select a Date <label>
+        <select id="event-date-toggle">
+            <option value="" disabled selected> Select Month</option>
+            {foreach $months as $year=>$month}{
+                {foreach $month as $m=>$value}
+                    {if $current_month == $value.date && $current_year == $year}
+                        <option value="{$year}-{$value.date}-01" selected> {$value.name} - {$year}</option>
+                    {else}
+                        <option value="{$year}-{$value.date}-01"> {$value.name} - {$year}</option>
+                    {/if}
+                {/foreach}
+            {/foreach}
+        </select>
+    </div>
+    <!-- Calendar -->
+    <div id="eventCalendar" style='position: relative;'>
+        <div class='event-overlay'>
+            <div class="loading"></div>
+        </div>
+    </div>
+</div>
+
+<script>
+jQuery(document).ready(function($) {
+
+    var fullCalendarLoaded  = false;
+    var recurrencesInited   = false;
+    var locationsInited     = false;
+    var table               = 'glm-table-calendar';
+    var post_start, post_end, month_obj;
+    var rows                = $(".glm-event-day-row");
+    var agenda              = $("#glm-event-agenda-view");
+    var view_select         = $("#glm-event-view-select");
+    var search              = $("#glm-events-search-form");
+    var calendar            = $("#eventCalendar");
+    var event_search        = $(".glm-search-icon");
+    var main_content        = $("#main-content");
+    var member_id           = '{$memberId}';
+    var view                = '{$cal_view}';
+    var months              = '{$json_months}';
+    var category            = $('#glm-event-category').val();
+    var current_month       = $('{$current_month}');
+    var current_year        = $('{$current_year}');
+    var custom_page         = '{$customPage}';
+    var page_slug           = '{$pageSlug}';
+    var retain_date;
+
+    if(!member_id){
+        member_id = null;
+    }
+
+    // add 7 days to ensure we always get the current month and not any other month view that may
+    // be visible (last few days of previous month or first few days of next month)
+    function get_current_view(){
+        var retain_date;
+        var calCurrDate = $('#eventCalendar').fullCalendar('getView').start;
+        var d = moment(calCurrDate).add(7, 'days').format('YYYY-MM-01');
+
+        return retain_date = d;
+    }
+    function in_mobile(){
+        if($(window).width() < 641 ){
+            return true;
+        } else {
+            return false;
+        }
+    }
+
+    $('#glm-event-from').on("change", function(){
+        var from_date = $(this).val();
+        $('#glm-event-to').val(from_date);
+
+    });
+
+    months = JSON.parse(months);
+
+    event_search.on('click', function(){
+        sessionStorage.override = 'yes';
+    });
+
+    if( sessionStorage.view && sessionStorage.override === 'no' && !in_mobile()){
+        view = sessionStorage.view;
+    } else if( sessionStorage.override === 'yes' || in_mobile()){
+        view = 'agenda';
+    }
+
+    // AJAX FUNCTION ************************************************
+    // Get calendar month via AJAX
+    function eventsCalMonthAJAX(month) {
+        var dat = {
+
+            action: 'glm_members_admin_ajax',
+            glm_action: 'eventsCalMonthAJAX',
+            month: month,
+            category: category,
+            member_id: member_id,
+            custom_page: custom_page,
+            page_slug: page_slug
+        };
+        $('.fc-event').remove();
+
+         jQuery.ajax({
+            type: 'POST',
+            url: '{$ajaxUrl}',
+            data: dat,
+            beforeSend: function(){
+                $(".event-overlay").show();
+                $(".loading").show();
+            },
+            complete: function(){
+                $(".event-overlay").hide();
+                $(".loading").hide();
+            },
+            cache: false,
+            success: function (response){
+                var buildingEvents = [];
+                //var events_obj = jQuery.parseJSON(response);
+                var events_obj = response;
+                var events = events_obj.events;
+                buildingEvents = $.map(events, function(i, val) {
+                    return {
+                        title:   i.title,
+                        start:   i.start,
+                        end:     i.last,
+                        allDay:  i.all_day,
+                        url:     i.url,
+                        recurs:  i.recurs
+                    };
+                });
+                $("#eventCalendar").fullCalendar('removeEvents');
+                $("#eventCalendar").fullCalendar('addEventSource', buildingEvents);
+            }
+        });
+        var timestamp = $.now();
+        var url = '{$ajaxUrl}' + '?t=' + timestamp;
+    }
+    var height = 900;
+    // Calendar *****************************************************
+    $('#eventCalendar').fullCalendar({
+        eventOrder: 'allDay',
+        height: height,
+        contentHeight: height,
+        eventRender: function(event, element){
+            element.attr('title', event.title);
+        },
+        viewRender: function (view, element){
+            post_start = view.start._d;
+            post_end = view.end._d;
+            {literal}month_obj = {start: view.start._d, last: view.end._d};{/literal}
+        },
+        header: {
+            left: 'prev,next,today',
+            center: 'title',
+            right: ''
+        },
+        dayClick: function(date, jsEvent, view) {
+            //$('#eventCalendar').fullCalendar('changeView', 'agendaDay');
+            //$('#eventCalendar').fullCalendar('gotoDate', date);
+        },
+        editable: false,
+        handleWindowResize: true,
+        lazyFetching: true,
+        eventClick : function (event){
+
+            sessionStorage.current_calendar_view = get_current_view();
+
+
+            if(custom_page !== ''){
+                location.href = event.url + '&glm_event_from=' + event.start.format();
+            } else {
+                location.href = event.url + '?glm_event_from=' + event.start.format();
+            }
+
+            return false;
+        },
+        eventLimit: true,
+        views: {
+            month: {
+                eventLimit: 4,
+                eventBackgroundColor: 'transparent',
+                eventTextColor: '#3A87AD',
+                eventBorderColor: 'transparent',
+            },
+            agenda: {
+                eventLimit: 4
+            }
+        }
+    });
+
+    if(view === "calendar"){
+        eventsCalMonthAJAX(month_obj);
+        main_content.removeClass("small-8").addClass("small-12");
+        calendar.show();
+        view_select.val('calendar');
+
+    } else if ( view === "agenda"){
+        calendar.hide();
+        agenda.css("display", "block");
+        view_select.val('agenda');
+    }
+    $("#glm-event-view-select").on("change", function (){
+        sessionStorage.override = 'no';
+        sessionStorage.setItem("view", $(this).attr("value"));
+        if($("#glm-event-view-select option:selected").val() === "calendar"){
+            eventsCalMonthAJAX(month_obj);
+            agenda.css("display","none");
+            calendar.fadeIn('slow', function(){});
+            calendar.fullCalendar('render');
+
+        } else if ( $("#glm-event-view-select option:selected").val() === "agenda"){
+            agenda.css("display", "block");
+            calendar.fadeOut('slow', function(){});
+        }
+    });
+    $(window).on("load", function(){
+
+        if(sessionStorage.current_calendar_view){
+            $('#event-date-toggle option').each(function(){
+                if( $(this).val() === sessionStorage.current_calendar_view){
+                    $(this).prop('selected', true);
+                }
+            });
+        }
+
+        $('#event-date-toggle-container').insertAfter( $('.fc-left')).fadeTo('slow', 1);
+
+        $('#event-date-toggle').on("change", function(){
+            var selected_date = $(this).val();
+
+            $('#eventCalendar').fullCalendar('gotoDate', selected_date);
+             eventsCalMonthAJAX(month_obj);
+             if(sessionStorage.current_calendar_view){
+                sessionStorage.current_calendar_view = '';
+            }
+        });
+    });
+    if(sessionStorage.current_calendar_view){
+         $('#eventCalendar').fullCalendar('gotoDate', sessionStorage.current_calendar_view);
+         eventsCalMonthAJAX(month_obj);
+    }
+    // initialize calendar with AJAX calls *************************************
+    $(document).on("click", "button.fc-button", function () {
+        if(sessionStorage.current_calendar_view){
+            sessionStorage.current_calendar_view = '';
+        }
+
+        eventsCalMonthAJAX(month_obj);
+    });
+
+   $('#eventCalendar').find('.fc-today-button').on("click", function(){
+       eventsCalMonthAJAX(month_obj);
+       var current_view = get_current_view();
+       $('#event-date-toggle option').each(function(){
+            if( $(this).val() === current_view){
+                $(this).prop('selected', true);
+            }
+        });
+   });
+
+    var dates = $(".agenda-event-recur-dates");
+    dates.each( function (){
+       if( $(this).text().indexOf('-') < 0 ){
+           $(this).remove();
+       }
+    });
+
+    // Event agenda view container click, go to event url
+    $('.glm-event-day-event').on("click", function(){
+        window.location = $(this).data('url');
+    });
+
+
+});
+</script>
diff --git a/views/front/events/agenda_old.html b/views/front/events/agenda_old.html
deleted file mode 100644 (file)
index f239435..0000000
+++ /dev/null
@@ -1,376 +0,0 @@
-<div id="glm-event-wrapper">
-    <div class="row collapse">
-        {include file='front/events/searchForm.html'}
-    </div>
-
-    <div id="glm-event-agenda-view" class="row">
-        <div class="small-12 columns">
-            {foreach $eventsByDate as $date => $key}
-                <div class="row glm-event-day-row">
-                    <div class="small-12 medium-2 columns">
-                        <div class="glm-event-cal">
-                            <div class="glm-event-cal-month">{$date|date_format:"%b"}</div>
-                            <div class="glm-event-cal-day-container">
-                                <span class="glm-event-cal-day">{$date|date_format:"%e"}</span>
-                                <span class="glm-event-cal-dow">{$date|date_format:"%a"}</span>
-                            </div>
-                        </div>
-                    </div>
-                    <div class="small-12 medium-10 columns">
-                        {foreach $key as $events}
-                            {foreach $events as $event}
-                                {$showTime = true}
-                            <div class="row glm-event-day-event">
-                                <div class="small-12 columns">
-                                    <h2 class="agenda-event-name">{$event.name}</h2>
-                                    {$eventDateTime = $event.starting_date|date_format:"%I:%M %P"}
-                                        {foreach $event.recurrences as $rec}
-                                            {$start_time = $rec.start_time.time}
-                                            {if $start_time == $eventDateTime}
-                                                {if ($rec.from_date.timestamp == $rec.to_date.timestamp && $rec.from_date.timestamp == $date)
-                                                or ($date <= $rec.to_date.timestamp && $date >= $rec.from_date.timestamp )}
-                                                    <div class='date-range-container'>
-                                                        {if !$event.all_day}
-                                                            {$showTime = false}
-                                                            {$event_start_time = $event.starting_date|date_format:"%m/%d/%Y"}
-                                                            {$event_start_time = $event_start_time|cat:' '}
-                                                            {$event_start_time = $event_start_time|cat:$rec.start_time.time}
-                                                            {$event_end_time = $event.starting_date|date_format:"%m/%d/%Y"}
-                                                            {$event_end_time = $event_end_time|cat:' '}
-                                                            {$event_end_time = $event_end_time|cat:$rec.end_time.time}
-                                                            {if $event_start_time|date_format:"%l:%M %P" == $event_end_time|date_format:"%l:%M %P" or $rec.start_time_only.value == '1'}
-                                                                {$event_start_time|date_format:"%l:%M %P"}
-                                                            {else}
-                                                                {$event_start_time|date_format:"%l:%M %P"} - {$event_end_time|date_format:"%l:%M %P"}
-                                                            {/if}
-
-                                                        {/if}
-                                                        {if $rec.name && $rec.name != 'Imported' && $rec.name != 'Imported Event Schedule' }
-                                                            {$rec.name}
-                                                        {/if}
-                                                        ( {if $event.times|@count > 1} Occurring {/if}
-                                                        {$rec.from_date.date} <span class="agenda-event-recur-dates">
-                                                          {if $rec.from_date.date != $rec.to_date.date}
-                                                            - {$rec.to_date.date}
-                                                           {else if $rec.specific_dates}
-                                                            - {$rec.specific_dates|@end|date_format:"%m/%d/%Y"}
-                                                          {/if}
-                                                        </span>
-
-                                                    {if $rec.day_of_week.names|@count < 7 && $rec.day_of_week.names|@count > 0 }
-                                                    <span class="agenda-days-of-week">
-                                                        on
-                                                        {foreach $rec.day_of_week.names as $day}
-                                                            {if $day == "Thursday"}
-                                                                <span class="agenda-event-weekday"> {$day|substr:0:4} </span>
-                                                             {else}
-                                                                <span class="agenda-event-weekday"> {$day|substr:0:3} </span>
-                                                             {/if}
-                                                         {/foreach}
-
-                                                    </span>
-                                                    {/if}
-                                                     )
-                                                    </div>
-                                                {/if}
-                                            {/if}
-                                        {/foreach}
-                                    <div class="day-times-wrapper">
-                                        {if !$event.all_day && $showTime}
-                                            {if $event.starting_date|date_format:"%l:%M %P" == $event.ending_date|date_format:"%l:%M %P"}
-                                            <div class="agenda-event-times">{$event.starting_date|date_format:"%l:%M %P"}</div>
-                                            {else}
-                                            <div class="agenda-event-times"> {$event.starting_date|date_format:"%l:%M %P"} - {$event.ending_date|date_format:"%l:%M %P"}</div>
-                                            {/if}
-                                        {/if}
-                                    </div>
-                                    <div class="event-content glm-hide clearfix">
-                                        {if $event.image}<img style="float:right;" data-src="{$imgUrl}{$event.image}">{/if}
-                                        {$event.intro}
-                                        <div>
-                                            <a class="glm-read-more" href="{$siteBaseUrl}{$pageSlug}/{if !$customPage}{$event.name_slug}/{else}?eventId={$event.id}{/if}">Read More</a>
-                                        </div>
-                                    </div>
-                                </div>
-                            </div>
-                            {/foreach}
-                        {/foreach}
-                    </div>
-                </div>
-            {/foreach}
-
-        </div>
-    </div>
-    {assign var="current_year" value=$smarty.now|date_format:"%Y"}
-    {assign var="current_month" value=$smarty.now|date_format:"%m"}
-    <div id="event-date-toggle-container">
-        <label class="date-toggle-label" for="#event-date-toggle"> Select a Date <label>
-        <select id="event-date-toggle">
-            <option value="" disabled selected> Select Month</option>
-            {foreach $months as $year=>$month}{
-                {foreach $month as $m=>$value}
-                    {if $current_month == $value.date && $current_year == $year}
-                        <option value="{$year}-{$value.date}-01" selected> {$value.name} - {$year}</option>
-                    {else}
-                        <option value="{$year}-{$value.date}-01"> {$value.name} - {$year}</option>
-                    {/if}
-                {/foreach}
-            {/foreach}
-        </select>
-    </div>
-    <!-- Calendar -->
-    <div id="eventCalendar" style='position: relative;'>
-        <div class='event-overlay'>
-            <div class="loading"></div>
-        </div>
-    </div>
-</div>
-
-
-
-<script type="text/javascript">
-    jQuery(document).ready(function($) {
-
-        var fullCalendarLoaded  = false;
-        var recurrencesInited   = false;
-        var locationsInited     = false;
-        var table               = 'glm-table-calendar';
-        var post_start, post_end, month_obj;
-        var rows                = $(".glm-event-day-row");
-        var agenda              = $("#glm-event-agenda-view");
-        var view_select         = $("#glm-event-view-select");
-        var search              = $("#glm-events-search-form");
-        var calendar            = $("#eventCalendar");
-        var event_search        = $(".glm-search-icon");
-        var main_content        = $("#main-content");
-        var member_id           = '{$memberId}';
-        var view                = '{$cal_view}';
-        var months              = '{$json_months}';
-        var category            = $('#glm-event-category').val();
-        var current_month       = $('{$current_month}');
-        var current_year        = $('{$current_year}');
-        var custom_page         = '{$customPage}';
-        var page_slug           = '{$pageSlug}';
-        var retain_date;
-
-        if(!member_id){
-            member_id = null;
-        }
-
-        // add 7 days to ensure we always get the current month and not any other month view that may
-        // be visible (last few days of previous month or first few days of next month)
-        function get_current_view(){
-            var retain_date;
-            var calCurrDate = $('#eventCalendar').fullCalendar('getView').start;
-            var d = moment(calCurrDate).add(7, 'days').format('YYYY-MM-01');
-
-            return retain_date = d;
-        }
-        function in_mobile(){
-            if($(window).width() < 641 ){
-                return true;
-            } else {
-                return false;
-            }
-        }
-
-        $('#glm-event-from').on("change", function(){
-            var from_date = $(this).val();
-            $('#glm-event-to').val(from_date);
-
-        });
-
-        months = JSON.parse(months);
-
-        event_search.on('click', function(){
-            sessionStorage.override = 'yes';
-        });
-
-        if( sessionStorage.view && sessionStorage.override === 'no' && !in_mobile()){
-            view = sessionStorage.view;
-        } else if( sessionStorage.override === 'yes' || in_mobile()){
-            view = 'agenda';
-        }
-
-        // AJAX FUNCTION ************************************************
-        // Get calendar month via AJAX
-        function eventsCalMonthAJAX(month) {
-            var dat = {
-
-                action: 'glm_members_admin_ajax',
-                glm_action: 'eventsCalMonthAJAX',
-                month: month,
-                category: category,
-                member_id: member_id,
-                custom_page: custom_page,
-                page_slug: page_slug
-            };
-            $('.fc-event').remove();
-
-             jQuery.ajax({
-                type: 'POST',
-                url: '{$ajaxUrl}',
-                data: dat,
-                beforeSend: function(){
-                    $(".event-overlay").show();
-                    $(".loading").show();
-                },
-                complete: function(){
-                    $(".event-overlay").hide();
-                    $(".loading").hide();
-                },
-                cache: false,
-                success: function (response){
-                    var buildingEvents = [];
-                    //var events_obj = jQuery.parseJSON(response);
-                    var events_obj = response;
-                    var events = events_obj.events;
-                    buildingEvents = $.map(events, function(i, val) {
-                        return {
-                            title:   i.title,
-                            start:   i.start,
-                            end:     i.last,
-                            allDay:  i.all_day,
-                            url:     i.url,
-                            recurs:  i.recurs
-                        };
-                    });
-                    $("#eventCalendar").fullCalendar('removeEvents');
-                    $("#eventCalendar").fullCalendar('addEventSource', buildingEvents);
-                }
-            });
-            var timestamp = $.now();
-            var url = '{$ajaxUrl}' + '?t=' + timestamp;
-        }
-        var height = 900;
-        // Calendar *****************************************************
-        $('#eventCalendar').fullCalendar({
-            eventOrder: 'allDay',
-            height: height,
-            contentHeight: height,
-            eventRender: function(event, element){
-                element.attr('title', event.title);
-            },
-            viewRender: function (view, element){
-                post_start = view.start._d;
-                post_end = view.end._d;
-                {literal}month_obj = {start: view.start._d, last: view.end._d};{/literal}
-            },
-            header: {
-                left: 'prev,next,today',
-                center: 'title',
-                right: ''
-            },
-            dayClick: function(date, jsEvent, view) {
-                //$('#eventCalendar').fullCalendar('changeView', 'agendaDay');
-                //$('#eventCalendar').fullCalendar('gotoDate', date);
-            },
-            editable: false,
-            handleWindowResize: true,
-            lazyFetching: true,
-            eventClick : function (event){
-
-                sessionStorage.current_calendar_view = get_current_view();
-
-
-                if(custom_page !== ''){
-                    location.href = event.url + '&glm_event_from=' + event.start.format();
-                } else {
-                    location.href = event.url + '?glm_event_from=' + event.start.format();
-                }
-
-                return false;
-            },
-            eventLimit: true,
-            views: {
-                month: {
-                    eventLimit: 4,
-                    eventBackgroundColor: 'transparent',
-                    eventTextColor: '#3A87AD',
-                    eventBorderColor: 'transparent',
-                },
-                agenda: {
-                    eventLimit: 4
-                }
-            }
-        });
-
-        if(view === "calendar"){
-            eventsCalMonthAJAX(month_obj);
-            main_content.removeClass("small-8").addClass("small-12");
-            calendar.show();
-            view_select.val('calendar');
-
-        } else if ( view === "agenda"){
-            calendar.hide();
-            agenda.css("display", "block");
-            view_select.val('agenda');
-        }
-        $("#glm-event-view-select").on("change", function (){
-            sessionStorage.override = 'no';
-            sessionStorage.setItem("view", $(this).attr("value"));
-            if($("#glm-event-view-select option:selected").val() === "calendar"){
-                eventsCalMonthAJAX(month_obj);
-                agenda.css("display","none");
-                calendar.fadeIn('slow', function(){});
-                calendar.fullCalendar('render');
-
-            } else if ( $("#glm-event-view-select option:selected").val() === "agenda"){
-                agenda.css("display", "block");
-                calendar.fadeOut('slow', function(){});
-            }
-        });
-        $(window).on("load", function(){
-
-            if(sessionStorage.current_calendar_view){
-                $('#event-date-toggle option').each(function(){
-                    if( $(this).val() === sessionStorage.current_calendar_view){
-                        $(this).prop('selected', true);
-                    }
-                });
-            }
-
-            $('#event-date-toggle-container').insertAfter( $('.fc-left')).fadeTo('slow', 1);
-
-            $('#event-date-toggle').on("change", function(){
-                var selected_date = $(this).val();
-
-                $('#eventCalendar').fullCalendar('gotoDate', selected_date);
-                 eventsCalMonthAJAX(month_obj);
-                 if(sessionStorage.current_calendar_view){
-                    sessionStorage.current_calendar_view = '';
-                }
-            });
-        });
-        if(sessionStorage.current_calendar_view){
-             $('#eventCalendar').fullCalendar('gotoDate', sessionStorage.current_calendar_view);
-             eventsCalMonthAJAX(month_obj);
-        }
-        // initialize calendar with AJAX calls *************************************
-        $(document).on("click", "button.fc-button", function () {
-            if(sessionStorage.current_calendar_view){
-                sessionStorage.current_calendar_view = '';
-            }
-
-            eventsCalMonthAJAX(month_obj);
-        });
-
-       $('#eventCalendar').find('.fc-today-button').on("click", function(){
-           eventsCalMonthAJAX(month_obj);
-           var current_view = get_current_view();
-           $('#event-date-toggle option').each(function(){
-                if( $(this).val() === current_view){
-                    $(this).prop('selected', true);
-                }
-            });
-       });
-
-        var dates = $(".agenda-event-recur-dates");
-        dates.each( function (){
-           if( $(this).text().indexOf('-') < 0 ){
-               $(this).remove();
-           }
-        });
-
-    });
-</script>
index d4c8a24..29e6698 100755 (executable)
                             <div id="glm-event-detail-cost"><strong>Cost: </strong>FREE</div>
                             {/if}
                             {if $event.ticket_url}
-                            <div id="glm-event-detail-tickets"><a target="_blank" href="{$event.ticket_url}"><strong>Tickets</strong></a></div>
+                            <div id="glm-event-detail-tickets"><a{if !$settings.detail_ext_links_same_window} target="_blank"{/if} href="{$event.ticket_url}"><strong>Tickets</strong></a></div>
                             {/if}
                             {if $event.registration_url}
-                            <div id="glm-event-detail-registrations"><a target="_blank" href="{$event.registration_url}"><strong>Registration</strong></a></div>
+                            <div id="glm-event-detail-registrations"><a{if !$settings.detail_ext_links_same_window} target="_blank"{/if} href="{$event.registration_url}"><strong>Registration</strong></a></div>
                             {/if}
 
                             <div id="glm-event-detail-contact"><strong>Contact & More Info</strong><br>
-                                {if $event.url}<a href="{$event.url}" target="_blank">{$event.url}</a><br>{/if}
+                                {if $event.url}<a href="{$event.url}"{if !$settings.detail_ext_links_same_window} target="_blank"{/if}>{$event.url}</a><br>{/if}
                                 {if $event.contact_name}Contact: {$event.contact_name}<br>{/if}
                                 {if $event.contact_email}Email: <a href="mailto: {$event.contact_email}">{$event.contact_email}</a><br>{/if}
                                 {if $event.contact_phone}
             $("#glm-event-detail-takeback-mini span").css('opacity','1');
         }
 
-        {if $settings.selected_map_interface == 1}    
-        
+        {if $settings.selected_map_interface == 1}
+
         /*
          *  Leaflet Map
          *  API reference: https://leafletjs.com/reference-1.3.2.html
         // Get member location if available, otherwise use this site's default locatgion
         var myLocation = false;
         var eventLat = $("#event-lat").attr('rel');
-        var eventLon = $("#event-lon").attr('rel');  
+        var eventLon = $("#event-lon").attr('rel');
         var mapType = "eventDetail-map";
         var mapOptions = { dragging: false, zoomControl: false };
         var attributionText = 'Map &copy; <a href="https://www.openstreetmap.org/">OpenStreetMap</a> Contrib, <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>';
 
         function initMap() {
-        
+
             var leafletMap = L.map(mapType, mapOptions ).setView([eventLat, eventLon], {$settings.maps_default_zoom});
             var leafletTileServer = '{$settings.leaflet_tile_server}/{$settings.leaflet_tile_server_key}/' + {literal}'{z}/{x}/{y}.png'{/literal};
             var leafletMinZoom = 5;
                 delayIndicator: 500
             });
             leafletMap.addControl(loadingControl);
-            
+
             // Marker
             var leafletMarker = L.marker([eventLat, eventLon]).addTo(leafletMap);
-        
+
         }
 
         $(window).load(function(){
                 largeMapinit = true;
             }
         });
-        
+
   {/if}
 
-      
+
         // Replace the phone separation character with whatever is set in the management
         {if $settings.phone_infix}
             //var processedPhone = $('.glm-event-detail-contact-phone .glm-field-value').text().trim().replace(/[^a-zA-Z0-9 ]/g, '{$settings.phone_infix}');