);
- // If the Contacts add-on exists
- if (isset($this->config['addOns']['glm-member-db-contacts'])) {
-
- // Contact Reference - Points to Contacts add-on contacts table
- $this->fields['contact_addon_id'] = array (
- 'field' => 'contact_addon_id',
- 'type' => 'pointer',
- 'p_table' => GLM_MEMBERS_CONTACTS_PLUGIN_DB_PREFIX . 'contacts',
- 'p_field' => 'name',
- 'p_orderby' => 'name',
- 'p_blank' => true,
- // 'force_list' => true,
- 'use' => 'a'
- );
-
-
- }
-
}
/*
'use' => 'a'
),
+ // All Dates Flag
+ 'all_dates' => array (
+ 'field' => 'all_dates',
+ 'type' => 'checkbox',
+ 'default' => false,
+ 'use' => 'a'
+ ),
+
// Month of Year - multi-pick (bitmap)
'month_of_year' => array(
'field' => 'month_of_year',
// Determine time each event starts at
$time = $start->format('H:i');
- // For each year in recurrence range
- for ($year = $fromYear ; $year <= $toYear ; $year++ ) {
+ // If this is an All Dates event
+ if ($recurData['all_dates']['value']) {
- // For each month selected
- foreach ($recurData['month_of_year']['names'] as $km=>$month) {
+ // for each date from From through To
+ for ($date = clone $from ; $date <= $to ; $date->modify('+1 day')) {
+ $t = new DateTime($date->format('m/d/Y ').$time);
+ $dates[$t->getTimestamp()] = $t;
+ }
- // If selecting by days of the month
- if ($recurData['by_day_of_month']['value']) {
+ // Otherwise we'll use the rest of the recurrence schedule data
+ } else {
- // For each specified days of the month ($dom is day of month)
- foreach ($recurData['day_of_month']['names'] as $kdom=>$dom) {
- $t = new DateTime("$month $dom $year $time");
- $dates[$t->getTimestamp()] = $t;
- }
+ // For each year in recurrence range
+ for ($year = $fromYear ; $year <= $toYear ; $year++ ) {
- // If last day of month is selected
- if ($recurData['last_day_of_month']['value']) {
- $t = new DateTime("last day of $month $year $time");
- $dates[$t->getTimestamp()] = $t;
- }
+ // For each month selected
+ foreach ($recurData['month_of_year']['names'] as $km=>$month) {
- } else {
+ // If selecting by days of the month
+ if ($recurData['by_day_of_month']['value']) {
- // For each week selected
- foreach ($recurData['week_of_month']['names'] as $kw=>$week) {
+ // For each specified days of the month ($dom is day of month)
+ foreach ($recurData['day_of_month']['names'] as $kdom=>$dom) {
+ $t = new DateTime("$month $dom $year $time");
+ $dates[$t->getTimestamp()] = $t;
+ }
- // For each day selected
- foreach ($recurData['day_of_week']['names'] as $kd=>$day) {
- $t = new DateTime("$week $day of $month $year $time");
+ // If last day of month is selected
+ if ($recurData['last_day_of_month']['value']) {
+ $t = new DateTime("last day of $month $year $time");
$dates[$t->getTimestamp()] = $t;
}
+ } else {
+
+ // For each week selected
+ foreach ($recurData['week_of_month']['names'] as $kw=>$week) {
+
+ // For each day selected
+ foreach ($recurData['day_of_week']['names'] as $kd=>$day) {
+ $t = new DateTime("$week $day of $month $year $time");
+ $dates[$t->getTimestamp()] = $t;
+ }
+
+ }
+
}
- }
+ } // Month of Year
- } // Month of Year
+ } // Year
- } // Year
+ }
// Check if the recurrences caught the "First Occurance"
if (!isset($dates[$start->getTimestamp()])) {
$thisDate = $v->getTimestamp();
- // If date is within from and to range (we didn't check this above)
+ // If date is within from and to range (we may not have checked this above)
if ($thisDate >= $fromTime && $thisDate <= $toTime ) {
// Create text start date and time of this instance
$thisStartTime = $v->format('Y/m/d').date(' H:i:s', $recurData['start_time']['timestamp']);
- $tst = new DateTime($thisStartTime);
// Create text end date and time of this instance
- $tet = $tst;
+ $tet = new DateTime($thisStartTime);
$tet->add($length);
$thisEndTime = $tet->format('Y/m/d H:i:s');
* version from this plugin.
*/
define('GLM_MEMBERS_EVENTS_PLUGIN_VERSION', '0.0.1');
-define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.3');
+define('GLM_MEMBERS_EVENTS_PLUGIN_DB_VERSION', '0.0.4');
// This is the minimum version of the GLM Members DB plugin require for this plugin.
define('GLM_MEMBERS_EVENTS_PLUGIN_MIN_MEMBERS_REQUIRED_VERSION', '1.0.58');
$filterPending = false;
$eventDeleted = false;
$eventDeleteError = false;
+ $locations = false;
+ $haveLocations = false;
+ $numbLocations = 0;
$recurrences = false;
$haveRecurrences = false;
$numbRecurrences = 0;
$Categories = new GlmDataEventsCategories($this->wpdb, $this->config);
$categories = $Categories->getListSortedParentChild(false);
- // Load recurrences data class to deal with event times
+ // Load locations data class to get a blank entry for the template
+ require_once(GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataLocations.php');
+ $Locations = new GlmDataEventsLocations($this->wpdb, $this->config);
+ $newLocation = $Locations->newEntry();
+
+ // Load recurrences data class to get a blank entry for the template
require_once(GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataRecurrences.php');
$Recurrences = new GlmDataEventsRecurrences($this->wpdb, $this->config);
$newRecurrence = $Recurrences->newEntry();
'filterPending' => $filterPending,
'eventDeleted' => $eventDeleted,
'eventDeleteError' => $eventDeleteError,
+ 'locations' => $locations,
+ 'haveLocations' => $haveLocations,
+ 'numbLocations' => $numbLocations,
+ 'newLocation' => $newLocation,
'recurrences' => $recurrences,
'haveRecurrences' => $haveRecurrences,
'numbRecurrences' => $numbRecurrences,
+++ /dev/null
--- Gaslight Media Members Database - Events Add-On
--- File Created: 12/02/15 15:27:15
--- Database Version: 0.0.1
--- Database Creation Script
---
--- This file is called to create a new set of tables for this
--- add-on for the most receint database version for this add-on.
---
--- There should only be one such file in this directory
---
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
-
--- 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
- start_time DATETIME NULL, -- Start of first occurance (date and time)
- end_time DATETIME NULL, -- End of first occurance (date and time)
- from_date DATE NULL, -- From Date for recurrences
- to_date DATE NULL, -- To Date for recurrences
- all_day BOOLEAN NULL, -- Flag indicating if this is an all-day event (inforational only)
- 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
- 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 recurrance entry
- active BOOLEAN NULL, -- Active flag - normally set but used to temporarily dissable 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 referernced 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 abreviation
- 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 contact is associated with - See config['ref_type']
- ref_dest INT NULL, -- Pointer to the specific entity of ref_type this contact 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
- url TINYTEXT NULL, -- Event URL
- cost TINYTEXT NULL, -- Description of event cost
- 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
- PRIMARY KEY (id)
-);
-
-----
-
--- Set default event management entry
-INSERT INTO {prefix}management
- ( id, canonical_event_page )
- VALUES
- ( 1, 'event-detail' )
-;
-
--- /dev/null
+-- Gaslight Media Members Database - Events Add-On
+-- File Created: 12/02/15 15:27:15
+-- Database Version: 0.0.1
+-- Database Creation Script
+--
+-- This file is called to create a new set of tables for this
+-- add-on for the most receint database version for this add-on.
+--
+-- There should only be one such file in this directory
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashes
+
+-- 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
+ start_time DATETIME NULL, -- Start of first occurance (date and time)
+ end_time DATETIME NULL, -- End of first occurance (date and time)
+ from_date DATE NULL, -- From Date for recurrences
+ to_date DATE NULL, -- To Date for recurrences
+ all_day BOOLEAN NULL, -- Flag indicating if this is an all-day event (inforational only)
+ all_dates BOOLEAN NULL, -- Flag indicating that event recurrs on all dates from from_date through to_date
+ 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
+ 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 recurrance entry
+ active BOOLEAN NULL, -- Active flag - normally set but used to temporarily dissable 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 referernced 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 abreviation
+ 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 contact is associated with - See config['ref_type']
+ ref_dest INT NULL, -- Pointer to the specific entity of ref_type this contact 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
+ url TINYTEXT NULL, -- Event URL
+ cost TINYTEXT NULL, -- Description of event cost
+ old_event_id INT NULL, -- ID of event from old site for reference
+ 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
+ PRIMARY KEY (id)
+);
+
+----
+
+-- Set default event management entry
+INSERT INTO {prefix}management
+ ( id, canonical_event_page )
+ VALUES
+ ( 1, 'event-detail' )
+;
+
$glmMembersEventsDbVersions = array(
'0.0.1' => array('version' => '0.0.1', 'tables' => 6),
'0.0.2' => array('version' => '0.0.2', 'tables' => 7),
- '0.0.3' => array('version' => '0.0.3', 'tables' => 7)
+ '0.0.3' => array('version' => '0.0.3', 'tables' => 7),
+ '0.0.4' => array('version' => '0.0.4', 'tables' => 7)
);
+++ /dev/null
--- Gaslight Media Members Database - Sample
--- File Created: 12/02/15 15:27:15
--- Database Version: 0.0.1
--- Database Creation Script
---
--- This file is called to create a new set of tables for this
--- add-on for the most receint database version for this add-on.
---
--- There should only be one such file in this directory
---
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashes
-
-
--- **********************************************************************
--- NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
---
--- Please change all references to sample, Sample, or SAMPLE to a name
--- appropriate for your new Add-On.
---
--- Tables and queries in this file are sample only.
---
--- Remove this message before using this file in production!
--- **********************************************************************/
-
-
--- Sample Table
-CREATE TABLE {prefix}sometablename (
- id INT NOT NULL AUTO_INCREMENT,
- somefield TINYTEXT NULL,
- PRIMARY KEY (id)
-);
-
-----
-
--- Sample default entry in table
-INSERT INTO {prefix}sometablename
- ( id, somefield )
- VALUES
- ( 1, 'sample data' )
-;
-
+++ /dev/null
-<?php
-/**
- * Gaslight Media Members Database
- * GLM Members Sample DB Versions
- *
- * PHP version 5.5
- *
- * @category glmWordPressPlugin
- * @package glmMembersDatabase
- * @author Chuck Scott <cscott@gaslightmedia.com>
- * @license http://www.gaslightmedia.com Gaslightmedia
- * @release dbVersions.php,v 1.0 2014/10/31 19:31:47 cscott Exp $
- * @link http://dev.gaslightmedia.com/
- */
-
-
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This file lists all versions of the database tables for this add-on.
- * The last entry in the array below should be for the most recent
- * version and should match the "create_database_V..." file in this
- * directory.
- *
- * NOTE: When first creating a new add-on with database tables, there
- * should only be one line in the array below and there should be no
- * "update_database..." files in this directory.
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
-
-$glmMembersSampleDbVersions = array(
- '0.0.1' => array('version' => '0.0.1', 'tables' => 1),
- '0.0.2' => array('version' => '0.0.2', 'tables' => 2)
-);
-
+++ /dev/null
-DATABASE EXAMPLE FILES
-----------------------
-
-*** THESE ARE EXAMPLES ONLY ***
-
-The files in this directory are examples only. Do not use any of these as they are!
-
-The example here is of a set of one table for the add-on that is initially created
-by the create_database_V0.0.1.sql script. That file creates one table and inserts
-one entry into that table.
-
-In this example, the database is later updated by two files. Either of these may
-be included separately if only a PHP file is needed to update the database, or
-just an SQL script. Sometimes both are needed.
-
-There is also an entry in the dbVersions.php file that describes the update.
-
-Note that the number of tables needs to be set to the updated number for each update.
-
-Also note taht the SQL update scripts are run before the PHP update scripts.
-
+++ /dev/null
-<?php
-/*
- * Gaslight Media Members Database - Sample Add-On
- *
- * Database Update Script for version 0.0.2
- */
-
-/**********************************************************************
- * NOTE: THIS IS A SAMPLE FILE - DO NOT USE UNMODIFIED
- *
- * Please change all references to sample, Sample, or SAMPLE to a name
- * appropriate for your new Add-On.
- *
- * This is a sample database update process. There should be an SQL
- * script for each update in this directory. This php file is optionsl
- * and can be used to perform more complex data updates.
- *
- * If this file exists, it is called after the matching SQL script has
- * been run.
- *
- * ******** THE CODE BELOW IS STICTLY A SAMPLE ********
- *
- * Remove this message before using this file in production!
- **********************************************************************/
-
-/*
- * Update sample records to take data from one field, change it, then store it in the new field
- */
-
-// Get all records from the sometablename table.
-$sampleRecords = $this->wpdb->get_results('SELECT id, title FROM '.GLM_MEMBERS_SAMPLE_PLUGIN_DB_PREFIX.'sometablename;', ARRAY_A);
-
-// If there's any records
-if ($sampleRecords && count($sampleRecords) > 0) {
-
- // For each record
- foreach ($sampleRecords as $p) {
-
- // Create a slug from the somefield field
- $newData = sanitize_title($p['somefield']).'-'.$p['id'];
-
- // Store this value back into the record in the new yetanotherfield field
- $this->wpdb->update(
- GLM_MEMBERS_SAMPLE_PLUGIN_DB_PREFIX.'sometablename',
- array(
- 'yetanotherfield' => $slug
- ),
- array( 'id' => $p['id'] ),
- array( '%s' ),
- array( '%d')
- );
- }
-
-}
+++ /dev/null
--- Gaslight Media Members Database
--- File Created: 12/09/14 15:27:15
--- Database Version: 0.0.2
--- Database Update From Previous Version Script
---
--- To permit each query below to be executed separately,
--- all queries must be separated by a line with four dashses
-
--- A sample database update script
-CREATE TABLE {prefix}anothertablename (
- id INT NOT NULL AUTO_INCREMENT,
- anotherfield TINYTEXT NULL,
- PRIMARY KEY (id)
-);
-
-----
-
-ALTER TABLE {prefix}sometablename ADD COLUMN yetanotherfield TINYTEXT;
-
-
-
--- /dev/null
+-- Gaslight Media Members Database - Events Add-On
+-- File Created: 12/09/14 15:27:15
+-- Database Version: 0.0.2
+-- Database Update From Previous Version Script
+--
+-- To permit each query below to be executed separately,
+-- all queries must be separated by a line with four dashses
+
+
+-- Add all_dates field
+ALTER TABLE {prefix}recurrences ADD COLUMN all_dates BOOLEAN;
+
+----
+
+-- Add old_event_id field
+ALTER TABLE {prefix}events ADD COLUMN old_event_id INTEGER;
+
+
+
+
+
{include file='admin/events/header.html'}
-
+
{if apply_filters('glm_members_permit_admin_members_packaging_edit_package', true)}
<a href="{$thisUrl}?page={$thisPage}&glm_action=list" class="button button-primary glm-button glm-right">Return to Events List</a>
{if $option == 'edit'}
<a id="deleteEventButton" class="button button-primary glm-button glm-right">Delete this Event</a>
-
+
<h2>Edit Event</h2>
{else}
<h2>Add new Event</h2>
{/if}
-
+
<form action="{$thisUrl}?page={$thisPage}" method="post" enctype="multipart/form-data">
<input type="hidden" name="glm_action" value="list">
{if $eventAdded}<span class="glm-notice glm-flash-updated glm-right">Event Added</span>{/if}
{if $eventAddError}<span class="glm-error glm-flash-updated glm-right">Event Add Error</span>{/if}
</h2>
-
+
<!-- Status and Description -->
-
- <table id="glm-table-descr" class="glm-admin-table glm-event-table">
- <tr>
- <th {if $event.fieldRequired.name}class="glm-required"{/if}>Event Name:</th>
- <td {if $event.fieldFail.name}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
- <input type="text" name="name" value="{$event.fieldData.name}" class="glm-form-text-input-medium" placeholder="Name of this event.">
- {if $event.fieldFail.name}<p>{$event.fieldFail.name}</p>{/if}<br>
- </td>
- </tr>
- {if $haveEvent}
- <tr>
- <th>Name for URLs:</th>
- <td>{$event.fieldData.name_slug}</td>
- </tr>
- <tr>
- <th>Created:</th>
- <td>{$event.fieldData.created.datetime}</td>
- </tr>
- <tr>
- <th>Last Updated:</th>
- <td>{$event.fieldData.updated.datetime}</td>
- </tr>
- <tr>
- <th>Last Approved:</th>
- <td>{$event.fieldData.approved.datetime}</td>
- </tr>
- {/if}
- <tr>
- <th>Status:</th>
- <td>
- <select name="status">
- {foreach $event.fieldData.status.list as $v}
- <option value="{$v.value}"{if $v.default} selected{/if}>{$v.name}</option>
- {/foreach}
- </select>
- {if $event.fieldFail.status}<p>{$event.fieldFail.status}</p>{/if}
- </td>
- </tr>
- <tr>
- <th>Hide Member Address:</th>
- <td>
- <input type="checkbox" name="hide_address" {if $event.fieldData.hide_address.value} checked{/if}>
- </td>
- </tr>
- <tr>
- <th>Featured Event:</th>
- <td>
- <input type="checkbox" name="featured" {if $event.fieldData.featured.value} checked{/if}>
- </td>
- </tr>
- <tr>
- <th>Include in Slideshow:</th>
- <td>
- <input type="checkbox" name="slideshow" {if $event.fieldData.slideshow.value} checked{/if}>
- </td>
- </tr>
- <tr>
- <th>Major Event:</th>
- <td>
- <input type="checkbox" name="major" {if $event.fieldData.major.value} checked{/if}>
- </td>
- </tr>
- <tr>
- <th>Categories</th>
- <td class="glm-item-container">
-
- <!-- Add new category dialog -->
-
- <div id="newCategoryButton" class="button button-secondary glm-right">Add a new Category</div>
- <div id="newCategoryDialog" class="glm-dialog-box" title="Enter a New Category">
- <table class="glm-admin-table">
- <tr>
- <th class="glm-required">Category Name:</th>
- <td id="newCatNameTD">
- <input id="newCatName" type="text" name="newCatName" class="glm-form-text-input">
- <div id="newCatNameRequired"></div>
- </td>
- </tr>
- <tr>
- <th>Parent Category:</th>
- <td>
- <select id="newCatParent" name="newCatParent">
- {if $categories}
- <option value=""></option>
- {foreach $categories as $t}
- {if !$t.parent} <!-- don't show child categories -->
- <option value="{$t.id}" data-parent="{$t.name}">{$t.name}</option>
- {/if}
- {/foreach}
- {/if}
- </select>
- <br>OR<br>
- <input id="newCatParentName" type="text" name="newCatParentName" placeholder="Enter a new parent name.">
- </td>
- </tr>
- </table>
- <p><span class="glm-required">*</span> Required</p>
- <a id="newCategoryCancel" class="button button-primary glm-right">Cancel</a>
- <input id="newCategorySubmit" type="submit" value="Add new Category">
- </div>
-
- <!-- Category Selection -->
-
- <select name="categorySelect" id="categorySelect">
- {if $categories}
- <option id="categoryNone" value=""></option>
- {foreach $categories as $v}
- <option value="{$v.id}" data-parent="{$v.parent}">
- {if $v.parent_id} {/if}{$v.name}
- </option>
- {/foreach}
- {else}
- <option id="" value="">(No Categories Listed - Select "Add a new Category" to the right. )</option>
- {/if}
- </select> Select a category to add to box below.<br>
- <div id="activeCategories" class="glm-dynSelect-box">
-
- {if isset($event.fieldData.categories) && $event.fieldData.categories}
- {foreach $event.fieldData.categories as $c}
- <div data-id="{$c.id}" class="glm-dynSelect-item glm-events-category">
- {if $c.parent_name != ''}{$c.parent_name}: {/if}{$c.name}
- <span data-id="{$c.id}" class="glm-dynSelect-delete catDelete">X</span>
- <input type="hidden" name="category[{$c.id}]" value="{$c.id}">
- </div>
- {/foreach}
- {/if}
- </div>
- </td>
- </tr>
- <tr>
- <th {if $event.fieldRequired.intro}class="glm-required"{/if}>Intro Text:</th>
- <td {if $event.fieldFail.intro}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
- <textarea name="intro" class="glm-form-textarea">{$event.fieldData.intro}</textarea>
- {if $event.fieldFail.intro}<p>{$event.fieldFail.intro}</p>{/if}
- </td>
- </tr>
- <tr>
- <th {if $event.fieldRequired.descr}class="glm-required"{/if}>Description:</th>
- <td {if $event.fieldFail.descr}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
- {php}
- wp_editor('{$event.fieldData.descr|escape:quotes}', 'glm_descr', array(
- // 'media_buttons' => true,
- // 'quicktags' => false,
- // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text.
- 'textarea_name' => 'descr',
- 'editor_height' => 200, // Height in px, overrides editor_rows
- // 'textarea_rows' => 8
- ));
- {/php}
- {if $event.fieldFail.descr}<p>{$event.fieldFail.descr}</p>{/if}
- </td>
- </tr>
- <tr>
- <th {if $event.fieldRequired.image}class="glm-required"{/if}>Image:</th>
- <td {if $event.fieldFail.image}class="glm-form-bad-input"{/if}>
- <table class="glm-admin-image-edit-table">
- {if $event.fieldData.image}
- <tr>
- <td>
- <div class="glm-galleryImage" data-id="image">
- <img src="{$glmPluginMediaUrl}/images/small/{$event.fieldData.image}">
- </div>
- </td>
- <td>
- <input type="checkbox" name="image_delete"> Delete Image<br>
- {$event.fieldData.image}<br>
- </td>
- </tr>
- {/if}
- <tr><td colspan="2"><b>New image:</b> <input type="file" name="image_new"></td></tr>
- </table>
- <div id="glm-galleryImageLarger_image" class="glm-imageDialog"><img src="{$glmPluginMediaUrl}/images/large/{$event.fieldData.image}"></div>
- {if $event.fieldFail.image}<p>{$event.fieldFail.image}</p>{/if}
- </td>
- </tr>
- <tr>
- <th {if $event.fieldRequired.url}class="glm-required"{/if}>Web Address (URL):</th>
- <td {if $event.fieldFail.url}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
- <input type="text" name="url" value="{$event.fieldData.url}" class="glm-form-text-input-medium" placeholder="ex: http://www.gaslightmedia.com">
- {if $event.fieldFail.url}<p>{$event.fieldFail.url}</p>{/if}<br>
- </td>
- </tr>
- <tr>
- <th {if $event.fieldRequired.cost}class="glm-required"{/if}>Description of Cost:</th>
- <td {if $event.fieldFail.cost}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
- <input type="text" name="cost" value="{$event.fieldData.cost}" class="glm-form-text-input-medium">
- {if $event.fieldFail.cost}<p>{$event.fieldFail.cost}</p>{/if}<br>
- </td>
- </tr>
- <tr>
- <th {if $event.fieldRequired.notes}class="glm-required"{/if}>Notes:</th>
- <td {if $event.fieldFail.notes}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
- <textarea name="notes" class="glm-form-textarea">{$event.fieldData.notes}</textarea>
- {if $event.fieldFail.notes}<p>{$event.fieldFail.notes}</p>{/if}
- </td>
- </tr>
- </table>
-
+ {include file='admin/events/editStatus.html'}
+
<!-- Location -->
-
- <table id="glm-table-location" class="glm-admin-table glm-hidden glm-event-table">
- <tr>
- <th>A parameter</th>
- <td>Locations data goes here along with a big map</td>
- </tr>
- </table>
-
+
+ {include file='admin/events/editLocation.html'}
+
<!-- Recurrences - Event Schedule -->
-
- <table id="glm-table-recurrence" class="glm-admin-table glm-hidden glm-event-table">
- <tr>
- <td id="placeDeletesHere" colspan="2">
- <a id="addRecurrence" class="button button-primary glm-button glm-right">Add an Event Schedule</a>
- </td>
- </tr>
- <tr>
- <td colspan="2">
- <table id="recurrenceTable">
- <!-- Recurrence forms go here. New forms are added to the bottom of the list by the scripts at the bottom -->
- {if $recurrences}
- {foreach $recurrences as $r}
- <tr><td colspan="2"><hr></td></tr>
- <tr id="recurrence_{$r.id}" class="recurrence_{$r.id} recurrence-form">
- <td>
- <input type="hidden" name="recurID[{$r.id}]" value="{$r.id}">
- <input type="hidden" name="{$r.id}_event" value="{$event.fieldData.id}"> <!-- required to have event id with prefix -->
- <input id="{$r.id}_recurUpdated" type="hidden" name="recurUpdated[{$r.id}]" value="0">
- <table width="100%">
- <tr><th></th><th>First occurrence of event</th></tr>
- <tr>
- <th>All Day Event:</th>
- <td>
- <input id="allDayEvent_{$r.id}" data-id="{$r.id}" type="checkbox" name="{$r.id}_all_day" class="all-day-checkbox recurrence-input" {if $r.all_day.value} checked{/if}>
- </td>
- </tr>
- <tr class="not-all-day-{$r.id}{if $r.all_day.value} glm-hidden{/if}">
- <th>Start Date & Time:</th>
- <td>
- <input data-id="{$r.id}" type="text" name="{$r.id}_start_time" value="{$r.start_time.datetime}" class="glm-form-text-input-small glm-datetime-input recurrence-input" placeholder="Click to Select Date/Time">
- </td>
- </tr>
- <tr class="not-all-day-{$r.id}{if $r.all_day.value} glm-hidden{/if}">
- <th>End Date & Time:</th>
- <td>
- <input data-id="{$r.id}" type="text" name="{$r.id}_end_time" value="{$r.end_time.datetime}" class="glm-form-text-input-small glm-datetime-input recurrence-input" placeholder="Click to Select Date/Time">
- </td>
- </tr>
-
- <tr class="all-day-{$r.id}{if !$r.all_day.value} glm-hidden{/if}">
- <th>Event Date:</th>
- <td>
- <input data-id="{$r.id}" type="text" name="{$r.id}_event_date" value="{$r.start_time.datetime}" class="glm-form-text-input-small glm-date-input recurrence-input" placeholder="Click to Select Date/Time">
- </td>
- </tr>
-
- <tr><th></th><th><p>Date range over which recurring event can take place</p></th></tr>
- <tr>
- <th>From Date:</th>
- <td>
- <input data-id="{$r.id}" type="text" name="{$r.id}_from_date" value="{$r.from_date.date}" class="glm-form-text-input-small glm-date-input recurrence-input" placeholder="Click to Select Date/Time">
- </td>
- </tr>
- <tr>
- <th>To Date:</th>
- <td>
- <input data-id="{$r.id}" type="text" name="{$r.id}_to_date" value="{$r.to_date.date}" class="glm-form-text-input-small glm-date-input recurrence-input" placeholder="Click to Select Date/Time">
- </td>
- </tr>
-
- </table>
- </td>
- <td>
- <table width="100%">
-
- <tr>
- <th></th>
- <th>
- <a id="deleteRecurrence_{$r.id}" data-id="{$r.id}" class="button button-primary glm-button glm-right delete-new-recurrence">Delete this Event Schedule</a>
- When the event recurrs
- </th>
- </tr>
- <tr>
- <th>Months</th>
- <td>
- <table>
- <tr>
- {foreach $r.month_of_year.bitmap as $v}
- {if $v.value==6}
- </tr><tr>
- {/if}
- <td style="white-space: nowrap;"><input data-id="{$r.id}" type="checkbox" name="{$r.id}_month_of_year[{$v.value}]" value="{$v.value}" class="recurrence-input"{if $v.default} checked{/if}> {$v.name} </td>
- {/foreach}
- </tr>
- </table>
- </td>
- </tr>
- <tr><td colspan="2"> </td></tr>
- <tr>
- <th>Days of month:</th>
- <td>
- <input id="specificDaysOfMonth_{$r.id}" data-id="{$r.id}" type="checkbox" name="{$r.id}_by_day_of_month" class="days-of-month-checkbox recurrence-input" {if $r.by_day_of_month.value} checked{/if}> Check to select specific days of the month.
- </td>
- </tr>
- <tr class="not-by-day-of-month-{$r.id}{if $r.by_day_of_month.value} glm-hidden{/if}">
- <th>Week of the Month</th>
- <td>
- <table>
- <tr>
- {foreach $r.week_of_month.bitmap as $v}
- <td style="white-space: nowrap;"><input data-id="{$r.id}" type="checkbox" name="{$r.id}_week_of_month[{$v.value}]" value="{$v.value}" class="recurrence-input"{if $v.default} checked{/if}> {$v.name} </td>
- {/foreach}
- </tr>
- </table>
- </td>
- </tr>
- <tr class="not-by-day-of-month-{$r.id}{if $r.by_day_of_month.value} glm-hidden{/if}">
- <th>Day of the Week</th>
- <td>
- <table>
- <tr>
- {foreach $r.day_of_week.bitmap as $v}
- <td style="white-space: nowrap;"><input data-id="{$r.id}" type="checkbox" name="{$r.id}_day_of_week[{$v.value}]" value="{$v.value}" class="recurrence-input"{if $v.default} checked{/if}> {$v.name}</td>
- {/foreach}
- </tr>
- </table>
- </td>
- </tr>
- <tr class="by-day-of-month-{$r.id}{if !$r.by_day_of_month.value} glm-hidden{/if}">
- <th>Day of the Month</th>
- <td>
- <table width="100%" class="glm-calendar">
- <tr>
- {foreach $r.day_of_month.bitmap as $v}
- {if in_array($v.value, array(7, 14, 21, 28))}
- </tr><tr>
- {/if}
- <td>
- <input data-id="{$r.id}" type="checkbox" name="{$r.id}_day_of_month[{$v.value}]" value="{$v.value}" class="recurrence-input"{if $v.default} checked{/if}> {$v.name}
- </td>
- {/foreach}
- <td colspan="4" style="text-align: center;">
- <input data-id="{$r.id}" type="checkbox" name="{$r.id}_last_day_of_month" class="recurrence-input"{if $r.last_day_of_month.value} checked{/if}> Last day of the month
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
-
-
-
- {/foreach}
- {else}
- <tr id="no-recurrence-msg"><td colspan="2">(Add event schedules here)</td></tr>
- {/if}
- </table>
- </td>
- </tr>
- </table>
-
+
+ {include file='admin/events/editSchedule.html'}
+
<!-- Calendar -->
-
+
<table id="glm-table-calendar" class="glm-admin-table glm-hidden glm-event-table">
<tr>
<td>
</td>
</tr>
</table>
-
+
<input id="updateEvent" type="submit" value="{if $haveEvent}Update Event{else}Add New Event{/if}">
</form>
-
+
{else} <!-- Can just display -->
-
+
<table class="glm-admin-table">
<tr><th>Name:</th><td>{$event.fieldData.name}</td></tr>
</table>
-
+
{/if}
<!-- Delete Event Dialog Box -->
-
+
<div id="deleteEventDialog" class="glm-dialog-box" title="Delete Event">
<center>
<p><a id="deleteEventCancel" class="button button-primary">Cancel</a></p>
<div class="glm-item-container">
<p><center><span class="glm-error">WARNING:</span></center></p>
<p>
- <span class="glm-warning">Clicking the "Delete this Event" button above will
+ <span class="glm-warning">Clicking the "Delete this Event" button above will
delete all of the data and images associated with this event.
</span>
</p>
</div>
</div>
- <!-- Add/Edit Recurrence Template -->
-
- <table id="addRecurrenceTemplate" class="glm-hidden">
- <tr class="recurrence_{ newRecurID }">
- <td colspan="2">
- </td>
- </tr>
- <tr class="recurrence_{ newRecurID }">
- <td>
- <input type="hidden" name="recurID[{ newRecurID }]" value="{ newRecurID }">
- <input type="hidden" name="{ newRecurID }_event" value="{$event.fieldData.id}"> <!-- required to have event id with prefix -->
- <table width="100%">
- <tr>
- <th class="glm-notice">New Schedule</th>
- <th>First ocurrence of event</th>
- </tr>
- <tr>
- <th>All Day Event:</th>
- <td>
- <input id="allDayEvent_{ newRecurID }" data-id="{ newRecurID }" type="checkbox" name="{ newRecurID }_all_day" class="all-day-checkbox">
- </td>
- </tr>
- <tr class="not-all-day-{ newRecurID }">
- <th>Start Date & Time:</th>
- <td>
- <input type="text" name="{ newRecurID }_start_time" value="{$newRecurrence.fieldData.start_time.datetime}" class="glm-form-text-input-small glm-datetime-input" placeholder="Click to Select Date/Time">
- </td>
- </tr>
- <tr class="not-all-day-{ newRecurID }">
- <th>End Date & Time:</th>
- <td>
- <input type="text" name="{ newRecurID }_end_time" value="{$newRecurrence.fieldData.end_time.datetime}" class="glm-form-text-input-small glm-datetime-input" placeholder="Click to Select Date/Time">
- </td>
- </tr>
-
- <tr class="all-day-{ newRecurID } glm-hidden">
- <th>Event Date:</th>
- <td>
- <!-- Note that _event_date gets translated to _start_time in the model if _all_day is selected -->
- <input type="text" name="{ newRecurID }_event_date" value="{$newRecurrence.fieldData.start_date.date}" class="glm-form-text-input-small glm-date-input" placeholder="Click to Select Date/Time">
- </td>
- </tr>
-
- <tr><th></th><th><p>Date range over which recurring event can take place</p></th></tr>
- <tr>
- <th>From Date:</th>
- <td>
- <input type="text" name="{ newRecurID }_from_date" value="{$newRecurrence.fieldData.from_date.date}" class="glm-form-text-input-small glm-date-input" placeholder="Click to Select Date/Time">
- </td>
- </tr>
- <tr>
- <th>To Date:</th>
- <td>
- <input type="text" name="{ newRecurID }_to_date" value="{$newRecurrence.fieldData.to_date.date}" class="glm-form-text-input-small glm-date-input" placeholder="Click to Select Date/Time">
- </td>
- </tr>
-
- </table>
- </td>
- <td>
- <table width="100%">
-
- <tr>
- <th></th>
- <th>
- <a id="deleteRecurrence_{ newRecurID }" data-id="{ newRecurID }" class="button button-primary glm-button glm-right delete-new-recurrence">Delete this Event Schedule</a>
- When the event recurrs
- </th>
- </tr>
- <tr>
- <th>Months</th>
- <td>
- <table>
- <tr>
- {foreach $newRecurrence.fieldData.month_of_year.bitmap as $v}
- {if $v.value==6}
- </tr><tr>
- {/if}
- <td style="white-space: nowrap;"><input type="checkbox" name="{ newRecurID }_month_of_year[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name} </td>
- {/foreach}
- </tr>
- </table>
- </td>
- </tr>
- <tr><td colspan="2"> </td></tr>
- <tr>
- <th>Days of month:</th>
- <td>
- <input id="specificDaysOfMonth_{ newRecurID }" data-id="{ newRecurID }" type="checkbox" name="{ newRecurID }_by_day_of_month" class="days-of-month-checkbox"> Check to select specific days of the month.
- </td>
- </tr>
- <tr class="not-by-day-of-month-{ newRecurID }">
- <th>Week of the Month</th>
- <td>
- <table>
- <tr>
- {foreach $newRecurrence.fieldData.week_of_month.bitmap as $v}
- <td style="white-space: nowrap;"><input type="checkbox" name="{ newRecurID }_week_of_month[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name} </td>
- {/foreach}
- </tr>
- </table>
- </td>
- </tr>
- <tr class="not-by-day-of-month-{ newRecurID }">
- <th>Day of the Week</th>
- <td>
- <table>
- <tr>
- {foreach $newRecurrence.fieldData.day_of_week.bitmap as $v}
- <td style="white-space: nowrap;"><input type="checkbox" name="{ newRecurID }_day_of_week[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}</td>
- {/foreach}
- </tr>
- </table>
- </td>
- </tr>
- <tr class="by-day-of-month-{ newRecurID } glm-hidden">
- <th>Day of the Month</th>
- <td>
- <table width="100%" class="glm-calendar">
- <tr>
- {foreach $newRecurrence.fieldData.day_of_month.bitmap as $v}
- {if in_array($v.value, array(7, 14, 21, 28))}
- </tr><tr>
- {/if}
- <td>
- <input type="checkbox" name="{ newRecurID }_day_of_month[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}
- </td>
- {/foreach}
- <td colspan="4" style="text-align: center;">
- <input type="checkbox" name="{ newRecurID }_last_day_of_month"> Last day of the month
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
- </td>
- </tr>
- </table>
-
<script type="text/javascript">
jQuery(document).ready(function($) {
var fullCalendarLoaded = false;
var recurrencesInited = false;
-
+
/*
* Edit area tabs
*/
$('.glm-event-tab').click( function() {
-
+
// Clear tabl highlights and hide all tables
$('.glm-event-tab').removeClass('nav-tab-active');
$('.glm-event-table').addClass('glm-hidden');
-
+
// Highlight selected tab
$(this).addClass('nav-tab-active');
-
+
// Show selected table
var table = $(this).attr('data-show-table');
$('#' + table).removeClass('glm-hidden');
-
-
+
+
if (table == 'glm-table-recurrence' && !recurrencesInited) {
initRecurrence();
recurrencesInited = true;
if (table == 'glm-table-calendar' && !fullCalendarLoaded) {
$('#eventCalendar').fullCalendar({
- {if $haveTimes}
+ {if $haveTimes}
events: [
{$sep = ''}
{foreach $times as $t}
$('#addEventButton').click( function() {
window.location.href = "{$thisUrl}?page={$thisPage}&glm_action=list&option=add";
});
-
- // Flash certain elements for a short time after display
+
+ // Flash certain elements for a short time after display
$(".glm-flash-updated").fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500).fadeIn(500).fadeOut(500);
-
+
{if $haveEvent}
// Delete Event dialog
$("#deleteEventDialog").dialog({
});
$('#deleteEventCancel').click( function() {
$("#deleteEventDialog").dialog("close");
- });
+ });
$('#deleteEventSubmit').click( function() {
window.location.replace("{$thisUrl}?page={$thisPage}&glm_action=list&option=delete&event={$event.fieldData.id}");
});
{/if}
+ /*
+ * Locations
+ */
+ var numbLocations = {$numbLocations};
+
+ /*
+ * Add location using template
+ */
+
+ // New location ID's start at 0 (have "n" for "new" appended to them in the template)
+ var newLocID = 0;
+
+ function addNewLocationForm() {
+
+ // Tick the new recurrence ID counter and build new HTML from the addRecurrenceTemplate
+ ++newLocID;
+
+ // If we already have at least one location, we need to add a separator
+ var locTemp = '';
+ if (numbLocations) {
+ locTemp = '<tbody class="location_{ newLocID }"><tr><td colspan="2"><hr></td></tr></tbody>';
+
+ // Otherwise, we'll say we now have our first location
+ } else {
+ numbLoctions++;
+ }
+
+ locTemp = locTemp + $('#addLocationTemplate').html();
+ locTemp = locTemp.replace(/{ newLocID }/g, 'n' + newLocID); // Include "n" to indicate "new"
+
+ // Append the new location form to the container
+ $('#locationTable').append(locTemp);
+
+ initLocation();
+
+ }
+
+ // When adding a new location is requested
+ $("#addLocation").click( function() {
+ addNewLocationForm();
+ $('#no-location-msg').remove();
+ });
+
+ function addNewRecurrenceForm() {
+// ***** NEED TO SEE WHAT NEEDS TO GO HERE ****
+ }
+
/*
* Recurrences
*/
/*
* Add recurrence using template
*/
-
+
// New recurrence ID's start at 0 (have "n" for "new" appended to them in the template)
var newRecurID = 0;
-
+
function addNewRecurrenceForm() {
-
+
// Tick the new recurrence ID counter and build new HTML from the addRecurrenceTemplate
++newRecurID;
// Otherwise, we'll say we now have our first recurrence
} else {
- numbRecurrences++;
+ numbRecurrences++;
}
recurTemp = recurTemp + $('#addRecurrenceTemplate').html();
recurTemp = recurTemp.replace(/{ newRecurID }/g, 'n' + newRecurID); // Include "n" to indicate "new"
-
+
// Append the new recurrence form to the container
$('#recurrenceTable').append(recurTemp);
-
+
initRecurrence();
-
+
}
-
+
// When adding a new recurrence is requested
$("#addRecurrence").click( function() {
addNewRecurrenceForm();
$('#no-recurrence-msg').remove();
});
-
+
/*
* Things that need to be renewed each time a recurrence is added
*/
function initRecurrence() {
-
+
// Date / Time Pickers
$('.glm-datetime-input').datetimepicker({
format: 'm/d/Y H:i',
closeOnWithoutClick: true,
timepicker: false
});
-
-
+
+
// Delete a recurrence
$('.delete-new-recurrence').on( 'click', function() {
recurID = $(this).attr('data-id');
$('.recurrence_' + recurID).remove();
- $('#placeDeletesHere').append('<input type="hidden" name="deleteRecur[' + recurID + ']" value="' + recurID + '">');
+ $('#placeRecurDeletesHere').append('<input type="hidden" name="deleteRecur[' + recurID + ']" value="' + recurID + '">');
numbRecurrences--;
})
$(".all-day-" + recurID).addClass('glm-hidden');
}
});
-
+
+ // All Dates Event selection
+ $('.all-dates-checkbox').click( function() {
+ recurID = $(this).attr('data-id');
+ if ($("#allDatesEvent_" + recurID)[0].checked) {
+ $("#allDatesExclude_" + recurID).addClass('glm-hidden');
+ } else {
+ $("#allDatesExclude_" + recurID).removeClass('glm-hidden');
+ }
+ });
+
// By day of month selection
$('.days-of-month-checkbox').click( function() {
recurID = $(this).attr('data-id');
}
});
- // Check for input changes to a recurrence and update recurUpdated[] submit array element for this recurID - set value to recurID
+ // Check for input changes to a recurrence and update recurUpdated[] submit array element for this recurID - set value to recurID
$('.recurrence-input').on( 'change', function() {
recurID = $(this).attr('data-id');
$('#' + recurID + '_recurUpdated').val(recurID);
- });
-
+ });
+
+ // Check for All/None buttons
+ $('.glm-set-all').click( function() {
+ tableID = $(this).attr('data-id');
+ $('#' + tableID + ' input:checkbox').attr('checked', true);
+ });
+ $('.glm-set-none').click( function() {
+ tableID = $(this).attr('data-id');
+ $('#' + tableID + ' input:checkbox').attr('checked', false);
+ });
+
}
-
-
+
+
$('#addRecurrenceButton').click( function() {
$('#addRecurrenceDialog').dialog('open');
});
$('#addRecurrenceCancel').click( function() {
$("#addRecurrenceDialog").dialog("close");
- });
+ });
$('#addRecurrenceSubmit').click( function() {
// window.location.replace("{$thisUrl}?page={$thisPage}&glm_action=list&option=delete&event={$event.fieldData.id}");
});
-
-
+
+
/*
* Category Selection
*/
-
+
// Action to select a category
$('#categorySelect').change( function() {
-
+
// Get the ID, name, and parent of the category
- var catValue = $('#categorySelect').val();
+ var catValue = $('#categorySelect').val();
var catName = $('#categorySelect').find(':selected').text();
var catParent = $('#categorySelect').find(':selected').attr('data-parent');
-
+
// Check if the category has already been added
- var found = false;
+ var found = false;
$(".glm-events-category").each( function() {
var id = $(this).attr('data-id');
if (id == catValue) {
found = true;
}
});
-
+
// Check if there's a parent
parentName = '';
if (catParent != '') {
parentName = catParent + ': ';
}
-
+
// If not found, Add the category
if (!found) {
- $('#activeCategories').append('<div data-id="' + catValue
- + '" class="glm-dynSelect-item glm-events-category">'
+ $('#activeCategories').append('<div data-id="' + catValue
+ + '" class="glm-dynSelect-item glm-events-category">'
+ parentName + catName.trim() + ' <span class="glm-dynSelect-delete catDelete">X</span>'
+ '<input type="hidden" name="category[' + catValue + ']" value="' + catValue + '"></div>');
}
-
+
// Reset picklist
$('#categorySelect').val('');
-
+
});
-
+
// Action to de-select a category
$('.catDelete').live('click', function() {
$(this).parent().remove();
});
-
+
/*
* New Category Dialog
*/
-
+
var newCat = 0; // Used for new category numbering (new cats are negative numbers)
-
+
// Setup dialog box for adding a new category
$("#newCategoryDialog").dialog({
autoOpen: false,
minWidth: 400,
dialogClass: "glm-dialog-no-close"
});
-
+
// Ad a new category button action - pop-up dialog
$('#newCategoryButton').click( function() {
$("#newCategoryDialog").dialog("open");
});
-
+
// Submit new category
$('#newCategorySubmit').click( function() {
-
+
// Assign new cat number
newCat--;
-
+
// Get new category information
var newCatName = $('#newCatName').val();
var newCatParent = $('#newCatParent').val();
var catParent = $('#newCatParent').find(':selected').attr('data-parent');
var newCatParentName = $('#newCatParentName').val();
-
+
// If there's no name, tell the user we need one.
if (newCatName == '') {
$('#newCatNameTD').addClass('glm-form-bad-input');
$('#newCatNameRequired').text('A catogory name is required!');
return false;
}
-
+
// Check if there's a parent, get the name - new parent name overrides selected parent
parentName = '';
if (newCatParentName && newCatParentName != '') {
} else if (catParent && catParent != '') {
parentName = catParent + ': ';
}
-
+
// Add the new category to the active categories list
- $('#activeCategories').append('<div data-id="' + newCat
- + '" class="glm-dynSelect-item glm-events-category">'
+ $('#activeCategories').append('<div data-id="' + newCat
+ + '" class="glm-dynSelect-item glm-events-category">'
+ parentName + newCatName.trim() + ' <span data-id="' + newCat + '" class="glm-dynSelect-delete catDelete">X</span>'
+ '<input type="hidden" name="category[' + newCat + ']" value="' + newCat + '">'
+ '<input type="hidden" name="newCategory[' + newCat + ']" value="' + newCatName + '">'
+ '<input type="hidden" name="newCatParent[' + newCat + ']" value="' + newCatParent + '">'
+ '<input type="hidden" name="newCatParentName[' + newCat + ']" value="' + newCatParentName + '">'
+ '</div>');
-
+
// Clear the dialog input fields
$('#newCatName').val('');
- $('#newCatParent').val('');
- $('#newCatParentName').val('');
-
+ $('#newCatParent').val('');
+ $('#newCatParentName').val('');
+
$("#newCategoryDialog").dialog("close");
-
+
});
$('#newCategoryCancel').click( function() {
$("#newCategoryDialog").dialog("close");
});
-
+
// Setup dialog box for adding a new category
$("#newCategoryDialog").dialog({
autoOpen: false,
/*
* Check for bad input or input changes
*/
-
+
// Check for any field errors and if found change related tab to error color.
$('.glm-form-bad-input').each( function(index) {
-
+
tab = $(this).attr('data-tabid');
-
+
if (!$('#' + tab).hasClass('glm-bad-input-area')) {
$('#' + tab).addClass('glm-bad-input-area');
}
});
-
+
// Check for most input changes
$('input, textarea, select').on( 'change', function() {
glmPageUpdateRequired();
- });
-
+ });
+
/*
* Checks for leaving the page
*/
var glmSubmitRequired = false;
-
+
// Flag submit button when updates are required.
function glmPageUpdateRequired() {
$('#updateEvent').addClass('glm-bad-input-area');
glmSubmitRequired = false;
return true;
});
-
+
// If submit is required and we're laving the page, alert the user
$(window).bind('beforeunload', function() {
if (glmSubmitRequired) {
}
});
-
+
});
</script>
-
+
{include file='admin/footer.html'}
--- /dev/null
+
+<!-- Location -->
+
+<table id="glm-table-location" class="glm-admin-table glm-hidden glm-event-table">
+ <tr>
+ <td id="placeLocationDeletesHere" colspan="2">
+ <a id="addLocation" class="button button-primary glm-button glm-right">Add a Location</a>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <table id="locationTable" width="100%">
+ <!-- Location forms go here. -->
+{if $locations}
+ {foreach $locations as $loc}
+
+ <tr>
+ <th>Location Name:</th>
+ <td>
+ <input type="text" name="{$loc.id}_name" value="{$loc.fieldData.name}" class="glm-form-text-input-medium">
+ </td>
+ </tr>
+ <tr>
+ <th>Address:</th>
+ <td>
+ <input type="text" name="{$loc.id}_address" value="{$loc.fieldData.address}" class="glm-form-text-input-medium">
+ </td>
+ </tr>
+
+
+ {/foreach}
+{/if}
+ </table>
+ </td>
+ </tr>
+
+</table>
+
+<!-- Add/Edit Location Template -->
+
+<table id="addLocationTemplate" class="glm-hidden">
+ <tr class="location_{ newLocID }">
+ <td>
+ <input type="hidden" name="locID[{ newLocID }]" value="{ newLocID }">
+ <input type="hidden" name="{ newLocID }_event" value="{$event.fieldData.id}"> <!-- required to have event id with prefix -->
+ <table width="100%">
+ <tr>
+ <th>Location Name:</th>
+ <td>
+ <input type="text" name="{ newLocID }_name" value="{$newLocation.fieldData.name}" class="glm-form-text-input-medium">
+ </td>
+ </tr>
+ <tr>
+ <th>Address:</th>
+ <td>
+ <input type="text" name="{ newLocID }_address" value="{$newLocation.fieldData.address}" class="glm-form-text-input-medium">
+ </td>
+ </tr>
+
+
+
+ </table>
+ </td>
+ </tr>
+</table>
\ No newline at end of file
--- /dev/null
+
+<!-- Recurrences - Event Schedule -->
+
+<table id="glm-table-recurrence" class="glm-admin-table glm-hidden glm-event-table">
+ <tr>
+ <td id="placeRecurDeletesHere" colspan="2">
+ <a id="addRecurrence" class="button button-primary glm-button glm-right">Add an Event Schedule</a>
+ </td>
+ </tr>
+ <tr>
+ <td colspan="2">
+ <table id="recurrenceTable" width="100%">
+ <!-- Recurrence forms go here. -->
+{if $recurrences}
+ {foreach $recurrences as $r}
+ <tr><td colspan="2"><hr></td></tr>
+ <tr id="recurrence_{$r.id}" class="recurrence_{$r.id} recurrence-form">
+ <td>
+ <input type="hidden" name="recurID[{$r.id}]" value="{$r.id}">
+ <input type="hidden" name="{$r.id}_event" value="{$event.fieldData.id}"> <!-- required to have event id with prefix -->
+ <input id="{$r.id}_recurUpdated" type="hidden" name="recurUpdated[{$r.id}]" value="0">
+ <table width="100%">
+ <tr><th></th><th>First occurrence of event</th></tr>
+ <tr>
+ <th>All Day Event:</th>
+ <td>
+ <input id="allDayEvent_{$r.id}" data-id="{$r.id}" type="checkbox" name="{$r.id}_all_day" class="all-day-checkbox recurrence-input" {if $r.all_day.value} checked{/if}>
+ </td>
+ </tr>
+ <tr class="not-all-day-{$r.id}{if $r.all_day.value} glm-hidden{/if}">
+ <th>Start Date & Time:</th>
+ <td>
+ <input data-id="{$r.id}" type="text" name="{$r.id}_start_time" value="{$r.start_time.datetime}" class="glm-form-text-input-small glm-datetime-input recurrence-input" placeholder="Click to Select Date/Time">
+ </td>
+ </tr>
+ <tr class="not-all-day-{$r.id}{if $r.all_day.value} glm-hidden{/if}">
+ <th>End Date & Time:</th>
+ <td>
+ <input data-id="{$r.id}" type="text" name="{$r.id}_end_time" value="{$r.end_time.datetime}" class="glm-form-text-input-small glm-datetime-input recurrence-input" placeholder="Click to Select Date/Time">
+ </td>
+ </tr>
+
+ <tr class="all-day-{$r.id}{if !$r.all_day.value} glm-hidden{/if}">
+ <th>Event Date:</th>
+ <td>
+ <input data-id="{$r.id}" type="text" name="{$r.id}_event_date" value="{$r.start_time.datetime}" class="glm-form-text-input-small glm-date-input recurrence-input" placeholder="Click to Select Date/Time">
+ </td>
+ </tr>
+
+ <tr><th></th><th><p>Date range over which recurring event can take place</p></th></tr>
+ <tr>
+ <th>From Date:</th>
+ <td>
+ <input data-id="{$r.id}" type="text" name="{$r.id}_from_date" value="{$r.from_date.date}" class="glm-form-text-input-small glm-date-input recurrence-input" placeholder="Click to Select Date/Time">
+ </td>
+ </tr>
+ <tr>
+ <th>To Date:</th>
+ <td>
+ <input data-id="{$r.id}" type="text" name="{$r.id}_to_date" value="{$r.to_date.date}" class="glm-form-text-input-small glm-date-input recurrence-input" placeholder="Click to Select Date/Time">
+ </td>
+ </tr>
+
+ </table>
+ </td>
+ <td>
+ <table width="100%">
+
+ <tr>
+ <th></th>
+ <th>
+ <a id="deleteRecurrence_{$r.id}" data-id="{$r.id}" class="button button-primary glm-button glm-right delete-new-recurrence all_dates-checkbox">Delete this Event Schedule</a>
+ When the event recurrs
+ </th>
+ </tr>
+ <tr>
+ <th>Ongoing Event:</th>
+ <td width="90%">
+ <input id="allDatesEvent_{$r.id}" data-id="{$r.id}" type="checkbox" name="{$r.id}_all_dates" class="all-dates-checkbox recurrence-input" {if $r.all_dates.value} checked{/if}>
+ Check to have event recurr every day from the "From Date" through the "To Date".
+ </td>
+ </tr>
+ <tbody id="allDatesExclude_{$r.id}"{if $r.all_dates.value} class="glm-hidden"{/if}>
+ <tr>
+ <th>Months</th>
+ <td>
+ <table id="monthOfYearTable_{$r.id}">
+ <tr>
+ {foreach $r.month_of_year.bitmap as $v}
+ {if $v.value==6}
+ </tr><tr>
+ {/if}
+ <td style="white-space: nowrap;"><input data-id="{$r.id}" type="checkbox" name="{$r.id}_month_of_year[{$v.value}]" value="{$v.value}" class="recurrence-input"{if $v.default} checked{/if}> {$v.name} </td>
+ {/foreach}
+ <td> <div data-id="monthOfYearTable_{$r.id}" class="button glm-button-small glm-set-all">All</div><div data-id="monthOfYearTable_{$r.id}" class="button glm-button-small glm-set-none">None</div></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr><td colspan="2"> </td></tr>
+ <tr>
+ <th>Days of month:</th>
+ <td>
+ <input id="specificDaysOfMonth_{$r.id}" data-id="{$r.id}" type="checkbox" name="{$r.id}_by_day_of_month" class="days-of-month-checkbox recurrence-input" {if $r.by_day_of_month.value} checked{/if}> Check to select specific days of the month.
+ </td>
+ </tr>
+ <tr class="not-by-day-of-month-{$r.id}{if $r.by_day_of_month.value} glm-hidden{/if}">
+ <th>Week of the Month</th>
+ <td>
+ <table id="weekOfMonthTable_{$r.id}">
+ <tr>
+ {foreach $r.week_of_month.bitmap as $v}
+ <td style="white-space: nowrap;"><input data-id="{$r.id}" type="checkbox" name="{$r.id}_week_of_month[{$v.value}]" value="{$v.value}" class="recurrence-input"{if $v.default} checked{/if}> {$v.name} </td>
+ {/foreach}
+ <td> <div data-id="weekOfMonthTable_{$r.id}" class="button glm-button-small glm-set-all">All</div><div data-id="weekOfMonthTable_{$r.id}" class="button glm-button-small glm-set-none">None</div></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr class="not-by-day-of-month-{$r.id}{if $r.by_day_of_month.value} glm-hidden{/if}">
+ <th>Day of the Week</th>
+ <td>
+ <table id="dayOfWeekTable_{$r.id}">
+ <tr>
+ {foreach $r.day_of_week.bitmap as $v}
+ <td style="white-space: nowrap;"><input data-id="{$r.id}" type="checkbox" name="{$r.id}_day_of_week[{$v.value}]" value="{$v.value}" class="recurrence-input"{if $v.default} checked{/if}> {$v.name}</td>
+ {/foreach}
+ <td> <div data-id="dayOfWeekTable_{$r.id}" class="button glm-button-small glm-set-all">All</div><div data-id="dayOfWeekTable_{$r.id}" class="button glm-button-small glm-set-none">None</div></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr class="by-day-of-month-{$r.id}{if !$r.by_day_of_month.value} glm-hidden{/if}">
+ <th>Day of the Month</th>
+ <td>
+ <table id="dayOfMonthTable_{$r.id}" width="100%" class="glm-calendar">
+ <tr>
+ {foreach $r.day_of_month.bitmap as $v}
+ {if in_array($v.value, array(7, 14, 21, 28))}
+ </tr><tr>
+ {/if}
+ <td>
+ <input data-id="{$r.id}" type="checkbox" name="{$r.id}_day_of_month[{$v.value}]" value="{$v.value}" class="recurrence-input"{if $v.default} checked{/if}> {$v.name}
+ </td>
+ {/foreach}
+ <td colspan="3" style="text-align: center;">
+ <input data-id="{$r.id}" type="checkbox" name="{$r.id}_last_day_of_month" class="recurrence-input"{if $r.last_day_of_month.value} checked{/if}> Last day of the month
+ </td>
+ <td><div data-id="dayOfMonthTable_{$r.id}" class="button glm-button-small glm-set-all">All</div><div data-id="dayOfMonthTable_{$r.id}" class="button glm-button-small glm-set-none">None</div></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+
+
+
+ {/foreach}
+{else}
+ <tr id="no-recurrence-msg"><td colspan="2">(Add event schedules here)</td></tr>
+{/if}
+ </table>
+ </td>
+ </tr>
+</table>
+
+<!-- Add/Edit Recurrence Template -->
+
+<table id="addRecurrenceTemplate" class="glm-hidden">
+ <tr class="recurrence_{ newRecurID }">
+ <td>
+ <input type="hidden" name="recurID[{ newRecurID }]" value="{ newRecurID }">
+ <input type="hidden" name="{ newRecurID }_event" value="{$event.fieldData.id}"> <!-- required to have event id with prefix -->
+ <table width="100%">
+ <tr>
+ <th class="glm-notice">New Schedule</th>
+ <th>First ocurrence of event</th>
+ </tr>
+ <tr>
+ <th>All Day Event:</th>
+ <td>
+ <input id="allDayEvent_{ newRecurID }" data-id="{ newRecurID }" type="checkbox" name="{ newRecurID }_all_day" class="all-day-checkbox">
+ </td>
+ </tr>
+ <tr class="not-all-day-{ newRecurID }">
+ <th>Start Date & Time:</th>
+ <td>
+ <input type="text" name="{ newRecurID }_start_time" value="{$newRecurrence.fieldData.start_time.datetime}" class="glm-form-text-input-small glm-datetime-input" placeholder="Click to Select Date/Time">
+ </td>
+ </tr>
+ <tr class="not-all-day-{ newRecurID }">
+ <th>End Date & Time:</th>
+ <td>
+ <input type="text" name="{ newRecurID }_end_time" value="{$newRecurrence.fieldData.end_time.datetime}" class="glm-form-text-input-small glm-datetime-input" placeholder="Click to Select Date/Time">
+ </td>
+ </tr>
+
+ <tr class="all-day-{ newRecurID } glm-hidden">
+ <th>Event Date:</th>
+ <td>
+ <!-- Note that _event_date gets translated to _start_time in the model if _all_day is selected -->
+ <input type="text" name="{ newRecurID }_event_date" value="{$newRecurrence.fieldData.start_date.date}" class="glm-form-text-input-small glm-date-input" placeholder="Click to Select Date/Time">
+ </td>
+ </tr>
+
+ <tr><th></th><th><p>Date range over which recurring event can take place</p></th></tr>
+ <tr>
+ <th>From Date:</th>
+ <td>
+ <input type="text" name="{ newRecurID }_from_date" value="{$newRecurrence.fieldData.from_date.date}" class="glm-form-text-input-small glm-date-input" placeholder="Click to Select Date/Time">
+ </td>
+ </tr>
+ <tr>
+ <th>To Date:</th>
+ <td>
+ <input type="text" name="{ newRecurID }_to_date" value="{$newRecurrence.fieldData.to_date.date}" class="glm-form-text-input-small glm-date-input" placeholder="Click to Select Date/Time">
+ </td>
+ </tr>
+
+ </table>
+ </td>
+ <td>
+ <table width="100%">
+
+ <tr>
+ <th></th>
+ <th>
+ <a id="deleteRecurrence_{ newRecurID }" data-id="{ newRecurID }" class="button button-primary glm-button glm-right delete-new-recurrence">Delete this Event Schedule</a>
+ When the event recurrs
+ </th>
+ </tr>
+ <tr>
+ <th>Ongoing Event:</th>
+ <td width="90%">
+ <input id="allDatesEvent_{ newRecurID }" data-id="{ newRecurID }" type="checkbox" name="{ newRecurID }_all_dates" class="all-dates-checkbox recurrence-input">
+ Check to have event recurr every day from the "From Date" through the "To Date".
+ </td>
+ </tr>
+ <tbody id="allDatesExclude_{ newRecurID }">
+ <tr>
+ <th>Months</th>
+ <td>
+ <table id="monthOfYearTable_{ newRecurID }">
+ <tr>
+ {foreach $newRecurrence.fieldData.month_of_year.bitmap as $v}
+ {if $v.value==6}
+ </tr><tr>
+ {/if}
+ <td style="white-space: nowrap;"><input type="checkbox" name="{ newRecurID }_month_of_year[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name} </td>
+ {/foreach}
+ <td> <div data-id="monthOfYearTable_{ newRecurID }" class="button glm-button-small glm-set-all">All</div><div data-id="monthOfYearTable_{ newRecurID }" class="button glm-button-small glm-set-none">None</div></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr><td colspan="2"> </td></tr>
+ <tr>
+ <th>Days of month:</th>
+ <td>
+ <input id="specificDaysOfMonth_{ newRecurID }" data-id="{ newRecurID }" type="checkbox" name="{ newRecurID }_by_day_of_month" class="days-of-month-checkbox"> Check to select specific days of the month.
+ </td>
+ </tr>
+ <tr class="not-by-day-of-month-{ newRecurID }">
+ <th>Week of the Month</th>
+ <td>
+ <table id="weekOfMonthTable_{ newRecurID }">
+ <tr>
+ {foreach $newRecurrence.fieldData.week_of_month.bitmap as $v}
+ <td style="white-space: nowrap;"><input type="checkbox" name="{ newRecurID }_week_of_month[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name} </td>
+ {/foreach}
+ <td> <div data-id="weekOfMonthTable_{ newRecurID }" class="button glm-button-small glm-set-all">All</div><div data-id="weekOfMonthTable_{ newRecurID }" class="button glm-button-small glm-set-none">None</div></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr class="not-by-day-of-month-{ newRecurID }">
+ <th>Day of the Week</th>
+ <td>
+ <table id="dayOfWeekTable_{ newRecurID }">
+ <tr>
+ {foreach $newRecurrence.fieldData.day_of_week.bitmap as $v}
+ <td style="white-space: nowrap;"><input type="checkbox" name="{ newRecurID }_day_of_week[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}</td>
+ {/foreach}
+ <td> <div data-id="dayOfWeekTable_{ newRecurID }" class="button glm-button-small glm-set-all">All</div><div data-id="dayOfWeekTable_{ newRecurID }" class="button glm-button-small glm-set-none">None</div></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ <tr class="by-day-of-month-{ newRecurID } glm-hidden">
+ <th>Day of the Month</th>
+ <td>
+ <table id="dayOfMonthTable_{ newRecurID }" width="100%" class="glm-calendar">
+ <tr>
+ {foreach $newRecurrence.fieldData.day_of_month.bitmap as $v}
+ {if in_array($v.value, array(7, 14, 21, 28))}
+ </tr><tr>
+ {/if}
+ <td>
+ <input type="checkbox" name="{ newRecurID }_day_of_month[{$v.value}]" value="{$v.value}"{if $v.default} checked{/if}> {$v.name}
+ </td>
+ {/foreach}
+ <td colspan="3" style="text-align: center;">
+ <input type="checkbox" name="{ newRecurID }_last_day_of_month"> Last day of the month
+ </td>
+ <td><div data-id="dayOfMonthTable_{ newRecurID }" class="button glm-button-small glm-set-all">All</div><div data-id="dayOfMonthTable_{ newRecurID }" class="button glm-button-small glm-set-none">None</div></td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+ </td>
+ </tr>
+</table>
+
+
\ No newline at end of file
--- /dev/null
+
+<!-- Status and Description -->
+
+ <table id="glm-table-descr" class="glm-admin-table glm-event-table">
+ <tr>
+ <th {if $event.fieldRequired.name}class="glm-required"{/if}>Event Name:</th>
+ <td {if $event.fieldFail.name}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
+ <input type="text" name="name" value="{$event.fieldData.name}" class="glm-form-text-input-medium" placeholder="Name of this event.">
+ {if $event.fieldFail.name}<p>{$event.fieldFail.name}</p>{/if}<br>
+ </td>
+ </tr>
+{if $haveEvent}
+ <tr>
+ <th>Name for URLs:</th>
+ <td>{$event.fieldData.name_slug}</td>
+ </tr>
+ <tr>
+ <th>Created:</th>
+ <td>{$event.fieldData.created.datetime}</td>
+ </tr>
+ <tr>
+ <th>Last Updated:</th>
+ <td>{$event.fieldData.updated.datetime}</td>
+ </tr>
+ <tr>
+ <th>Last Approved:</th>
+ <td>{$event.fieldData.approved.datetime}</td>
+ </tr>
+{/if}
+ <tr>
+ <th>Status:</th>
+ <td>
+ <select name="status">
+ {foreach $event.fieldData.status.list as $v}
+ <option value="{$v.value}"{if $v.default} selected{/if}>{$v.name}</option>
+ {/foreach}
+ </select>
+ {if $event.fieldFail.status}<p>{$event.fieldFail.status}</p>{/if}
+ </td>
+ </tr>
+ <tr>
+ <th>Hide Member Address:</th>
+ <td>
+ <input type="checkbox" name="hide_address" {if $event.fieldData.hide_address.value} checked{/if}>
+ </td>
+ </tr>
+ <tr>
+ <th>Featured Event:</th>
+ <td>
+ <input type="checkbox" name="featured" {if $event.fieldData.featured.value} checked{/if}>
+ </td>
+ </tr>
+ <tr>
+ <th>Include in Slideshow:</th>
+ <td>
+ <input type="checkbox" name="slideshow" {if $event.fieldData.slideshow.value} checked{/if}>
+ </td>
+ </tr>
+ <tr>
+ <th>Major Event:</th>
+ <td>
+ <input type="checkbox" name="major" {if $event.fieldData.major.value} checked{/if}>
+ </td>
+ </tr>
+ <tr>
+ <th>Categories</th>
+ <td class="glm-item-container">
+
+ <!-- Add new category dialog -->
+
+ <div id="newCategoryButton" class="button button-secondary glm-right">Add a new Category</div>
+ <div id="newCategoryDialog" class="glm-dialog-box" title="Enter a New Category">
+ <table class="glm-admin-table">
+ <tr>
+ <th class="glm-required">Category Name:</th>
+ <td id="newCatNameTD">
+ <input id="newCatName" type="text" name="newCatName" class="glm-form-text-input">
+ <div id="newCatNameRequired"></div>
+ </td>
+ </tr>
+ <tr>
+ <th>Parent Category:</th>
+ <td>
+ <select id="newCatParent" name="newCatParent">
+ {if $categories}
+ <option value=""></option>
+ {foreach $categories as $t}
+ {if !$t.parent} <!-- don't show child categories -->
+ <option value="{$t.id}" data-parent="{$t.name}">{$t.name}</option>
+ {/if}
+ {/foreach}
+ {/if}
+ </select>
+ <br>OR<br>
+ <input id="newCatParentName" type="text" name="newCatParentName" placeholder="Enter a new parent name.">
+ </td>
+ </tr>
+ </table>
+ <p><span class="glm-required">*</span> Required</p>
+ <a id="newCategoryCancel" class="button button-primary glm-right">Cancel</a>
+ <input id="newCategorySubmit" type="submit" value="Add new Category">
+ </div>
+
+ <!-- Category Selection -->
+
+ <select name="categorySelect" id="categorySelect">
+ {if $categories}
+ <option id="categoryNone" value=""></option>
+ {foreach $categories as $v}
+ <option value="{$v.id}" data-parent="{$v.parent}">
+ {if $v.parent_id} {/if}{$v.name}
+ </option>
+ {/foreach}
+ {else}
+ <option id="" value="">(No Categories Listed - Select "Add a new Category" to the right. )</option>
+ {/if}
+ </select> Select a category to add to box below.<br>
+ <div id="activeCategories" class="glm-dynSelect-box">
+
+ {if isset($event.fieldData.categories) && $event.fieldData.categories}
+ {foreach $event.fieldData.categories as $c}
+ <div data-id="{$c.id}" class="glm-dynSelect-item glm-events-category">
+ {if $c.parent_name != ''}{$c.parent_name}: {/if}{$c.name}
+ <span data-id="{$c.id}" class="glm-dynSelect-delete catDelete">X</span>
+ <input type="hidden" name="category[{$c.id}]" value="{$c.id}">
+ </div>
+ {/foreach}
+ {/if}
+ </div>
+ </td>
+ </tr>
+ <tr>
+ <th {if $event.fieldRequired.intro}class="glm-required"{/if}>Intro Text:</th>
+ <td {if $event.fieldFail.intro}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
+ <textarea name="intro" class="glm-form-textarea">{$event.fieldData.intro}</textarea>
+ {if $event.fieldFail.intro}<p>{$event.fieldFail.intro}</p>{/if}
+ </td>
+ </tr>
+ <tr>
+ <th {if $event.fieldRequired.descr}class="glm-required"{/if}>Description:</th>
+ <td {if $event.fieldFail.descr}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
+ {php}
+ wp_editor('{$event.fieldData.descr|escape:quotes}', 'glm_descr', array(
+ // 'media_buttons' => true,
+ // 'quicktags' => false,
+ // 'wpautop' => false, NOTE: Dont's use. Problem when numerous spaces before text.
+ 'textarea_name' => 'descr',
+ 'editor_height' => 200, // Height in px, overrides editor_rows
+ // 'textarea_rows' => 8
+ ));
+ {/php}
+ {if $event.fieldFail.descr}<p>{$event.fieldFail.descr}</p>{/if}
+ </td>
+ </tr>
+ <tr>
+ <th {if $event.fieldRequired.image}class="glm-required"{/if}>Image:</th>
+ <td {if $event.fieldFail.image}class="glm-form-bad-input"{/if}>
+ <table class="glm-admin-image-edit-table">
+ {if $event.fieldData.image}
+ <tr>
+ <td>
+ <div class="glm-galleryImage" data-id="image">
+ <img src="{$glmPluginMediaUrl}/images/small/{$event.fieldData.image}">
+ </div>
+ </td>
+ <td>
+ <input type="checkbox" name="image_delete"> Delete Image<br>
+ {$event.fieldData.image}<br>
+ </td>
+ </tr>
+ {/if}
+ <tr><td colspan="2"><b>New image:</b> <input type="file" name="image_new"></td></tr>
+ </table>
+ <div id="glm-galleryImageLarger_image" class="glm-imageDialog"><img src="{$glmPluginMediaUrl}/images/large/{$event.fieldData.image}"></div>
+ {if $event.fieldFail.image}<p>{$event.fieldFail.image}</p>{/if}
+ </td>
+ </tr>
+ <tr>
+ <th {if $event.fieldRequired.url}class="glm-required"{/if}>Web Address (URL):</th>
+ <td {if $event.fieldFail.url}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
+ <input type="text" name="url" value="{$event.fieldData.url}" class="glm-form-text-input-medium" placeholder="ex: http://www.gaslightmedia.com">
+ {if $event.fieldFail.url}<p>{$event.fieldFail.url}</p>{/if}<br>
+ </td>
+ </tr>
+ <tr>
+ <th {if $event.fieldRequired.cost}class="glm-required"{/if}>Description of Cost:</th>
+ <td {if $event.fieldFail.cost}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
+ <input type="text" name="cost" value="{$event.fieldData.cost}" class="glm-form-text-input-medium">
+ {if $event.fieldFail.cost}<p>{$event.fieldFail.cost}</p>{/if}<br>
+ </td>
+ </tr>
+ <tr>
+ <th {if $event.fieldRequired.notes}class="glm-required"{/if}>Notes:</th>
+ <td {if $event.fieldFail.notes}class="glm-form-bad-input" data-tabid="glm-event-descr"{/if}>
+ <textarea name="notes" class="glm-form-textarea">{$event.fieldData.notes}</textarea>
+ {if $event.fieldFail.notes}<p>{$event.fieldFail.notes}</p>{/if}
+ </td>
+ </tr>
+
+ </table>