addElement('header', null, 'Annex Request'); $form->addElement('hidden','subject','',array('style'=>'display:none')); $locations = build_pickups(2); $s =& $form->createElement('select','pickup','Where do you want to pick up the Annex material?'); $s->loadArray($locations,0); $form->addElement($s); $form->addElement('static','s1','','Items requested will ordinarily be available within two working days. Please go to the library you selected above to pick up Annex materials.'); $form->addElement('text', 'name', 'Enter your fullname:', array('size' => 40, 'maxlength' => 255)); $form->addElement('text', 'barcode', 'Enter your barcode ID:', array('size' => 40, 'maxlength' => 255)); $phone[] = &HTML_QuickForm::createElement('text','areacode',null,'size="3"'); $phone[] = &HTML_QuickForm::createElement('text','exchange',null,'size="3"'); $phone[] = &HTML_QuickForm::createElement('text','last4',null,'size="4"'); $form->addGroup($phone,'phone_number','Phone: ','-'); $form->addElement('text', 'email', 'Enter your complete e-mail address:', array('size' => 40, 'maxlength' => 255)); $annx[] =& HTML_QuickForm::createElement('radio',null,null,'Annex A','A'); $annx[] =& HTML_QuickForm::createElement('radio',null,null,'Annex B','B'); $form->addGroup($annx,'location','Location of item: ','
'); $form->addElement('text', 'callnum', 'Call number:', array('size' => 20, 'maxlength' => 255)); $form->addElement('text', 'pubtitle', 'Title:', array('size' => 40, 'maxlength' => 255)); $form->addElement('text', 'volnum', 'Volume(s) / Year(s)
(required for any serial or multivolume set)', array('size' => 20, 'maxlength' => 255)); $form->addElement('static','s2','','If you are requesting a volume of a journal or a serial in order to consult an article, please fill in the next three fields if possible.'); $form->addElement('text', 'author', 'Author of article:', array('size' => 20, 'maxlength' => 255)); $form->addElement('text', 'articletitle', 'Title of article:', array('size' => 40, 'maxlength' => 255)); $form->addElement('text', 'pagenums', 'Page numbers of article', array('size' => 10, 'maxlength' => 255)); $form->addElement('static','s3','','Note: You may paste the record from the Main Catalog in the field below. You may also use this space for comments and suggestions.'); $form->addElement('textarea','record','',array('rows'=>5,'cols'=>30)); $form->addElement('submit', null, 'Send'); // Define filters and validation rules $form->applyFilter('name', 'trim'); $form->addRule('name', 'Please enter your name.', 'required', null, 'server'); $form->addRule('pickup', 'Please select a pickup location.', 'required', null, 'server'); $form->registerRule('checkblank','function','isblank'); $form->addRule('pickup', 'Please select a pickup location.', 'checkblank'); #$form->addRule('barcode', 'Please enter your barcode.', 'required'); $form->addRule('phone', 'Please enter your phone number.', 'required'); $form->addRule('email', 'Please enter your complete valid e-mail address.', 'required'); $form->addRule('email', 'Please enter your complete valid e-mail address.', 'email'); $form->addRule('location', 'Please select the Annex location.', 'required'); $form->addRule('callnum', 'Please enter the call number.', 'required'); $form->addRule('pubtitle', 'Please enter the title.', 'required'); if ($form->validate()) { $email = htmlspecialchars($form->exportValue('email')); $name = htmlspecialchars($form->exportValue('name')); $barcode = htmlspecialchars($form->exportValue('barcode')); $phone_num = $form->exportValue('phone_number'); $ph = htmlspecialchars($phone_num['areacode']).' - '.htmlspecialchars($phone_num['exchange']).' - '.htmlspecialchars($phone_num['last4']); $location = htmlspecialchars($form->exportValue('location')); $pickupid = $form->exportValue('pickup'); $pickup = htmlspecialchars(return_pickup($pickupid)); $recip = return_pickup_email($pickupid); #$pickup = htmlspecialchars(return_pickup($form->exportValue('pickup'))); $callnum = htmlspecialchars($form->exportValue('callnum')); $pubtitle = htmlspecialchars($form->exportValue('pubtitle')); $volnum = htmlspecialchars($form->exportValue('volnum')); $author = htmlspecialchars($form->exportValue('author')); $articletitle = htmlspecialchars($form->exportValue('articletitle')); $pagenums = htmlspecialchars($form->exportValue('pagenums')); $record = nl2br(htmlspecialchars($form->exportValue('record'))); $headers = "Content-type: text/html; charset=iso-8859-1 \r\n"; $headers .= "MIME-Version: 1.0\r\n"; $headers .= "X-Mailer: PHP\n"; $headers .= "X-Priority: 3\n"; $headers .= "From: $email\n"; $headers .= "Reply-to: $email\n"; $omsg .= "Requestor: $name - $email\n"; $omsg .= "\nBarcode: $barcode\n"; $omsg .= "Phone number: $ph\n"; $omsg .= "Location: Annex $location\n"; $omsg .= "Pickup location: $pickup\n"; $omsg .= "Call number: $callnum\n"; $omsg .= "Title: $pubtitle\n"; $omsg .= "Volume: $volnum\n"; $omsg .= "Author: $author\n"; $omsg .= "Article title: $articletitle\n"; $omsg .= "Page numbers: $pagenums\n"; $omsg .= "Catalog record: $record\n"; $spamfield = $form->exportValue('subject'); # Send Email if Captcha Successful form_logging($recip, 'Annex Request:'. $sub, $omsg, $email, $headers); if (strlen($spamfield)==0) { if ($email=="abarrera@princeton.edu") { $recip="abarrera@princeton.edu"; } send_mail($recip,$email,'Annex Request: '.$sub, $omsg); echo "

Request submitted.

Your Annex retrieval request has been successfully transmitted. Thank you for using this service of the Princeton University Library.

"; echo "
"; echo "

".nl2br($omsg)."

"; $conmsg = "This is a copy for your records of the Annex Request you submitted. Please remember that items requested will ordinarily be available within two working days. Please go to $pickup to pick up Annex materials.

"; $omsg = $conmsg.$omsg; } else { echo "

Request submitted.

Your Annex retrieval request has been successfully transmitted. Thank you for using this service of the Princeton University Library.

"; spam_attempts($recip, 'Annex Request Spam:'. $sub, $omsg."\n$_POST[subject]", $email, $headers); $fp = fopen("logging/comments.log", "a"); fwrite($fp, "========\n"); fwrite($fp,date("m/d/Y H:m")."\n"); fwrite($fp,"$_SERVER[HTTP_REFERER]==$_SERVER[REQUEST_URI]\n"); fwrite($fp,"Subject: $sub\n"); fwrite($fp,"Message: $omsg\n"); fwrite($fp,"Headers: $headers\n"); fwrite($fp,"IP: ".$_SERVER["REMOTE_ADDR"]."\n"); $sql = "SELECT DISTINCT Count(`captured_spam`.`ip_address`) AS `countofattempts`, `captured_spam`.`ip_address` FROM `captured_spam` where ip_address='$_SERVER[REMOTE_ADDR]' GROUP BY `captured_spam`.`ip_address` order by `countofattempts` DESC"; $res = db_query($sql); $infoip = db_returnrow($res); if ($infoip[0] >= 20) { fwrite($fp,"BLOCKED\n"); } else { #mail($recip,"Annex Web Form: ".$sub, $omsg, $headers); send_mail("abarrera@princeton.edu",$email,'Annex Request Spam: '.$sub, $omsg); } fclose($fp); } } else { ?>

Place a request for a book from an Annex library.

Books shelved in an Annex library may be picked up at the circulation desk of any campus library you select below. You will be notified when the material is available, usually within two working days.

Required fields are marked with an asterisk (*).

\n\t\t{header}\n\t"; $form_tpl = "\n\n\n{content}\n
\n"; $renderer->setFormTemplate($form_tpl); $renderer->setHeaderTemplate($head_tpl); $renderer->setElementTemplate("\n\t\n\t\t\n\t\t{element}
\n\t", "s1"); $renderer->setElementTemplate("\n\t\n\t\t\n\t\t{element}
\n\t", "s2"); $renderer->setElementTemplate("\n\t\n\t\t\n\t\t{element}
\n\t", "s3"); $form->accept($renderer); echo $renderer->toHtml(); #$form->display(); } ?>