added front end form functionality, added jquery, css
authorAnthony Talarico <talarico@gaslightmedia.com>
Wed, 20 Apr 2016 20:37:44 +0000 (16:37 -0400)
committerAnthony Talarico <talarico@gaslightmedia.com>
Wed, 20 Apr 2016 20:37:44 +0000 (16:37 -0400)
css/front.css
js/front.js
models/front/events/frontAdd.php
views/front/events/frontAdd.html

index 8b5c564..4e92e69 100644 (file)
 .timeDropDown{
     width: 30%;
 }
+.frontRecurrences{
+    display: none;
+}
+input[name="event_name"]{
+    margin-bottom: 0px;
+}
+input[name='contact_fname'], input[name='contact_lname']{
+    width: 50%;
+}
 
index bf46cf1..2aafe48 100644 (file)
@@ -20,7 +20,43 @@ var EventFront = {
             return false;
         });
         jQuery("#sdate, #edate").datepicker({
-            dateFormat: 'dd-mm-yy'    
+            dateFormat: 'mm/dd/yy'    
+        });
+        
+        $("#freeEvent").change( function () {
+           if(this.checked){
+               $("#cost").fadeOut('medium');
+           } else {
+               $("#cost").fadeIn('medium');
+           }
+        });
+        $("#repeatingEvent").change( function () {
+           if(this.checked){
+               $(".frontRecurrences").fadeIn('medium');
+           } else {
+               $(".frontRecurrences").fadeOut('medium');
+           }
+        });
+        $("#allDay").change( function () {
+           if(this.checked){
+               $(".timeRow").fadeOut('medium');
+           } else {
+               $(".timeRow").fadeIn('medium');
+           }
+        });
+         $("#dayOfMonth").change( function () {
+           if($(this).val() !== ""){
+               $("#daysOfWeek, #weeklyRepeatRow").fadeOut();
+           } else {
+               $("#daysOfWeek, #weeklyRepeatRow").fadeIn();
+           }
+        });
+        $("#weeklyRepeat").change( function () {
+           if($(this).val() !== ""){
+               $("#dayOfMonthRow").fadeOut();
+           } else {
+               $("#dayOfMonthRow").fadeIn();
+           }
         });
     }
 };
index 3ec2191..df94f30 100644 (file)
@@ -7,7 +7,10 @@
  */
 
 require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataEvents.php';
+require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH . '/data/dataCategories.php';
 require_once GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/models/front/events/baseAction.php';
