information architects logo

information architects

Event Booking System for Police Training (LiveCode Version)

Installation & Configuration Guide

Version 1.0.0 (LiveCode Server)


Overview

This is a portable, flat-file event booking system designed for training events (police training, martial arts, etc.). It runs on LiveCode Server and integrates with your antiGravity CMS via iframe embedding.

Components

  1. events.lc - Main public-facing script (event listing, registration, payment)
  2. events-admin.lc - Admin panel for managing events and registrations
  3. sample-events.json - Example event data

Installation Steps

1. Upload Files

Upload the .lc files to your server:

/home/youruser/public_html/yoursite.com/
  └── events/
      ├── events.lc
      └── events-admin.lc

Set appropriate permissions:

chmod 755 /home/youruser/public_html/yoursite.com/events
chmod 644 /home/youruser/public_html/yoursite.com/events/events.lc
chmod 644 /home/youruser/public_html/yoursite.com/events/events-admin.lc

2. Create Data Directory

Create the data directory structure:

/home/youruser/public_html/yoursite.com/
  └── events/
      └── data/
          ├── events.json (will be created automatically)
          └── registrations/ (create this folder manually)

Set appropriate permissions:

chmod 755 /home/youruser/public_html/yoursite.com/events/data
chmod 755 /home/youruser/public_html/yoursite.com/events/data/registrations

3. Create antiGravity Content Pages with iFrames

Create markdown pages in your antiGravity content structure that embed the LiveCode scripts:

For the public event listing page:

/content/events/page.md

Content:

---
title: Training Events
---

<iframe src="https://yoursite.com/events/events.lc" style="border:none; width:100%; min-height:800px;" frameborder="0"></iframe>

<script>
// Auto-resize iframe to content height
window.addEventListener('message', function(e) {
    if (e.data.height) {
        document.querySelector('iframe').style.height = e.data.height + 'px';
    }
});
</script>

For the admin panel:

/content/events/admin/page.md

Content:

---
title: Event Admin
menu: false
---

<iframe src="https://yoursite.com/events/events-admin.lc" style="border:none; width:100%; min-height:800px;" frameborder="0"></iframe>

<script>
window.addEventListener('message', function(e) {
    if (e.data.height) {
        document.querySelector('iframe').style.height = e.data.height + 'px';
    }
});
</script>

Benefits of the iFrame Approach:


Configuration

IMPORTANT: Configure Both Scripts

Both events.lc and events-admin.lc have configuration sections at the top. These must match!

events.lc Configuration

Open events.lc and edit the configuration section (starting around line 13):

-- Site Configuration
put "/home/youruser/public_html/yoursite.com" into gConfig["basePath"]
put gConfig["basePath"] & "/events/data" into gConfig["dataPath"]
put gConfig["basePath"] & "/events/data/registrations" into gConfig["regPath"]
put "Your Police Training Center" into gConfig["siteName"]

-- Email Configuration
put "events@yoursite.com" into gConfig["fromEmail"]
put "Event Registration System" into gConfig["fromName"]
put "admin@yoursite.com" into gConfig["adminEmail"]

-- Payment Configuration
put "none" into gConfig["paymentProvider"]  -- Options: "braintree", "paypal", "none"
put "" into gConfig["paymentAPIKey"]
put "" into gConfig["paymentMerchantID"]
put "" into gConfig["paymentPublicKey"]

events-admin.lc Configuration

Open events-admin.lc and edit the configuration section (starting around line 18):

-- Site Configuration (MUST MATCH events.lc)
put "/home/youruser/public_html/yoursite.com" into gConfig["basePath"]
put gConfig["basePath"] & "/events/data" into gConfig["dataPath"]
put gConfig["basePath"] & "/events/data/registrations" into gConfig["regPath"]
put "Your Police Training Center" into gConfig["siteName"]

-- Admin Password (CHANGE THIS!)
put "your_secure_password_here" into gConfig["adminPassword"]

-- Email Configuration
put "events@yoursite.com" into gConfig["fromEmail"]
put "Event Registration System" into gConfig["fromName"]

