#!/usr/local/bin/perl # # CITEWISE-demo.plx Cherwell Scientific -- www.citewise.com # # copyright 1999-2000 Cherwell Scientific Limited # $version = "v3.1.2 (15-03-2000)"; # # Form Generation and handling for demo downloads # # Called Directly # # See end of file for version history #---------------------------------------------------------------------- # Make appropriate modules/libraries available use CITEWISE; use CGI; use Net::SMTP; # Get local copies of CITEWISE variables: $MD = $CITEWISE::MD; # Majordomo $SMTP_SERVER = $CITEWISE::SMTP_SERVER; $MAIL_LEADS_TO = $CITEWISE::MAIL_LEADS_TO; $FILEPATH = $CITEWISE::FILEPATH; $cg = $CITEWISE::cg; $basehref = $CITEWISE::basehref; $tdbgcolor = $CITEWISE::tdbgcolor; $bhi = "/images/head-blue-downform.gif"; # Page header image # 'Global' variables $q = new CGI; $q->import_names('R'); # The script name $myurl = $q->url; $ukurl = $myurl; $deurl = $myurl."?de=1"; if ($q->param('Country') =~ m/Deutschland/i) { $q->param('Country','Germany'); } if ($q->param('debug')) { $c = $q->param('Country'); print qq {\n\nCountry = $c\n\n}; } # Has the downloader been before? (i.e. do they have a CSPDemo cookie) %h = $q->cookie('citewisedemo'); ########## # # # "main" # # # ########## if ($q->param('ddr')) { if ($q->param('sfd') && $q->param('md')) { &dlongform; # They want a CD so show the long form } else { &dlist; # Process the form (long or short) and Display the demo list } } else { &dshortform; # They're downloading so show a short form -- Default } ####################### # # # Primary Subroutines # # # ####################### ####################################################################################################### ####################################################################################################### ####################################################################################################### # # sub dshortform -- Demo Download Form # # * The script's default action -- show a demo download form # * Checks for existence of 'cspdemo' cookie and fills out form with it # sub dshortform { # Who's the Goldmine user? $GMUser = $q->param('GMUser') || 'jane'; print $q->header(-type=>'text/html'); # A link back to referring page $whence = $q->referer(); # Contact Details $formlength = "short"; # Language choices if ($q->param('de')) { $de = 1; $countryurl = $ukurl; # $bh = "Demo Software"; Don't need this -- have a custom image instead $hde = qq {}; %sf = ( sp => qq { * = Obligatorische Felder.
Geben Sie bitte bei Feldern, für die
Sie keine Angaben haben "n/a" ein.

Alle Einträge bitte in Deutsch. }, cu => qq {

Falls beim Herunterladen Probleme auftreten, rufen Sie uns an. }, fv => qq {English version of this form}, sd => "Software Angaben", dm => "Demo Medium", mcd => "Schicken Sie mir eine kostenlose
   Demo-CD und Informationsmaterial", sw => "
(STRG-Klicken für
mehrfache Auswahl) ", in => qq {Geben Sie bitte Ihre persönliche Daten an und für welche Software Sie sich interessieren. Bestätigen Sie die Angaben mit dem "Next" Feld. Danach gelangen Sie zur Liste der Demo-Downloads. Wenn Sie möchten, schicken wir Ihnen gerne eine Demo CD per Post.}, cd => "Persönliche Angaben", co => "Weiter", cf => "Formular Iöschen", nt => qq {

*Wir bitten Sie um die Angabe Ihrer persönlichen Daten, damit wir Sie über Produktentwicklungen und spezielle Angebote, die Ihre Softwareauswahl betreffen, informieren können. CiteWise.com wird diese Angaben vertraulich behandeln. Ihre persönlichen Daten werden Dritten nicht zugänglich gemacht.

Klicken Sie dieses Feld an, wenn Sie diese Informationen in Zukunft nicht erhalten möchten } ); } # # Button text #Next > # else { $countryurl = $deurl; # $bh = "Demo Software"; Don't need this -- have a custom image instead $mathematica = "

Should you have problems downloading, please contact us. }, fv => qq {Deutsche Seite}, sd => "Software Details", dm => "Demo Media", sw => "
(Ctrl-Click to make
Multiple selections) ", os => "Operating System", mcd => "Mail Me a CD with Info Pack", msub => qq {User Mailing List 
Email from users with questions, answers etc.}, in => qq {Please tell us which software you are interested in, complete your contact details, and press the "Next" button before proceeding to a list of demo downloads. If you would prefer, we can mail you a Demo CD.}, cd => "Contact Details", co => "Continue", cf => "Clear Form", nt => qq {

* CiteWise.com will treat your contact details as confidential. We ask for these details so that we can inform you of developments relating to your software choice.

Tick here if you would prefer not to receive this information } ); } #End else # Start the html for the form &body_head("CiteWise.com -- A Division of Cherwell Scientific Limited", $countryurl, "Demo Downloads"); print qq {