+require_once(GLM_MEMBERS_PLUGIN_PATH.'/models/admin/ajax/imageUpload.php');
+ require_once GLM_MEMBERS_EVENTS_PLUGIN_CLASS_PATH.'/data/dataRecurrences.php';
 
 /**
  * GLmMembersFront_event_fontAdd
@@ -21,6 +24,37 @@ require_once GLM_MEMBERS_EVENTS_PLUGIN_PATH . '/models/front/events/baseAction.p
  */
 class GLmMembersFront_events_frontAdd extends GlmDataEvents
 {
+    
+    
+     /* getCityId
+     *
+     * Given a city name find and return the id of the city.
+     * If a city cannot be found then create city with that name.
+     *
+     * @param mixed $cityName Name of the city
+     *
+     * @access public
+     * @return id of city
+     */
+    public function getCityId($cityName)
+    {
+        $sql = "
+        SELECT id
+          FROM " . GLM_MEMBERS_PLUGIN_DB_PREFIX . "cities
+         WHERE name like '" . esc_sql( trim( $cityName ) ) . "'";
+        $cityId = $this->wpdb->get_row($sql, ARRAY_A);
+        if ( !$cityId ) {
+            // then add the city to the city table
+            $this->wpdb->insert(
+                GLM_MEMBERS_PLUGIN_DB_PREFIX . 'cities',
+                array( 'name' => trim( $cityName ) ),
+                array( '%s' )
+            );
+            return $this->wpdb->insert_id;
+        } else {
+            return $cityId['id'];
+        }
+    }
     /**
      * modelAction
      *
@@ -31,23 +65,61 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents
      */
     public function modelAction($actionData = false)
     {
+        // populate category dropdown
+        $categories = new GlmDataEventsCategories($this->wpdb, $this->config);
+        $cats = $categories->getList();
+        foreach($cats as $cat){
+            $eventCategories[] = $cat;
+        }
+
+        // Load recurrences class
+        $Recurrences = new GlmDataEventsRecurrences($this->wpdb, $this->config);
+        
+        //Load Events class
         $events = new GlmDataEvents($this->wpdb, $this->config );
         $newEvent = $events->newEntry();
         
+        // if form is submitted
          if($_REQUEST['newEvent'] == "Add Event"){
              
              // parse dates and times
              date_default_timezone_set('America/New_York');
-             $date = date('y/m/d h:i:s a', time());
+             $date = date('y/m/d H:i:s a', time());
              $starting = trim(filter_var($_REQUEST['starting'], FILTER_SANITIZE_STRING));
-             $startTime = trim(filter_var($_REQUEST['shour'],FILTER_SANITIZE_STRING)) . ':' . trim(filter_var($_REQUEST['smin'],FILTER_SANITIZE_STRING)) . " " . trim(filter_var($_REQUEST['sampam'],FILTER_SANITIZE_STRING)) ;
-             $smilitaryTime = date("H:i:s", strtotime($startTime));
+             $ending = trim(filter_var($_REQUEST['ending'], FILTER_SANITIZE_STRING));
+             
+             
+             
+             // if there are no times selected, default the start time to midnight and the endtime to 12:00pm as it is in the admin 
+             if(empty($_REQUEST['ehour']) || empty($_REQUEST['emin'])){
+                 $startTimeOnly = true;
+                 $emilitaryTime = "12:00:00";
+             } else {
+                 $endTime = trim(filter_var($_REQUEST['ehour'],FILTER_SANITIZE_STRING)) . ':' . trim(filter_var($_REQUEST['emin'],FILTER_SANITIZE_STRING)) . " " . trim(filter_var($_REQUEST['eampm'],FILTER_SANITIZE_STRING));
+             
+                 $emilitaryTime = date("H:i:s", strtotime($endTime));
+             }
+             
+             
+             if(empty($_REQUEST['shour']) || empty($_REQUEST['smin'])){
+                 $smilitaryTime = "12:00:00";
+             } else {
+                 $startTime = trim(filter_var($_REQUEST['shour'],FILTER_SANITIZE_STRING)) . ':' . trim(filter_var($_REQUEST['smin'],FILTER_SANITIZE_STRING)) . " " . trim(filter_var($_REQUEST['sampm'],FILTER_SANITIZE_STRING));
+                 
+                 $smilitaryTime = date("H:i:s", strtotime($startTime));
+             }
+             
+             if(empty($_REQUEST['shour']) || empty($_REQUEST['smin']) && empty($_REQUEST['ehour']) || empty($_REQUEST['emin'])){
+                 $allDay = true;
+             }
+             
+             
+             
+             
              $starting_date = strtotime($starting . " " . $smilitaryTime);
              $mysqlStart = date("Y-m-d H:i:s",$starting_date);
              
-             $ending = trim(filter_var($_REQUEST['ending'], FILTER_SANITIZE_STRING));
-             $endTime = trim(filter_var($_REQUEST['ehour'],FILTER_SANITIZE_STRING)) . ':' . trim(filter_var($_REQUEST['emin'],FILTER_SANITIZE_STRING)) . " " . trim(filter_var($_REQUEST['eampam'],FILTER_SANITIZE_STRING)) ;
-             $emilitaryTime = date("H:i:s", strtotime($endTime));
              $ending_date = strtotime($ending . " " . $emilitaryTime);
              $mysqlEnd = date("Y-m-d H:i:s",$ending_date);
         
@@ -55,12 +127,17 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents
              $name = trim(filter_var($_REQUEST['event_name'],FILTER_SANITIZE_STRING));
              $intro = trim(filter_var($_REQUEST['intro'],FILTER_SANITIZE_STRING));
              $descr = trim(filter_var($_REQUEST['descr'],FILTER_SANITIZE_STRING));
-             $cost = trim(filter_var($_REQUEST['event_cost'],FILTER_SANITIZE_STRING));
+             $cost = trim(filter_var($_REQUEST['cost'],FILTER_SANITIZE_STRING));
              $url = trim(filter_var($_REQUEST['url'],FILTER_SANITIZE_STRING));
              $admin_name = trim(filter_var($_REQUEST['admin_name'],FILTER_SANITIZE_STRING));
              $admin_org = trim(filter_var($_REQUEST['admin_org'],FILTER_SANITIZE_STRING));
+             $adminPhone = trim(filter_var($_REQUEST['admin_phone'],FILTER_SANITIZE_STRING));
+             $adminEmail = trim(filter_var($_REQUEST['admin_email'],FILTER_SANITIZE_STRING));
+             $facebook = trim(filter_var($_REQUEST['facebook'],FILTER_SANITIZE_STRING));
+             $twitter = trim(filter_var($_REQUEST['twitter'],FILTER_SANITIZE_STRING));
              
-             // locations table data
+             $contactFirst = trim(filter_var($_REQUEST['contact_fname'],FILTER_SANITIZE_STRING));
+             $contactLast = trim(filter_var($_REQUEST['contact_lname'],FILTER_SANITIZE_STRING));
              $place = trim(filter_var($_REQUEST['place'],FILTER_SANITIZE_STRING));
              $address = trim(filter_var($_REQUEST['address'],FILTER_SANITIZE_STRING));
              $city = trim(filter_var($_REQUEST['city'],FILTER_SANITIZE_STRING));
@@ -68,21 +145,128 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents
              $zip = trim(filter_var($_REQUEST['zip'],FILTER_SANITIZE_STRING));
              $contactEmail = trim(filter_var($_REQUEST['contact_email'],FILTER_SANITIZE_STRING));
              $contactPhone = trim(filter_var($_REQUEST['contact_phone'],FILTER_SANITIZE_STRING));
+             $fileDescr = trim(filter_var($_REQUEST['fileDescription'],FILTER_SANITIZE_STRING));
 
+             $weekOfMonth = $_REQUEST['weekom'];
+             $weekofMonth = pow(2, $weekOfMonth);
+             
+             $category = $_REQUEST['categories'];
 
+             // set boolean values based on selected recurrence options
+             if(!empty($dayOfMonth =  $_REQUEST['dayom'])){
+                 $dayOfMonth = pow(2, $dayOfMonth);
+                 $byDayOfMonth = true;
+                 echo $dayOfMonth;
+             } else {
+                 $byDayOfMonth = false;
+             }
+             
+             if(empty($_REQUEST['free'])){
+                 $free = false;
+             } else {
+                 $free = true;
+             }
+             if(empty($_REQUEST['repeating'])){
+                 $repeating = false;
+             } else {
+                 $repeating = $_REQUEST['repeating'];
+             }
+             if(empty($_REQUEST['allday'])){
+                 $allDay = false;
+//                 $startTimeOnly = false;
+             } else {
+                 $allDay = $_REQUEST['allday'];
+//                 $startTimeOnly = true;
+             }
              
+             //get days of the week values for recurrences
+             foreach($_REQUEST['daysow'] as $check){
+                 $daysOfWeek[] = $check;
+             }
+             foreach($daysOfWeek as $key=>$value){
+                 if(!empty($value)){
+                     $days += $value;
+                 }
+             }
+             
+             $city =  $this->getCityId($city);
+             // image upload settings
+             $image = $_FILES['image_new'];
+             $imageName = $image['name'];
+             $imageTmp = $image['tmp_name'];
+             $imageSize = $image['size'];
+             $imageError = $image['error'];
+
+            $temp = explode('.', $imageName);
+            $imageExt  = array_pop($temp);
+            $imageExt = strtolower($imageExt);
+            $tmpName = implode('.', $temp);
+            
+             $allowed = array('jpeg', 'png', 'jpg', 'bmp', 'gif','svg');
+             if(in_array($imageExt, $allowed)){
+                 if($imageError === 0){
+                     if($imageSize <= 1000000){
+                         $imageName = $tmpName . "-" . uniqid() . "." . $imageExt;
+                         $imgUrl = GLM_MEMBERS_PLUGIN_MEDIA_PATH . "/images/small/" . $imageName;
+                         if(!file_exists($imgUrl)){
+                            if(move_uploaded_file($imageTmp, $imgUrl)){
+                                
+                            }
+                        } else {
+                             echo "Image Already Exists";
+                        }
+                    }
+                 }
+             }
+             //file upload settings
+                $file = $_FILES['file_rmv'];
+                $fileName = $file['name'];
+                $fileTmp = $file['tmp_name'];
+                $fileSize = $file['size'];
+                $fileError = $file['error'];
+                 
+                $temp = explode('.', $fileName);
+                $fileExt  = array_pop($temp);
+                $fileExt = strtolower($fileExt);
+                $tmpName = implode('.', $temp);
+                $allowed = array('txt', 'pdf', 'docx', 'odt', 'xls', 'doc');
+                 if(in_array($fileExt, $allowed)){
+                 if($fileError === 0){
+                     if($fileSize <= 2000000){
+                         $fileName = $tmpName . "-" . uniqid() . "." . $fileExt;
+                         $fileUrl = GLM_MEMBERS_PLUGIN_MEDIA_PATH . "/files/" .$fileName;
+                         if(!file_exists($fileUrl)){
+                            if(move_uploaded_file($fileTmp, $fileUrl)){
+                                
+                            }
+                        } else {
+                             echo "File Already Exists";
+                        }
+                    }
+                 }
+             }
+          // mySql transactions
              $eventData = array(
-                            'status'   => '20',
-                            'created'  => $date,
-                            'updated'  => $date,
-                            'name'     => $name,
-                            'intro'    => $intro,
-                            'descr'    => $descr,
-                            'image'    => $event['img'],
-                            'cost'     => $cost,
-                            'url'      => $url,
-                            'admin_name' => $admin_name,
-                            'admin_org'  => $admin_org
+                            'status'            => '20',
+                            'created'           => $date,
+                            'updated'           => $date,
+                            'name'              => $name,
+                            'intro'             => $intro,
+                            'descr'             => $descr,
+                            'image'             => $imageName,
+                            'file1'             => $fileName,
+                            'file1_descr'       => $fileDescr,
+                            'cost'              => $cost,
+                            'free'              => $free,
+                            'url'               => $url,
+                            'contact_phone'     => $contactPhone,
+                            'admin_name'        => $admin_name,
+                            'admin_phone'       => $adminPhone,
+                            'admin_email'       => $adminEmail,
+                            'contact_name'      => $contactFirst . " " . $contactLast,
+                            'contact_email'     => $contactEmail,
+                            'contact_email'     => $contactPhone,
+                            'admin_org'         => $admin_org
                         );
             $this->wpdb->insert(
                         GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'events',
@@ -95,36 +279,34 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents
                              '%s',
                              '%s',
                              '%s',
-                             '%d',
                              '%s',
                              '%s',
                              '%s',
-                        )
-                    );   
-                    $lastID = $this->wpdb->insert_id;
-                    $timeData = array(
-                            'event' => $lastID,
-                            'start_time' => $mysqlStart,
-                            'end_time' => $mysqlEnd,
-                        );
-            $this->wpdb->insert(
-                        GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'times',
-                        $timeData,
-                        array(
-                             '%d',
+                             '%s',
+                             '%s',
+                             '%s',
+                             '%s',
+                             '%s',
+                             '%s',
+                             '%s',
+                             '%s',
                              '%s',
                              '%s'
                         )
-                    );
+                    );   
+            $eventID = $this->wpdb->insert_id;
+            
             $locationData = array(
-                            'event' => $lastID,
-                            'name' => $place,
-                            'address' => $address,
-                            'city'   => $city,
-                            'state'  => $state,
-                            'zip'    => $zip,
-                            'phone'  => $contactPhone,
-                            'email'  => $contactEmail
+                            'event'         => $eventID,
+                            'name'          => $place,
+                            'address'       => $address,
+                            'city'          => $city,
+                            'state'         => $state,
+                            'zip'           => $zip,
+                            'phone'         => $contactPhone,
+                            'contact_fname' => $contactFirst,
+                            'contact_lname' => $contactLast,
+                            'email'         => $contactEmail
                             
             );
              $this->wpdb->insert(
@@ -138,16 +320,98 @@ class GLmMembersFront_events_frontAdd extends GlmDataEvents
                              '%s',
                              '%s',
                              '%s',
+                             '%s',
+                             '%s',
                              '%s'
                         )
                     );
