From b98f095925ba445a6df9c71dc25b1082d59314ff Mon Sep 17 00:00:00 2001
From: Michael Fairchild <mfairchild365@gmail.com>
Date: Tue, 5 Oct 2010 19:53:07 +0000
Subject: [PATCH] Moved the to, from, and subject vars for email to the config
 file.  Fixed phone number validation issue.  Made the type field required.

---
 config.inc.php                           |   6 +-
 config.sample.php                        |   6 +-
 www/physics/ribbon_cutting2010/index.php | 128 +++++++++++------------
 3 files changed, 72 insertions(+), 68 deletions(-)

diff --git a/config.inc.php b/config.inc.php
index b158cf3..6a7e2b0 100644
--- a/config.inc.php
+++ b/config.inc.php
@@ -9,7 +9,9 @@ function myautoload($class)
     require_once $file;
 }
 
-spl_autoload_register('myautoload');
+$sendToEmail   = "desertstorm365@gmail.com";  //Will send form data to this email address.
+$sendFromEmail = "test@test.com"; //Will send email from this address.
+$emailSubject  = "Ribbon Cutting Proposal"; //Subject for the email
 
+spl_autoload_register('myautoload');
 require_once '../../../lib/php/UNL/WDN/Emailer/Main.php';
-
diff --git a/config.sample.php b/config.sample.php
index b158cf3..fcc8593 100644
--- a/config.sample.php
+++ b/config.sample.php
@@ -9,7 +9,9 @@ function myautoload($class)
     require_once $file;
 }
 
-spl_autoload_register('myautoload');
+$sendToEmail   = "";  //Will send form data to this email address.
+$sendFromEmail = ""; //Will send email from this address.
+$emailSubject  = "Ribbon Cutting Proposal"; //Subject for the email.
 
+spl_autoload_register('myautoload');
 require_once '../../../lib/php/UNL/WDN/Emailer/Main.php';
-
diff --git a/www/physics/ribbon_cutting2010/index.php b/www/physics/ribbon_cutting2010/index.php
index 1cb8bcb..7119d97 100644
--- a/www/physics/ribbon_cutting2010/index.php
+++ b/www/physics/ribbon_cutting2010/index.php
@@ -1,5 +1,7 @@
 <?php