$hde }; # # Add the contact rows # contact_details(\%h, $de, $formlength); print qq {
$sf{'in'}

$sf{'sd'}


Software: *  $sf{'sw'}
$sf{'dm'}: *  Download
 $sf{'mcd'}

$sf{'cd'} *


$sf{'sp'}

$sf{'ty'}

$sf{'nt'}
}; # close print &body_foot($de, 1, $myurl); } #End sub dshortform ####################################################################################################### ####################################################################################################### ####################################################################################################### # # sub dlongform -- Demo Download Form # # * The user wants a CD so show a long form with complete address details # * Checks for existence of 'cspdemo' cookie and fills out form with it # sub dlongform { # Who's the Goldmine user? $GMUser = $q->param('GMUser') || 'jane'; # Have they been before? if ($h{'Address1'}) { # They've previously submitted a long form (i.e. requested a CD) %h = ( Name => $q->param('Name'), # Use the new values from the short form... Title => $q->param('Title'), Org => $q->param('Org'), Tel => $q->param('Tel'), EMail => $q->param('EMail'), Dept => $h{'Dept'}, # ...and pad it out with the other values from the existing cookie Address1 => $h{'Address1'}, Address2 => $h{'Address2'}, Address3 => $h{'Address3'}, Address4 => $h{'Address4'}, ZipCode => $h{'ZipCode'}, Country => $h{'Country'} ); } else { # They haven't previously submitted a long form (i.e. requested a CD) %h = ( Name => $q->param('Name'), Title => $q->param('Title'), Org => $q->param('Org'), Country => $q->param('Country'), Tel => $q->param('Tel'), EMail => $q->param('EMail') ); } # Give them a fresh copy of their details to keep... $cqscookie = $q->cookie(-name => 'citewisedemo', -value => \%h, -expires => '+6M' ); print $q->header(-type=>'text/html', -cookie=>$cqscookie); # A link back to referring page $whence = $q->referer(); # Did they check the mailing list box on the short form? if ($q->param('sml')) { $smltext = "checked"; # This is used in the check box code below } # Did they check the "No Thanks" box? if ($q->param('DontAddToList')) { $nothanks = "checked"; # This is used in the check box code below } # Pass on their product selections @prods = $q->param('Prod'); # Contact Details $formlength = "long"; # Language choices if ($q->param('de')) { $de = 1; $countryurl = $ukurl; # $bh = "Demo Software"; Don't need this -- have a custom image instead $hde = qq {}; %sf = ( sp => qq { * = Obligatorische Felder.
Geben Sie bitte bei Feldern, für die
Sie keine Angaben haben "n/a" ein.

Alle Einträge bitte in Deutsch. }, cu => qq {

Falls beim Herunterladen Probleme auftreten, rufen Sie uns an. }, fv => qq {English version of this form}, sd => "Software Angaben", dm => "Demo Medium", mcd => "Schicken Sie mir eine kostenlose Demo-CD und Informationsmaterial", msub => qq {User Mailing List 
Email from users with questions, answers etc.}, subme => "Please subscribe me to the
Cyrillic-User mailing list", cd => "Für die Zusendung einer Demo-CD benötigen wir Ihre vollständige Versandadresse", co => "Weiter", cf => "Formular Iöschen", nt => qq {

*Wir bitten Sie um die Angabe Ihrer persönlichen Daten, damit wir Sie über Produktentwicklungen und spezielle Angebote, die Ihre Softwareauswahl betreffen, informieren können. Cherwell Scientific wird diese Angaben vertraulich behandeln. Ihre persönlichen Daten werden Dritten nicht zugänglich gemacht.

Klicken Sie dieses Feld an, wenn Sie diese Informationen in Zukunft nicht erhalten möchten } ); } # # Button text #Next > # else { $countryurl = $deurl; # $bh = "Demo Software"; Don't need this -- have a custom image instead %sf = ( sp => qq { * = Compulsory Field
enter "n/a" if not applicable. }, cu => qq {

Should you have problems downloading, please contact us. }, fv => qq {Deutsche Seite}, sd => "Mail CD", dm => "Demo Media", mcd => "Mail Me a CD with Info Pack", msub => qq {User Mailing List 
Email from users with questions, answers etc.}, subme => "Please subscribe me to the
Cyrillic-User mailing list", cd => "Full Contact Details Required to Mail CD", co => "Continue", cf => "Clear Form", nt => qq {