-        }
-         
+             $ending = date("Y-m-d", strtotime($ending));
+             $starting = date("Y-m-d", strtotime($starting));
+             $recurData =array(
+                    'event'             => $eventID,
+                    'start_time'        => $smilitaryTime,
+                    'end_time'          => $emilitaryTime,
+                    'from_date'         => $starting,
+                    'to_date'           => $ending,
+                    'all_day'           => $allDay,
+                    'recurring'         => $repeating,
+                    'day_of_month'      => $dayOfMonth,
+                    'week_of_month'     => $weekOfMonth,
+                    'start_time_only'   => $startTimeOnly,
+                    'day_of_week'       => $days,
+                    'by_day_of_month'   => $byDayOfMonth,
+                    'last_day_of_month' => $lastDayOfMonth
+                );
+              $this->wpdb->insert(
+                    GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'recurrences',
+                    $recurData,
+                    array(
+                         '%d',
+                         '%s',
+                         '%s',
+                         '%s',
+                         '%s',
+                         '%d',
+                         '%d',
+                         '%d',
+                         '%d',
+                         '%d',
+                         '%d',
+                         '%d',
+                         '%d'
+                    )
+                );
+              $recurID = $this->wpdb->insert_id;
+              $timeData = array(
+                    'event'      => $eventID,
+                    'start_time' => $mysqlStart,
+                    'end_time'   => $mysqlEnd,
+                    'recur_id'   => $recurID,
+                    'all_day'    => $allDay
+                );
+              $this->wpdb->insert(
+                        GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'times',
+                        $timeData,
+                        array(
+                             '%d',
+                             '%s',
+                             '%s',
+                             '%d',
+                             '%d'
+                        )
+                    );
+              $categoryData = array(
+                    'event'      => $eventID,
+                    'category'   => $category
+                );
+              $this->wpdb->insert(
+                        GLM_MEMBERS_EVENTS_PLUGIN_DB_PREFIX . 'event_categories',
+                        $categoryData,
+                        array(
+                             '%d',
+                             '%d'
+                        )
+                    );
+              
+              
+            // Send confirmation email
+            $to      = 'anthony@localhost';
+            $subject = 'Event Form Submission';
+            $message = "Thank you for submitting your event! \r\n". "Event Name: " . $name . "\r\n" .
+                       "Scheduled for: " . $starting ;
+            $headers = 'From: webmaster@example.com' . "\r\n" .
+                        'Reply-To: webmaster@example.com' . "\r\n" .
+                        'X-Mailer: PHP/' . phpversion();
+
+            mail($to, $subject, $message, $headers);
+         }
+        
+//        echo '<pre>', print_r($cats), '</pre>';
         // Compile template data
         $templateData = array(
             'siteBaseUrl' => GLM_MEMBERS_EVENTS_SITE_BASE_URL,
             'currentUrl'  => $_SERVER['HTTP_REFERER'],
-            'categories'  => $categories,
+            'categories'  => $eventCategories,
             'fromDate'    => $fromDate,
             'event'       => $newEvent,
             'permalink'   => $permalink,
index 3ce053e..d5d2907 100644 (file)
@@ -1,29 +1,39 @@
 
 <!-- Status and Description -->
 <h2> Add Your Event </h2>
-<form action="{$thisUrl}" method="post" name="frontAddForm" id="frontForm">
+
+<form action="{$thisUrl}" method="post" enctype="multipart/form-data" name="frontAddForm" id="frontForm">
     <table id="glm-table-descr" class="glm-admin-table glm-event-table">      
         <tr>
-            <th>Event Name:</th>
+            <th style="color: red;">Event Name: </th>
             <td>
-                <input type="text" name="event_name" value="" class="glm-form-text-input-medium glm-required" placeholder="Name of this event.">
-                {if $event.fieldFail.name}<p>{$event.fieldFail.name}</p>{/if}<br>
+                <input type="text" name="event_name" value="" class="glm-form-text-input-medium glm-required" placeholder="Name of this event" required>
+                {if $event.fieldFail.event_name}<p>{$event.fieldFail.event_name}</p>{/if}<br>
             </td>
         </tr>       
-        
         <tr>
-            <th> Start Date </th>
-            <td><input class="glm-datetime-input" id="sdate" name="starting" maxlength="100" type="text"></td>
+            <th style="color: red;"> Start Date </th>
+            <td><input class="glm-datetime-input glm-required" id="sdate" name="starting" maxlength="100" type="text" required></td>
         </tr>
         <tr>
-            <th> End Date </th>
-            <td><input class="glm-datetime-input" id="edate" name="ending" maxlength="100" type="text"></td>
+            <th style="color: red;"> End Date </th>
+            <td><input class="glm-datetime-input glm-required" id="edate" name="ending" maxlength="100" type="text" required></td>
         </tr>
         <tr>
+        <tr>
+            <th> All Day Event </th>
+            <td class="fieldcell">
+                <input name="allday" value="0" type="hidden">
+                <label class="glmCheckBox">
+                     <input id="allDay" name="allday" value="1" type="checkbox"> Yes
+                </label>
+            </td>
+        </tr>
+        <tr class='timeRow'>
             <th> Start Time </th>
         <td>
-               <select class="timeDropDown" name="shour">
-                <option value="">hh</option>
+               <select class="timeDropDown glm-required" name="shour">
+                <option value="">Hour</option>
                 <option value="1">01</option>
                 <option value="2">02</option>
                 <option value="3">03</option>
                 <option value="10">10</option>
                 <option value="11">11</option>
                 <option value="12">12</option>
-        </select>&nbsp;:&nbsp;<select class="timeDropDown" name="smin">
-                <option value="">mm</option>
+        </select>&nbsp;:&nbsp;<select class="timeDropDown glm-required" name="smin">
+                <option value="">Minute</option>
                 <option value="0">00</option>
                 <option value="15">15</option>
                 <option value="30">30</option>
                 <option value="45">45</option>
-        </select>&nbsp;<select class="timeDropDown" name="sampam">
-                <option value="">am/pm</option>
+        </select>&nbsp;<select class="timeDropDown glm-required" name="sampm">
+                <option value="">AM/PM</option>
                 <option value="AM">AM</option>
                 <option value="PM">PM</option>
         </select>
        </td>
         </tr>
-          <tr>
+          <tr class="timeRow">
             <th> End Time </th>
         <td>
                <select class="timeDropDown" name="ehour">
         </select>
        </td>
         </tr>
+        <tr>
+            <th>Repeating Event</th>
+            <td>
+                <label><input id="repeatingEvent" type="checkbox" name="repeating" value="1"></label>
+            </td>
+        </tr>
+        
+        <tr class="frontRecurrences" id="dayOfMonthRow" >
+            <td><label>Every Month on</label></td>
+            <td>
+                <select id="dayOfMonth" name="dayom">
+                    <option value=""> Select </option>
+                    <option value="0">1st</option><option value="1">2nd</option><option value="2">3rd</option><option value="3">4th</option><option value="4">5th</option><option value="5">6th</option><option value="6">7th</option><option value="7">8th</option><option value="8">9th</option><option value="9">10th</option><option value="10">11th</option><option value="11">12th</option><option value="12">13th</option><option value="13">14th</option><option value="14">15th</option><option value="15">16th</option><option value="16">17th</option><option value="17">18th</option><option value="18">19th</option><option value="19">20th</option><option value="20">21st</option><option value="21">22nd</option><option value="22">23rd</option><option value="23">24th</option><option value="24">25th</option><option value="25">26th</option><option value="26">27th</option><option value="27">28th</option><option value="28">29th</option><option value="29">30th</option><option value="30">31st</option>                
+                </select>
+            </td>
+        </tr>
+        <tr class="frontRecurrences" id="weeklyRepeatRow">
+            <td><label>Repeats</label></td>
+            <td>
+                <select name="weekom" id="weeklyRepeat">
+                    <option value="">Select</option>
+                    <option value="1">Every First Week of Month</option><option value="2">Every Second Week of Month</option><option value="3">Every Third Week of Month</option><option value="4">Every Fourth Week of Month</option><option value="5">Every Fifth Week of Month</option> <option value="6">Every Last Week of Month</option> 
+                </select>
+            </td>
+        </tr>
+        <tr class="frontRecurrences" id="daysOfWeek">
+            <td class="labelcell"><label>Days of Week</label></td>
+            <td class="fieldcell">
+                
+                        <input name="daysow[1]" value="" type="hidden">
+                        <label class="glmCheckBox">
+                          <input name="daysow[1]" value="1" type="checkbox">Sunday
+                        </label>
+                        <input name="daysow[2]" value="" type="hidden">
+                        <label class="glmCheckBox">
+                          <input name="daysow[2]" value="2" type="checkbox">Monday
+                        </label>
+                        <input name="daysow[3]" value="" type="hidden">
+                        <label class="glmCheckBox">
+                          <input name="daysow[3]" value="4" type="checkbox">Tuesday
+                        </label>
+                        <input name="daysow[4]" value="" type="hidden">
+                        <label class="glmCheckBox">
+                          <input name="daysow[4]" value="8" type="checkbox">Wednesday
+                        </label>
+                        <input name="daysow[5]" value="" type="hidden">
+                        <label class="glmCheckBox">
+                          <input name="daysow[5]" value="16" type="checkbox">Thursday
+                        </label>
+                        <input name="daysow[6]" value="" type="hidden">
+                        <label class="glmCheckBox">
+                          <input name="daysow[6]" value="32" type="checkbox">Friday
+                        </label>
+                        <input name="daysow[7]" value="" type="hidden">
+                        <label class="glmCheckBox">
+                          <input name="daysow[7]" value="64" type="checkbox">Saturday
+                        </label>            
+            </td>
+        </tr>
+        <tr>
+            <th style="color: red;"> Categories </th>
+            <td> 
+                
+                <select class="glm-required" id="eventCategories" name="categories" >
+                    <option selected value> Select Category</option>
+                    {foreach from=$categories item=cat}
+                    <option value="{$cat['id']}"> {$cat['name']} </option>
+                    {/foreach}
+                </select>
+            </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}>
             </td>
         </tr>
         <tr>