-//TODO: Make page two collums, add graphic of iPad and the new building.
+/**
+ * TODO: Make page two collums, add graphic of iPad and the new building.
+ **/
 require_once dirname(__FILE__).'/../../../config.inc.php';
 if (!empty($_POST)) {
     $mailer = new UNL_WDN_Emailer_Main();
@@ -12,12 +14,12 @@ if (!empty($_POST)) {
     $body .= "<b>Proposal:</b><br/>" . $_POST['proposal'] . "<br/>";
     
     $mailer->html_body    = $body;
-    $mailer->to_address   = 'desertstorm365@gmail.com';
-    $mailer->from_address = 'test@test.com';
-    $mailer->subject      = 'Ribbon Cutting Proposal';
+    $mailer->to_address   = $sendToEmail;
+    $mailer->from_address = $sendFromEmail;
+    $mailer->subject      = $emailSubject;
     if (!empty($_GET['submit'])) {
         $mailer->send();
-        header( 'Location: thankyou.php' );
+        header('Location: thankyou.php');
     }
 }
 ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
@@ -39,8 +41,6 @@ if (!empty($_POST)) {
 -->
 <link rel="stylesheet" type="text/css" media="screen" href="/wdn/templates_3.0/css/all.css" />
 <link rel="stylesheet" type="text/css" media="print" href="/wdn/templates_3.0/css/print.css" />
-<link rel="stylesheet" type="text/css" media="screen" href="css/physics.css" />
-<link rel="stylesheet" type="text/css" media="screen" href="css/jquery.ketchup.css" />
 <script type="text/javascript" src="/wdn/templates_3.0/scripts/all.js"></script>
 <script type="text/javascript" src="/wdn/templates_3.0/scripts/jquery/validator/jquery.validator.js"></script>
 
@@ -107,56 +107,56 @@ if (!empty($_POST)) {
             <h3>Win an iPad!</h3>
             <p>Insert Image</p>
             <div class="pullout">
-	            <p>
-					Physics Department extreme ribbon-cutting contest: <span>your chance to win an iPad
-					from the UNL Computer and Phone Shop!</span>
-				</p>
-				<p>
-					The University of Nebraska&ndash;Lincoln Physics Department is inviting proposals
-					from students, faculty, staff, alumni and friends on how to add some physics-
-					related drama to a ribbon cutting. The department will dedicate UNL's new physics
-					building, Jorgensen Hall, at a ceremony scheduled for 4 p.m. on Friday, Oct. 29.
-				</p>
-			</div>
+                <p>
+                    Physics Department extreme ribbon-cutting contest: <span>your chance to win an iPad
+                    from the UNL Computer and Phone Shop!</span>
+                </p>
+                <p>
+                    The University of Nebraska&ndash;Lincoln Physics Department is inviting proposals
+                    from students, faculty, staff, alumni and friends on how to add some physics-
+                    related drama to a ribbon cutting. The department will dedicate UNL's new physics
+                    building, Jorgensen Hall, at a ceremony scheduled for 4 p.m. on Friday, Oct. 29.
+                </p>
+            </div>
             
-	            <div class="smallPrint">
-	            
-	
-	            
-	
-	            <p>Anyone interested may submit a proposal for a way to open the building, preferably
-	            using some aspect of physics, to make the celebration more interesting than is
-	            possible using only ribbon and scissors.</p>
-	
-	            <p>Proposals should be submitted in writing to UNL Physics Department Chairman
-	            Dan Claes. Beginning Oct. 8, written submissions may be submitted on this site. Entrants are encouraged to post a short
-	            video on YouTube either explaining or demonstrating their idea. The video URL
-	            can be submitted with the proposal. Submissions are due by noon October 15.</p>
-	
-	            <p>A faculty committee will announce the top three contestants on October 18.
-	            The top three proposals with any supporting video links will be posted on the
-	            Physics Web site so that interested parties can vote for their favorite proposal.</p>
-	
-	            <p>Voting will be open from Monday, October 18 until noon on Friday, October 22.
-	            The committee will alert the winner late Friday afternoon, October 22.</p>
-	
-	            <p>The winning idea will be used to open Jorgensen Hall. UNL Chancellor Harvey
-	            Perlman and special guest speaker Alan Heeger, a UNL alum and Nobel laureate, will
-	            be present for the ceremony.</p>
-	
-	            <p>Rules:</p>
-	            <ul>
-	                <li>No humans or animals may be harmed.</li>
-	                <li>No harm may be caused to the building.</li>
-	                <li>Proposals will be accepted until 5 p.m. Oct. 15, 2010.</li>
-	            </ul>
-	
-	            <p>A minor amount of funding to purchase supplies for the implementation of
-	            the winning proposal may be made available by the Physics department at
-	            the discretion of the Physics Department chairman and contest committee.</p>
-	
-	            <p>The creator of the winning submission will receive an iPad or dollar value
-	            equivalent in merchandise from the UNL Computer and Phone Shop.</p>
+                <div class="smallPrint">
+                
+    
+                
+    
+                <p>Anyone interested may submit a proposal for a way to open the building, preferably
+                using some aspect of physics, to make the celebration more interesting than is
+                possible using only ribbon and scissors.</p>
+    
+                <p>Proposals should be submitted in writing to UNL Physics Department Chairman
+                Dan Claes. Beginning Oct. 8, written submissions may be submitted on this site. Entrants are encouraged to post a short
+                video on YouTube either explaining or demonstrating their idea. The video URL
+                can be submitted with the proposal. Submissions are due by noon October 15.</p>
+    
+                <p>A faculty committee will announce the top three contestants on October 18.
+                The top three proposals with any supporting video links will be posted on the
+                Physics Web site so that interested parties can vote for their favorite proposal.</p>
+    
+                <p>Voting will be open from Monday, October 18 until noon on Friday, October 22.
+                The committee will alert the winner late Friday afternoon, October 22.</p>
+    
+                <p>The winning idea will be used to open Jorgensen Hall. UNL Chancellor Harvey
+                Perlman and special guest speaker Alan Heeger, a UNL alum and Nobel laureate, will
+                be present for the ceremony.</p>
+    
+                <p>Rules:</p>
+                <ul>
+                    <li>No humans or animals may be harmed.</li>
+                    <li>No harm may be caused to the building.</li>
+                    <li>Proposals will be accepted until 5 p.m. Oct. 15, 2010.</li>
+                </ul>
+    
+                <p>A minor amount of funding to purchase supplies for the implementation of
+                the winning proposal may be made available by the Physics department at
+                the discretion of the Physics Department chairman and contest committee.</p>
+    
+                <p>The creator of the winning submission will receive an iPad or dollar value
+                equivalent in merchandise from the UNL Computer and Phone Shop.</p>
             </div>
             </div>
             <div class="two_col right">
@@ -166,16 +166,16 @@ if (!empty($_POST)) {
             <ol>
                 <li><label for="name" class="element"><span class="required">*</span>Name<span class="helper">Enter Your Full Name</span></label><div class="element"><input id="name" name="name" type="text" class="required-entry" /></div></li>
                 <li><label for="email" class="element"><span class="required">*</span>Email Address</label><div class="element"><input id="email" name="email" type="text" class="required-entry validate-email" /></div></li>
-                <li><label for="phone" class="element"><span class="required">*</span>Phone Number<span class="helper">Format: 402-555-1234</span></label><div class="element"><input id="phone" name="phone" type="text" class="required-entry validate-phone" /></div></li>
-                <li><label for="video" class="element">Youtube URL<span class="helper">Highly recommended.</span></label><div class="element"><input id="video" name="video" type="text" /></div></li>
+                <li><label for="phone" class="element"><span class="required">*</span>Phone Number<span class="helper">Format: 402-555-1234</span></label><div class="element"><input id="phone" name="phone" type="text" class="required-entry validate-phoneLax" /></div></li>
+                <li><label for="video" class="element">Youtube URL<span class="helper">Highly recommended.</span></label><div class="element"><input id="video" name="video" type="text" class="validate-url"/></div></li>
                 <li>
-                    <fieldset><legend>You are a</legend>
+                    <fieldset><legend><span class="required">*</span>You are a</legend>
                         <ol>
-	                        <li><input name="type" value="UNL student" type="radio" id="unlstudent" /><label for="unlstudent">UNL student</label></li>
-	                        <li><input name="type" value="High school student" type="radio" id="hsstudent" /><label for="hsstudent">High school student</label></li>
-	                        <li><input name="type" value="UNL faculty" type="radio" id="faculty" /><label for="faculty">UNL faculty</label></li>
-	                        <li><input name="type" value="UNL Alum" type="radio" id="alum" /><label for="alum">UNL Alum</label></li>
-	                        <li><input name="type" value="Other" type="radio" id="other" /><label for="other">Other</label></li>
+                            <li><input name="type" value="UNL student" type="radio" id="unlstudent" class="validate-one-required-by-name"/><label for="unlstudent">UNL student</label></li>
+                            <li><input name="type" value="High school student" type="radio" id="hsstudent" class="validate-one-required-by-name"/><label for="hsstudent">High school student</label></li>
+                            <li><input name="type" value="UNL faculty" type="radio" id="faculty" class="validate-one-required-by-name"/><label for="faculty">UNL faculty</label></li>
+                            <li><input name="type" value="UNL Alum" type="radio" id="alum" class="validate-one-required-by-name"/><label for="alum">UNL Alum</label></li>
+                            <li><input name="type" value="Other" type="radio" id="other" class="validate-one-required-by-name"/><label for="other">Other</label></li>
                         </ol>
                     </fieldset>
                 </li>
-- 
GitLab