* Cherwell Scientific will treat your contact details as confidential. We ask for these details so that we can inform you of developments relating to your software choice.

Tick here if you would prefer not to receive this information } ); # end %sf = } #End else # Start the html for the form &body_head("CiteWise.com -- A Division of Cherwell Scientific Limited", $countryurl, "Demo CD Request"); print qq {

$hde }; # # Add the contact rows # contact_details(\%h, $de, $formlength); print qq {

$sf{'cd'} *


$sf{'sp'}

$sf{'ty'}

$sf{'nt'}
}; # close print &body_foot($de, 1, $myurl); } #End sub dlongform ####################################################################################################### ####################################################################################################### ####################################################################################################### # # sub dlist # # Upon form submission... # # * Check fields are complete, and if so... # * show a list of demos # * Mail a Thank You to the downloader # * Mail the contact details back to Cherwell # sub dlist { # # Language Choices # if ($q->param('de')) { $countryurl = $ukurl; $de = 1; $CITEWISE_Contact = qq {"CiteWise.com Sales -- Germany" }; %dl = ( bh => "Unvollständiges Formular", cf => qq {Das Formular war nicht vollständig ausgefüllnals "Senden" gedrückt wurde. Prüfen Sie bitte folgende Felder und fahren Sie fort.}, ta => "Versuchen Sie es nochmal", df => "?de=1", co => qq {Ihre bisher gemachten Angaben bleiben so lange erhalten wie Ihr Browser Cookies unterstüzt.}, ak => "Eine Demoversion und Informationsmaterial ist auf dem Weg zu Ihnen!", bt => qq {Zurüch zu}, dd => qq {Laden Sie eine
Demo-Version
herunter} ); $q->param('ZipCode','D'); # These fields are omitted on the German form, so we initialise it # here to prevent cookie foulup and false empty field detection } else { $countryurl = $deurl; $CITEWISE_Contact = qq {"CiteWise.com Sales -- UK" }; %dl = ( bh => "Incomplete Form", cf => qq {Please go back to the form and complete the following fields:}, ta => "Try Again", co => qq {The details you have completed so far will be retained as long as your browser supports cookies.}, ak => "A demo CD with an Information Pack is on its way to you", bt => "Back to", dd => "Download a Demo" ); } # # Cookies! # # Have they been before? if ($q->param('sfd')) { # Coming from the short form and.... if ( $h{'Address1'} ) { # ...they've previously submitted the long form %h = ( Name => $q->param('Name'), Title => $q->param('Title'), Org => $q->param('Org'), Tel => $q->param('Tel'), EMail => $q->param('EMail'), Dept => $h{'Dept'}, # Remaining values from cookie Address1 => $h{'Address1'}, Address2 => $h{'Address2'}, Address3 => $h{'Address3'}, Address4 => $h{'Address4'}, ZipCode => $h{'ZipCode'}, Country => $h{'Country'} ); } else { # ...they haven't previously submitted the long form %h = ( Name => $q->param('Name'), Title => $q->param('Title'), Org => $q->param('Org'), Country => $q->param('Country'), Tel => $q->param('Tel'), EMail => $q->param('EMail') ); } } else { # Coming from the long form %h = ( Name => $q->param('Name'), Title => $q->param('Title'), Org => $q->param('Org'), Tel => $q->param('Tel'), EMail => $q->param('EMail'), Dept => $q->param('Dept'), Address1 => $q->param('Address1'), Address2 => $q->param('Address2'), Address3 => $q->param('Address3'), Address4 => $q->param('Address4'), ZipCode => $q->param('ZipCode'), Country => $q->param('Country') ); } # Give them a fresh copy of their details to keep... $cqscookie = $q->cookie(-name => 'citewisedemo', -value => \%h, -expires => '+6M' ); print $q->header(-type=>'text/html', -cookie=>[$cqscookie]); # Process args... # Extract multiple products out as separate enquiries @prods = $q->param('Prod'); $i = 1; foreach $prodsel (@prods) { $contsupp = qq {$contsupp cs}.$i.qq {_Rectype=P cs}.$i.qq {_Contact=Prod Enquiry cs}.$i.qq {_ContSupRef=$prodsel cs}.$i.qq {_Zip=Web }; $prodlist = $prodsel." ".$prodlist; $i++ } # End foreach # Mail a Thank You to the downloader &Mail_Downloader($R::Name, $R::EMail, $CITEWISE_Contact); # # Prepare data to mail back to Cherwell # # Are they covered by the German office? @decountries = ( "Austria", "Belarus", "Bulgaria", "Czech Republic", "Estonia", "Germany", "Hungary", "Latvia", "Lithuania", "Luxembourg", "Poland", "Romania", "Russia", "Slovenia", "Switzerland", "Ukraine", "Yugoslavia" ); foreach (@decountries) { if ( $q->param('Country') eq $_ || $de eq 1) { $MAIL_LEADS_TO = "degmimport\@cherwell.com"; $R::GMUSER = "Jane"; } } # Do they want to be excluded from general mailings? if ($q->param('DontAddToList') eq "" ) { $EXCLUDE="N"; } else { $EXCLUDE="Y"; } # Do they want to be contacted by rep? if ($q->param('CallBack') eq "") { $CALLBACKNEW=" "; $CALLBACKDUP=" "; } else { $CALLBACKNEW="OnNewAttachTrack=Web Lead, $R::GMUSER"; $CALLBACKDUP="OnDupAttachTrack=Web Lead, $R::GMUSER"; } if ( $q->param('Source') ne "") { $SOURCE=$q->param('Source'); } else { $SOURCE="Web"; } #Get a date/time stamp and create a unique suffix for import file name ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); $mon++; $year+=1900; # Stuff the mail body in a variable to pass to Net:SMTP if ($q->param('md')) {# send a CD $sj = "Mail CiteWise.com CD to"; } else { $sj = "Demo Download by" } $MAILBODY = qq {MIME-Version: 1.0 Content-Type: multipart/mixed; boundary=NextPart From: "$R::Name" <$R::EMail> To: $MAIL_LEADS_TO Subject: WWW - $sj $R::Name This is a multi-part message in MIME format. --NextPart Country: $R::Country Software: $prodlist Contact: $R::Name Title: $R::Title Company: $R::Org Phone1: $R::Tel Email: $R::EMail Department: $R::Dept Address1: $R::Address1 Address2: $R::Address2 City: $R::Address3 State: $R::Address4 Zip: $R::ZipCode --------------------------------------------------------------------------- Mailed by CITEWISE-demo.plx $version CITEWISE.pm $CITEWISE::version at $hour:$min:$sec $mday/$mon/$year --------------------------------------------------------------------------- --NextPart Content-Type: application/x-gm-impdata [Instructions] DupCheck1=Contact DupCheck2=Company Dupcheck3=Department DupCheck4=Address1 DupCheck5=Address2 OnNewSendEmail=$R::GMUSER,New, WWW - $sj $R::Name OnDupSendEmail=$R::GMUSER, , WWW - $sj existing contact SaveThis=Web Import Data $CALLBACKNEW $CALLBACKDUP [Data] Company=$R::Org Contact=$R::Name Department=$R::Dept Title=$R::Title Source=$SOURCE Address1=$R::Address1 Address2=$R::Address2 City=$R::Address3 State=$R::Address4 Zip=$R::ZipCode Country=$R::Country Phone1=$R::Tel Fax=$R::Fax Key2=Web email=$R::EMail uexmail=$EXCLUDE uopsys=$R::OSType notes=Heard about sw: $R::Feedback1, Add. comm.: $R::Feedback2, Call Me?: $R::CallBack [ContSupp]$contsupp --NextPart-- }; # Mail the results to Cherwell $smtp = Net::SMTP->new($SMTP_SERVER); # connect to an SMTP server $smtp->mail( 'sysadmin@cherwell.com' ); # use the sender's address here $smtp->to($MAIL_LEADS_TO); # recipient's address $smtp->data(); # Start the mail # Send the header. # $smtp->datasend($MAILBODY ); # End datasend $smtp->dataend(); # Finish sending the mail $smtp->quit; # Close the SMTP connection # # Finished Mailings # # Finish off the HTML if ($q->param('md')) {# send a CD &body_head("CiteWise.com -- Bibliographic and Scientific Software", $countryurl, "Demo CD Request"); print qq {