+            <th>Free Event</th>
+            <td>
+                <label><input id="freeEvent" type="checkbox" name="free" value="free"></label>
+            </td>
+        </tr>
+        <tr id="cost">
             <th {if $event.fieldRequired.cost}class="glm-required"{/if}>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}
                     <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>
                <label style="color: red;">Place</label>
             </td>
             <td>
-               <input name="place" maxlength="100" type="text">
+               <input class="glm-required" name="place" maxlength="100" type="text" required>
             </td>
         </tr>
         <tr>
                <label >Address</label>
             </td>
             <td>
-               <input name="adress" maxlength="100" type="text">
+               <input name="address" maxlength="100" type="text">
             </td>
         </tr>
         <tr>
                <label style="color: red;">City</label>
             </td>
             <td>
-               <input name="city" maxlength="100" type="text">
+               <input name="city" maxlength="100" type="text" class="glm-required" required>
             </td>
         </tr>
         <tr>
-            <td>
-               <label >State</label>
-            </td>
-            <td>
-               <input name="state" maxlength="100" type="text">
-            </td>
-        </tr>
+    <th style='color:red;'>State:</th>
+    <td>
+        <select id="state_30" name="state" required>
+            <option value="AL">
+                Alabama
+            </option>
+            <option value="AK">
+                Alaska
+            </option>
+            <option value="AB">
+                Alberta
+            </option>
+            <option value="AZ">
+                Arizona
+            </option>
+            <option value="AR">
+                Arkansas
+            </option>
+            <option value="BC">
+                British Columbia
+            </option>
+            <option value="CA">
+                California
+            </option>
+            <option value="CO">
+                Colorado
+            </option>
+            <option value="CT">
+                Connecticut
+            </option>
+            <option value="DE">
+                Delaware
+            </option>
+            <option value="DC">
+                District of Columbia
+            </option>
+            <option value="FL">
+                Florida
+            </option>
+            <option value="GA">
+                Georgia
+            </option>
+            <option value="GU">
+                Guam
+            </option>
+            <option value="HI">
+                Hawaii
+            </option>
+            <option value="ID">
+                Idaho
+            </option>
+            <option value="IL">
+                Illinois
+            </option>
+            <option value="IN">
+                Indiana
+            </option>
+            <option value="IA">
+                Iowa
+            </option>
+            <option value="KS">
+                Kansas
+            </option>
+            <option value="KY">
+                Kentucky
+            </option>
+            <option value="LA">
+                Louisiana
+            </option>
+            <option value="ME">
+                Maine
+            </option>
+            <option value="MB">
+                Manitoba
+            </option>
+            <option value="MD">
+                Maryland
+            </option>
+            <option value="MA">
+                Massachusetts
+            </option>
+            <option value="MI">
+                Michigan
+            </option>
+            <option value="MN">
+                Minnesota
+            </option>
+            <option value="MS">
+                Mississppi
+            </option>
+            <option value="MO">
+                Missouri
+            </option>
+            <option value="MT">
+                Montana
+            </option>
+            <option value="NE">
+                Nebraska
+            </option>
+            <option value="NV">
+                Nevada
+            </option>
+            <option value="NB">
+                New Brunswick
+            </option>
+            <option value="NF">
+                Newfoundland
+            </option>
+            <option value="NH">
+                New Hampshire
+            </option>
+            <option value="NJ">
+                New Jersey
+            </option>
+            <option value="NM">
+                New Mexico
+            </option>
+            <option value="NY">
+                New York
+            </option>
+            <option value="NC">
+                North Carolina
+            </option>
+            <option value="ND">
+                North Dakota
+            </option>
+            <option value="NT">
+                Northwest Territories
+            </option>
+            <option value="NS">
+                Nova Scotia
+            </option>
+            <option value="OH">
+                Ohio
+            </option>
+            <option value="OK">
+                Oklahoma
+            </option>
+            <option value="ON">
+                Ontario
+            </option>
+            <option value="OR">
+                Oregon
+            </option>
+            <option value="PA">
+                Pennsylvania
+            </option>
+            <option value="PE">
+                Prince Edward Island
+            </option>
+            <option value="PR">
+                Puerto Rico
+            </option>
+            <option value="QC">
+                Quebec
+            </option>
+            <option value="RI">
+                Rhode Island
+            </option>
+            <option value="SK">
+                Saskatchewan
+            </option>
+            <option value="SC">
+                South Carolina
+            </option>
+            <option value="SD">
+                South Dakota
+            </option>
+            <option value="TN">
+                Tennessee
+            </option>
+            <option value="TX">
+                Texas
+            </option>
+            <option value="UT">
+                Utah
+            </option>
+            <option value="VT">
+                Vermont
+            </option>
+            <option value="VI">
+                Virgin Islands
+            </option>
+            <option value="VA">
+                Virginia
+            </option>
+            <option value="WA">
+                Washington
+            </option>
+            <option value="WV">
+                West Virginia
+            </option>
+            <option value="WI">
+                Wisconsin
+            </option>
+            <option value="WY">
+                Wyoming
+            </option>
+            <option value="YT">
+                Yukon
+            </option>
+        </select>
+    </td>
+</tr>
         <tr>
             <td>
                <label >ZIP</label>
             <td>
                <label>Event Contact Person<br>(published on Web site)</label>
             </td>
