From b1be4d02d8e4ba3a1366e3573f3512e73fd48546 Mon Sep 17 00:00:00 2001 From: Steve Sutton Date: Mon, 5 May 2014 19:37:14 +0000 Subject: [PATCH] Form work for site Two Forms created Temp storage form Service form --- Toolkit/Contacts/ContactUs.php | 51 ++++- Toolkit/Contacts/ServiceRequest.php | 233 +++++++++++++++----- Toolkit/Contacts/TempStorageQuickLaunch.php | 62 ++++-- Toolkit/Contacts/templates/contactForm.html | 34 +-- css/contactform.css | 120 +++++----- static/19.phtml | 12 + 6 files changed, 360 insertions(+), 152 deletions(-) create mode 100644 static/19.phtml diff --git a/Toolkit/Contacts/ContactUs.php b/Toolkit/Contacts/ContactUs.php index 835feab..4905702 100755 --- a/Toolkit/Contacts/ContactUs.php +++ b/Toolkit/Contacts/ContactUs.php @@ -779,6 +779,32 @@ class Toolkit_Contacts_ContactUs $page->lname = $this->getSubmitValue('lname'); $page->formData = $this->formData; + //var_dump($page->formData);exit; + if ( isset($this->newWorkRequest) + && is_array($this->newWorkRequest) + && !empty($this->newWorkRequest) + ) { + //var_dump($page->formData['work_requested']); + // Clean up the interests so they will look nice in the email + $page->formData['work_requested']['nowrap'] = 'nowrap'; + $page->formData['work_requested']['element'] = null; + //var_dump($page->formData['work_requested']); + + //var_dump($this->workTypes); + foreach ($this->newWorkRequest as $group => $elements) { + //var_dump($elements); + $page->formData['work_requested['.$group.']']['label'] = $group; + foreach ($elements as $e => $vale) { + $workRequest[] = $e; + } + $page->formData['work_requested['.$group.']']['element'] + = implode("
", $workRequest); + unset($workRequest); + } + //var_dump($page->formData); + //exit; + } + if ( isset($this->newInterest) && is_array($this->newInterest) && !empty($this->newInterest) @@ -798,6 +824,18 @@ class Toolkit_Contacts_ContactUs } } + if ($this->elementExists('service_request_yes') + && $page->formData['service_request_yes']['element'] + ) { + $page->formData['service_request_yes']['label'] = 'Are you also requesting launch Service'; + $page->formData['service_request_yes']['element'] = 'Yes'; + } + if ($this->elementExists('service_request_no') + && $page->formData['service_request_no']['element'] + ) { + $page->formData['service_request_no']['label'] = 'Are you also requesting launch Service'; + $page->formData['service_request_no']['element'] = 'No'; + } if ($this->elementExists('mail_ok')) { // Clean up the mail_ok flag so its human readable $page->formData['mail_ok']['label'] = 'Emails'; @@ -956,7 +994,8 @@ class Toolkit_Contacts_ContactUs $existingContact = $this->contactExists($values['email']); // setup newInterest aray with the interest values // because their grouped can't be found with getElement('interest') - $this->newInterest = $values['interest']; + $this->newInterest = $values['interest']; + $this->newWorkRequest = $values['work_requested']; // update create_date for this contact $values['create_date'] = date('m/d/Y'); @@ -1082,7 +1121,7 @@ class Toolkit_Contacts_ContactUs public function toHtml() { if ($this->validate()) { - $this->captchaQuestion->destroy(); + //$this->captchaQuestion->destroy(); $this->cleanForm(); $this->setupRenderers(); if ($this->process(array(&$this, 'processData'), $this->mergeFiles)) { @@ -1092,14 +1131,14 @@ class Toolkit_Contacts_ContactUs } $this->sent = true; } elseif ($this->isSubmitted()) { - $this->captchaQuestion->destroy(); - $this->captchaAnswer->setValue(''); + //$this->captchaQuestion->destroy(); + //$this->captchaAnswer->setValue(''); $this->setupRenderers(); $output = $this->errorMsg; $output .= $this->template->bufferedOutputObject($this->view); } else { - $this->captchaQuestion->destroy(); - $this->captchaAnswer->setValue(''); + //$this->captchaQuestion->destroy(); + //$this->captchaAnswer->setValue(''); $this->setupRenderers(); $output .= $this->template->bufferedOutputObject($this->view); } diff --git a/Toolkit/Contacts/ServiceRequest.php b/Toolkit/Contacts/ServiceRequest.php index 175d1b7..7233a3e 100755 --- a/Toolkit/Contacts/ServiceRequest.php +++ b/Toolkit/Contacts/ServiceRequest.php @@ -254,14 +254,14 @@ class Toolkit_Contacts_ServiceRequest 'display' => 'Name of Vessel' ); $engTypes = array( - '' => 'Select Engine Type', - 'group1' => 'Outboard', - 'Mercury' => 'Mercury', + '' => 'Select Engine Type', + 'group1' => 'Outboard', + 'Mercury' => 'Mercury', 'Evinrude / Johnson' => 'Evinrude / Johnson', - 'group2' => 'Stern Drive', - 'Mercruiser' => 'Mercruiser', - 'group3' => 'Sail Boats', - 'N/A' => 'Not Applicable' + 'group2' => 'Stern Drive', + 'Mercruiser' => 'Mercruiser', + 'group3' => 'Sail Boats', + 'N/A' => 'Not Applicable' ); $e[] = array( 'type' => 'select3', @@ -270,61 +270,180 @@ class Toolkit_Contacts_ServiceRequest 'display' => 'Engine Type', 'opts' => $engTypes ); - $serTypes = array( - '' => '', - 'group1' => 'Yes', - 'Yes - Anticipated Arrival Date' => 'Anticipated Arrival Date', - 'group2' => 'No', - 'No - Date vessel will be delivered to CM facility' - => 'Date vessel will be delivered to CM facility', - 'No - Desired Completion Date' => 'Desired Completion Date', + $e[] = array( + 'type' => 'header', + 'name' => 'serviceHdr_rmv', + 'display' => 'Are you also requesting launch service?' ); $e[] = array( - 'type' => 'select3', - 'req' => true, - 'name' => 'service_request', - 'display' => 'Are you also requesting launch service?', - 'opts' => $serTypes + 'type' => 'advcheckbox', + 'req' => false, + 'name' => 'service_request_yes', + 'display' => '', + 'opts' => 'Yes', + 'val' => array(0, 1) ); - $workTypes = array( - '' => '', - 'group1' => 'Cleaning and Upkeep', - 'Cleaning and Upkeep - Wash & Vacuum' => 'Wash & Vacuum', - 'Cleaning and Upkeep - Deck & Hull Wax Only' => 'Deck & Hull Wax Only', - 'Cleaning and Upkeep - Paint Bottom (with anti-fouling paint)' - => 'Paint Bottom (with anti-fouling paint)', - 'Cleaning and Upkeep - Clear & Oil Teak' => 'Clear & Oil Teak', - 'Cleaning and Upkeep - Repair Navigation Lights, Blower, bilge pump, etc. (please specify below)' - => 'Repair Navigation Lights, Blower, bilge pump, etc. (please specify below)', - 'Cleaning and Upkeep - Check Fire Extinguisher & Replace if Necessary' - => 'Check Fire Extinguisher & Replace if Necessary', - 'Cleaning and Upkeep - Detail Cabin (Larger Vessels)' => 'Detail Cabin (Larger Vessels)', - 'group2' => 'Engine', - 'Engine - Basic Check (Hoses, Steering, Battery, Fuel Tanks, etc.)' - => 'Basic Check (Hoses, Steering, Battery, Fuel Tanks, etc.)', - 'Engine - Complete Ignition Tune-Up (Cap, Rotor, Plugs & Wires - if necessary)' - => 'Complete Ignition Tune-Up (Cap, Rotor, Plugs & Wires - if necessary)', - 'Engine - Change Engine Oil & Filter (and water separator if necessary)' - => 'Change Engine Oil & Filter (and water separator if necessary)', - 'Engine - Extensive Test run (15 to 20 minutes)' - => 'Extensive Test run (15 to 20 minutes)', - 'group2' => 'Outdrive & Gearcase', - 'Outdrive & Gearcase - Lube U-Joints' => 'Lube U-Joints', - 'Outdrive & Gearcase - Change Water impellor' => 'Change Water impellor', - 'Outdrive & Gearcase - Check Trim & Tilt' => 'Check Trim & Tilt', - 'Outdrive & Gearcase - Check Boots' => 'Check Boots', - 'Outdrive & Gearcase - Weld Skeg' => 'Weld Skeg', - 'Outdrive & Gearcase - Replace Anodes' => 'Replace Anodes', - 'Outdrive & Gearcase - Replace Upper Seals' => 'Replace Upper Seals', - 'Outdrive & Gearcase - Replace Lower Seals' => 'Replace Lower Seals', + $e[] = array( + 'type' => 'text', + 'req' => false, + 'name' => 'arrival_date', + 'display' => 'Anticipated Arrival Date' ); $e[] = array( - 'type' => 'select3', - 'req' => true, - 'name' => 'work_requested', - 'display' => 'Work Requested', - 'opts' => $workTypes + 'type' => 'advcheckbox', + 'req' => false, + 'name' => 'service_request_no', + 'display' => '', + 'opts' => 'No', + 'val' => array(0, 1) ); + $e[] = array( + 'type' => 'text', + 'req' => false, + 'name' => 'delivery_date', + 'display' => 'Date vessel will be delivered to CM facility' + ); + $e[] = array( + 'type' => 'text', + 'req' => false, + 'name' => 'completion_date', + 'display' => 'Desired Completion Date' + ); + $workTypes = array( + 'Cleaning & Upkeep' => array( + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Wash & Vacuum', + 'opts' => 'Wash & Vacuum' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Deck & Hull Wax Only', + 'opts' => 'Deck & Hull Wax Only' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Paint Bottom (with anti-fouling paint)', + 'opts' => 'Paint Bottom (with anti-fouling paint)' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Clear & Oil Teak', + 'opts' => 'Clear & Oil Teak' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Repair Navigation Lights, Blower, bilge pump, etc. (please specify below)', + 'opts' => 'Repair Navigation Lights, Blower, bilge pump, etc. (please specify below)' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Check Fire Extinguisher & Replace if Necessary', + 'opts' => 'Check Fire Extinguisher & Replace if Necessary' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Detail Cabin (Larger Vessels)', + 'opts' => 'Detail Cabin (Larger Vessels)' + ) + ), + 'Engine' => array( + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Basic Check (Hoses, Steering, Battery, Fuel Tanks, etc.)', + 'opts' => 'Basic Check (Hoses, Steering, Battery, Fuel Tanks, etc.)' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Complete Ignition Tune-Up (Cap, Rotor, Plugs & Wires - if necessary)', + 'opts' => 'Complete Ignition Tune-Up (Cap, Rotor, Plugs & Wires - if necessary)' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Change Engine Oil & Filter (and water separator if necessary)', + 'opts' => 'Change Engine Oil & Filter (and water separator if necessary)' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Extensive Test run (15 to 20 minutes)', + 'opts' => 'Extensive Test run (15 to 20 minutes)' + ), + ), + 'Outdrive & Gearcase' => array( + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Lube U-Joints', + 'opts' => 'Lube U-Joints' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Change Water impellor', + 'opts' => 'Change Water impellor' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Check Trim & Tilt', + 'opts' => 'Check Trim & Tilt' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Check Boots', + 'opts' => 'Check Boots' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Weld Skeg', + 'opts' => 'Weld Skeg' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Replace Anodes', + 'opts' => 'Replace Anodes' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Replace Upper Seals', + 'opts' => 'Replace Upper Seals' + ), + array( + 'type' => 'checkbox', + 'req' => false, + 'name' => 'Replace Lower Seals', + 'opts' => 'Replace Lower Seals' + ) + ) + ); + $this->workTypes = $workTypes; + //var_dump($workTypes);exit; + foreach ($workTypes as $groupName => $group) { + $e[] = array( + 'type' => 'group', + 'req' => false, + 'name' => 'work_requested['.$groupName.']', + 'group' => $group, + 'label' => ''.$groupName.'', + 'seperator' => '', + 'appendName' => true + ); + } $e[] = array( 'type' => 'textarea', 'req' => false, @@ -352,6 +471,8 @@ class Toolkit_Contacts_ServiceRequest ); $this->setupElements($e); + //echo '
'.print_r($this, true).'
'; + //exit; } // }}} diff --git a/Toolkit/Contacts/TempStorageQuickLaunch.php b/Toolkit/Contacts/TempStorageQuickLaunch.php index 387eeb1..ea5c5d6 100755 --- a/Toolkit/Contacts/TempStorageQuickLaunch.php +++ b/Toolkit/Contacts/TempStorageQuickLaunch.php @@ -259,23 +259,51 @@ class Toolkit_Contacts_TempStorageQuickLaunch 'name' => 'make_and_model_of_vessel', 'display' => 'Make and Model of Vessel' ); - //$servTypes = array( - //'' => 'Select Engine Type', - //'group1' => 'Outboard', - //'Mercury' => 'Mercury', - //'Evinrude / Johnson' => 'Evinrude / Johnson', - //'group2' => 'Stern Drive', - //'Mercruiser' => 'Mercruiser', - //'group3' => 'Sail Boats', - //'N/A' => 'Not Applicable' - //); - //$e[] = array( - //'type' => 'select3', - //'req' => true, - //'name' => 'service_required', - //'display' => 'Service Required', - //'opts' => $servTypes - //); + $e[] = array( + 'type' => 'header', + 'name' => 'serviceHdr_rmv', + 'display' => 'Service Required' + ); + $e[] = array( + 'type' => 'text', + 'req' => false, + 'name' => 'arrival_date', + 'display' => 'Vessel will be delivered to CM by' + ); + $ownTrailer = array( + array( + 'type' => 'radio', + 'name' => 'have_own_trailer', + 'opts' => 'Yes', + 'att' => 'Yes' + ), + array( + 'type' => 'radio', + 'name' => 'have_own_trailer', + 'opts' => 'No', + 'att' => 'No' + ) + ); + $e[] = array( + 'type' => 'group', + 'req' => false, + 'name' => 'have_own_trailer', + 'label' => 'I have my own trailer (if no $30 fee will apply)', + 'group' => $ownTrailer, + 'seperator' => '', + 'appendName' => false + ); + $e[] = array( + 'type' => 'header', + 'name' => 'launchHdr_rmv', + 'display' => 'Quick Launch' + ); + $e[] = array( + 'type' => 'text', + 'req' => false, + 'name' => 'launch_date', + 'display' => 'Anticipated Arrival Date' + ); $e[] = array( 'type' => 'textarea', 'req' => false, diff --git a/Toolkit/Contacts/templates/contactForm.html b/Toolkit/Contacts/templates/contactForm.html index 2f2f84a..bd06c3b 100644 --- a/Toolkit/Contacts/templates/contactForm.html +++ b/Toolkit/Contacts/templates/contactForm.html @@ -39,22 +39,30 @@ {else:} {if:elem.isType(#group#)} - + {if:elem.required}*{end:} {if:elem.error}
{end:} {elem.label:h}
{if:elem.error}
{end:} {else:} - - {if:elem.required}*{end:} - {if:elem.error}
{end:} - {elem.label:h} - {if:elem.error}
{end:} - - {if:elem.isName(#interest#)} - + {if:elem.isName(#service_request#)} + + {if:elem.required}*{end:} + {if:elem.error}
{end:} + {elem.label:h} + {if:elem.error}
{end:} {else:} - + + {if:elem.required}*{end:} + {if:elem.error}
{end:} + {elem.label:h} + {if:elem.error}
{end:} + + {if:elem.isName(#interest#)} + + {else:} + + {end:} {end:} {end:} {end:} @@ -84,9 +92,9 @@ {end:} {end:} - - - {if:form.requirednote} + + + {if:form.requirednote}
{form.requirednote:h}
{end:} diff --git a/css/contactform.css b/css/contactform.css index 9dedb38..669f2de 100644 --- a/css/contactform.css +++ b/css/contactform.css @@ -6,101 +6,101 @@ /* Main table */ #contact table, .webform table { - background-color: #fff; - border: 1px solid #eee; - border-collapse: collapse; - } + background-color: #fff; + border: 1px solid #eee; + border-collapse: collapse; + } /* Any Table inside the form */ #contact table table, .webform table table { - width: 100%; - margin-left: 0; - border: 0px solid #ddd; - } -#contact table table td { border: 0px solid #ddd;} + width: 100%; + margin-left: 0; + border: 0px solid #ddd; + } +#contact table table td { border: 0px solid #ddd;} /* TD's */ #contact td, .webform td { - padding: 3px; - font-family: arial, helvetica, sans-serif; - color: #000; - border: 1px solid #eee; - border-collapse: collapse; - } + padding: 3px; + font-family: arial, helvetica, sans-serif; + color: #000; + border: 1px solid #eee; + border-collapse: collapse; + } /* Left Cells */ .labelcell { - background-color: transparent; - text-align: right; - padding-right: 10px; - padding-top: 3px; - white-space:nowrap; - width: 140px; - } + background-color: transparent; + text-align: right; + padding-right: 10px; + padding-top: 3px; + white-space:nowrap; + width: 140px; + } /*Right Cells */ .fieldcell { - padding-left: 4px; - width: 250px; - } + padding-left: 4px; + width: 250px; + } /* Misc */ textarea {width: 95%; height: 100px; display:block;} /* WARNINGS */ #form-warning-top { - margin-top: 1em; - margin-bottom: 0.5em; - color: #f00; - font-size: 14px; - font-weight: bold; - } + margin-top: 1em; + margin-bottom: 0.5em; + color: #f00; + font-size: 14px; + font-weight: bold; + } /* SHow hide instruction div */ #contact table tr td .form-warning-inside, .webform table tr td .form-warning-inside { - display: none; - } + display: none; + } #contact table tr.req td .form-warning-inside, .webform table tr.req td .form-warning-inside { - display: block; - background-image: url('../../../../images/error.gif'); - background-repeat:no-repeat; - background-position: top left; - padding: 2px 2px 2px 22px; + display: block; + background-image: url('../../../../images/error.gif'); + background-repeat:no-repeat; + background-position: top left; + padding: 2px 2px 2px 22px; } /* Showing/hiding rows */ /*invisible*/ #contact table tr td.instructioncell, .webform table tr td.instructioncell { - width: 200px; - white-space: nowrap; - color: #fff; - } + width: 200px; + white-space: nowrap; + color: #fff; + } /*visible*/ table tr.req { - border: 2px solid #f00; - background-color:#FCD6D4; - border-collapse: separate; - border-collapse: collapse; + border: 2px solid #f00; + background-color:#FCD6D4; + border-collapse: separate; + border-collapse: collapse; } /*color*/ -table tr.req td { background-color: #fcd6d4;} -table tr.req td.labelcell { background-color: #FCD6D4; } -table tr.req td.fieldcell { background-color: #FCD6D4; } -table tr.req td.instructioncell { background-color: #FCD6D4; } +table tr.req td { background-color: #fcd6d4;} +table tr.req td.labelcell { background-color: #FCD6D4; } +table tr.req td.fieldcell { background-color: #FCD6D4; } +table tr.req td.instructioncell { background-color: #FCD6D4; } table tr.req td.instructioncell { - padding: 4px; - padding-left: 20px; - background-image: url('../../../../images/error.gif'); - background-repeat:no-repeat; - background-position: center left; - border-width: 0; - color: #000; - } + padding: 4px; + padding-left: 20px; + background-image: url('../../../../images/error.gif'); + background-repeat:no-repeat; + background-position: center left; + border-width: 0; + color: #000; + } .glmCheckBox { - width: 200px; - float: left; + width: 100%; + float: left; } .single-checkbox label.glmCheckBox { width: auto; diff --git a/static/19.phtml b/static/19.phtml new file mode 100644 index 0000000..b502992 --- /dev/null +++ b/static/19.phtml @@ -0,0 +1,12 @@ +configureForm(); + $cf->useCaptcha(true); + echo $cf->toHtml(); +} -- 2.17.1