Adding Payment Integration

For Braintree:

  1. Sign up for Braintree account
  2. Get your API credentials
  3. In events.lc, update configuration:
  4. put "braintree" into gConfig["paymentProvider"]
    put "your_braintree_merchant_id" into gConfig["paymentMerchantID"]
    put "your_braintree_public_key" into gConfig["paymentPublicKey"]
    put "your_braintree_private_key" into gConfig["paymentAPIKey"]
    
  1. Implement the processBraintreePayment function in events.lc (around line 660)

For PayPal:

  1. Sign up for PayPal Business account
  2. Get your API credentials
  3. In events.lc, update configuration:
  4. put "paypal" into gConfig["paymentProvider"]
    put "your_paypal_client_id" into gConfig["paymentPublicKey"]
    put "your_paypal_secret" into gConfig["paymentAPIKey"]
    
  1. Implement the processPayPalPayment function in events.lc (around line 668)

Usage

Direct Access (for testing)

You can access the scripts directly:

Through antiGravity (production)

Users access via your CMS pages:

Admin Panel Access

Navigate to: https://yoursite.com/events/admin

Login with the password you configured.

Creating Your First Event

  1. Login to admin panel
  2. Click "Add New Event"
  3. Fill in:
  4. - Title (e.g., "Tactical Firearms Training") - Description - Start Date (and optional End Date for multi-day events) - Location - Total Seats - Price per Person

  1. Click "Save Event"

Public Registration

Users navigate to: https://yoursite.com/events

They will see:

Managing Registrations

In admin panel:

  1. Switch to "Registrations" tab
  2. Filter by event (or view all)
  3. See all registration details
  4. Cancel registrations if needed (frees up seats, optionally sends email)

Data Files

events.json

Stores all event data. Format:

{
  "evt_1234567890": {
    "title": "Tactical Training",
    "description": "Advanced tactical scenarios",
    "date": "2025-03-15",
    "end_date": "",
    "location": "Training Center A",
    "total_seats": 20,
    "price": 150
  }
}

Registration Files

Stored in /data/registrations/ as individual JSON files:

evt_1234567890_1704123456_5432.json

Format:

{
  "event_id": "evt_1234567890",
  "registration_id": "evt_1234567890_1704123456_5432",
  "organization": "Springfield PD",
  "contact_name": "John Smith",
  "contact_email": "jsmith@springfieldpd.gov",
  "contact_phone": "555-1234",
  "contact_address": "123 Main St, Springfield, MO 65806",
  "attendees": "John Smith\nJane Doe\nBob Johnson",
  "attendee_count": 3,
  "total_amount": 450,
  "status": "completed",
  "transaction_id": "TEST-1704123456",
  "registration_date": 1704123456
}

Customization for Different Sites

To adapt this for a martial arts dojo or other training facility:

  1. Update gConfig["siteName"] in both files
  2. Adjust email copy in email functions (search for "sendConfirmationEmail", "sendAdminNotification", etc.)
  3. Modify form labels if needed (change "Organization/Department" to "School/Affiliation", etc.)
  4. Update styling in CSS sections to match your brand

Troubleshooting

Events not showing up

Emails not sending

Registration not saving

Payment not processing

iFrame not displaying properly


Security Notes

  1. Change the admin password! Don't use "admin123"
  2. Keep API keys secure - never commit to version control
  3. Use HTTPS for all pages (especially registration and admin)
  4. Regularly backup the data/ directory
  5. Monitor registrations for fraudulent activity
  6. Consider adding CAPTCHA to registration form for high-traffic sites

File Permissions Checklist

events/                        → 755
events/events.lc              → 644
events/events-admin.lc        → 644
events/data/                  → 755
events/data/registrations/    → 755
events/data/events.json       → 644 (created automatically)
events/data/registrations/*.json → 644 (created automatically)

Quick Start Checklist


Advantages of LiveCode Version


License

This system is provided as-is for your use. Modify as needed for your specific requirements.