-            <td class="fieldcell">
-               <input name="contact_name" maxlength="100" type="text">
+            <td class="contactName">
+               <input id="contactFirstName" name="contact_fname" maxlength="100" type="text" placeholder="First Name">
+      
+               <input id="contactLastName" name="contact_lname" maxlength="100" type="text" placeholder="Last Name">
             </td>
         </tr>
         <tr>
                <label style="color: red;">Contact Phone<br>(published on Web site)</label>
             </td>
             <td>
-               <input name="contact_phone" maxlength="100" type="text">
+               <input name="contact_phone" maxlength="100" type="text" class="glm-required" required>
             </td>
         </tr>
         <tr>
             <td>
-               <label style="color: red;">Contact Name Submitting Event</label>
+               <label style="color: red;">Organization Contact Name Submitting Event</label>
             </td>
             <td>
-               <input name="admin_name" maxlength="100" type="text">
+               <input name="admin_name" maxlength="100" type="text" class="glm-required">
             </td>
         </tr>
         <tr>
             <td>
-               <label style="color: red;">Organization Name Submitting Event</label>
+               <label style="color: red;"> Name of Organization </label>
             </td>
             <td>
-               <input name="admin_org" maxlength="100" type="text">
+               <input name="admin_org" maxlength="100" type="text" class="glm-required">
             </td>
         </tr>
         <tr>
             <td>
-               <label>Event File</label>
+                <label style="color: red;">Organization Phone</label>
             </td>
             <td>
-               <input name="file_rmv" type="file">
+               <input name="admin_phone" maxlength="100" type="text" class="glm-required" required>
             </td>
         </tr>
         <tr>
             <td>
-               <label>File Name</label>
+
+               <label style="color: red;">Organization Email Address</label>
             </td>
             <td>
-               <input name="filename" maxlength="100" type="text">
+               <input name="admin_email" maxlength="100" type="text" class="glm-required" required>
             </td>
         </tr>
         <tr>
             <td>
-                <label style="color: red;">Phone</label>
+               <label>Event File</label>
             </td>
             <td>
-               <input name="admin_phone" maxlength="100" type="text">
+               <input name="file_rmv" type="file">
             </td>
         </tr>
         <tr>
             <td>
-
-               <label style="color: red;">Email Address</label>
+               <label>File Description</label>
             </td>
             <td>
-               <input name="admin_email" maxlength="100" type="text">
+               <input name="fileDescription" maxlength="100" type="text">
             </td>
         </tr>
-        
-
-
 
     </table>
 <input id="newEvent" name='newEvent' type="submit" value="Add Event">