$dl{'ak'}
}; } #End if else { # ...or show a list of demos to download if ($q->param('de')) { &body_head("CiteWise.com -- Bibliographic and Scientific Software", $countryurl, "Demo Downloads"); $dlf = $FILEPATH."/download/gdownfiles.htm"; } else { &body_head("CiteWise.com -- Bibliographic and Scientific Software", $countryurl, "Demo Downloads"); $dlf = $FILEPATH."/download/downfiles.htm"; } # if ($q->param('DemoDownList') eq "") { # Use Default Software List listFile($dlf); # } # else { # Use Specified Demo Information # listFile("$FILEPATH/".$R::DemoDownList); # } } #End Else show a list of demos to download &body_foot($de, $lb, $myurl); # End of HTML } # End sub dlist ######################################### ######## Secondary sub-functions ######## ######################################### # # # Mail_Downloader # # $_[0] = Name # $_[1] = Email address # $_[2] = CSP Contact # sub Mail_Downloader { if ($q->param('de')) { $mb = qq {Subject: www.citewise.com CITEWISE.COM Bibliographic Management Software Expertise Thank you for taking the time to visit our Web site at http://www.citewise.com I hope that you were able to find the information you required and that you now have our software demo. If you have questions, or need any further help or advice please contact your local CiteWise.com office by email or by phone. Thank you once again for your interest in our products and enjoy the demo! --- --- Amanda Hart | e-mail: amanda\@citewise.com Business Manager | Phone: +44 (0)1865 784800 CiteWise.com | Fax: +44 (0)1865 784801 Oxford OX4 4GA, UK | URL: http://citewise.com Bibliographic Management Software Expertise ------------------------------------------------------------------------- CiteWise.com is a division of | See our web site for standard Cherwell Scientific Limited | terms and conditions of sale. http://www.cherwell.com | VAT and carriage may apply ------------------------------------------------------------------------- } } else { $mb = qq {Subject: www.citewise.com CITEWISE.COM Bibliographic Management Software Expertise Thank you for taking the time to visit our Web site at www.citewise.com I hope that you were able to find the information you required and that you now have our software demo. If you have questions, or need any further help or advice please contact your local CiteWise.com office by email or by phone. Thank you once again for your interest in our products and enjoy the demo! --- --- Amanda Hart | e-mail: amanda\@citewise.com Business Manager | Phone: +44 (0)1865 784800 CiteWise.com | Fax: +44 (0)1865 784801 Oxford OX4 4GA, UK | URL: http://citewise.com Bibliographic Management Software Expertise ------------------------------------------------------------------------- CiteWise.com is a division of | See our web site for standard Cherwell Scientific Limited | terms and conditions of sale. http://www.cherwell.com | VAT and carriage may apply ------------------------------------------------------------------------- } }# end else # open(MAIL, "|/usr/lib/sendmail -t >> /dev/null") || # die ("Unable to open mail pipe!"); $mailbody = qq {To: $_[0] <$_[1]> From: $_[2] Reply-to: $_[2] $mb }; # close(MAIL); $smtp = Net::SMTP->new($SMTP_SERVER); # connect to an SMTP server $smtp->mail( $_[2] ); # use the sender's address here $smtp->to( $_[1] ); # recipient's address $smtp->data(); # Start the mail # Send the header. # $smtp->datasend($mailbody ); # End datasend $smtp->dataend(); # Finish sending the mail $smtp->quit; # Close the SMTP connection } # End sub Mail_Downloader # # Read and print a file # sub listFile { if (open(FILE, "<$_[0]") == 0) { print "Error opening file ", $_[0], "\n"; exit; } while () { print; } close(FILE); } #################################################################################### #################################################################################### #--------------------------------------------------------------------------- # # -- Changes -- # # 15 March 2000 (KC) # # * Added Country back to short form # # * Goldmine data returned as attachment and body text # so that Jane can read it in Outlook # # 15 Feb 2000 KC v3.1.1 # # * Tweaks # # 15 Feb 2000 KC v3.1.0 # # * Updated for website v2 # #---------------------------------------------------------------------------- # 04 Feb 2000 KC v3.0.5 # # * Added back German office MAIL_LEADS_TO selection # # 03 Feb 2000 KC v3.0.4 # # * Added 1900 to $year (localtime returns year as offset from 1900) # # 19 Jan 2000 KC v3.0.3 # # * Changed GMUSER to jane (still simonv on domino server, for some reason) # # 06 Dec 1999 KC v3.0.2 -- Final tweaks (for a while!) # # 06 Dec 1999 KC v3.0.1 -- Initial version for www.citewise.com # # See CSP-demo.plx for full version history #--------------------------------------------------------------------------- # # End of citewise-demo.plx #