<%@page import="post.profile.DivisionUnsubscribePage"%> <%@page import="java.math.BigInteger"%> <%@page import="java.sql.Timestamp"%> <%@page import="java.sql.*"%> <%@page import="post.profile.State"%> <%@page import="post.db.*"%> <%@page import="post.util.*"%> <%@page import="post.util.Hashtable"%> <%@page import="post.formcontrol.*"%> <%@page import="post.attribute.*"%> <%@page import="post.delivery.*"%> <%@page import="post.company.*"%> <% /****************************************************************************** Copyright 2007, Yesmail 09/05/2007 6:06 PM PST ******************************************************************************* This page is accessed from emails to offer a 2-click "unsubscribe" capability to users wishing to unsubscribe. There are two required fields for this page: If the identity of the user that corresponds to the "i" parameter matches the "s" parameter, the user is given the opportunity to confirm their desire to unsubscribe. Otherwise, the user is presented with an error page. To include this URL in a message, use: or `anchor ("http://DOMAIN/unsubscribe.jsp`") -- PriyaV Modification to the standard divisional unsubscribe page Change of email and mailing frequency option http://odyssey.postdirect.com/ui/pages/companies/ritzinteractive/unsubscribe.jsp?ctype=r&s=5PLb&i=4006025267 http://odyssey.postdirect.com/ui/pages/companies/ritzinteractive/unsubscribe.jsp?ctype=ece&s=5PLb&i=4006025267 http://odyssey.postdirect.com/ui/pages/companies/ritzinteractive/unsubscribe.jsp?ctype=wklydeal&s=5PLb&i=4006025267 priyas_7temp@yesmail.com ******************************************************************************/ DivisionUnsubscribePage pageOutput = new DivisionUnsubscribePage (request, response); String division = ""; String eMail = ""; Object argsI = request.getParameter("i"); Object argsS = request.getParameter("s"); String i = argsI instanceof String ? (String) argsI : ""; String s = argsS instanceof String ? (String) argsS : ""; String divisionLogo = ""; String divname = ""; Hashtable empty = new Hashtable (); boolean emailExistsError = false; boolean otherError = false; //String currentemail = ""; Timestamp currentTime = new Timestamp (System.currentTimeMillis ()); try { pageOutput.checkState(pageOutput, "unsubscribe.jsp", null, null,"RitzInteractive",response); State state = pageOutput.getState(); //currentemail = (String) pageOutput.attributeValue("eMail"); //session.setAttribute("currentemail", currentemail); // ctype possible values r, ece, wklydeal String ctype = (String) request.getParameter("ctype"); SystemLog.write("1", "ritz unsub page ctype is:", ctype); if (ctype == null || ctype.equalsIgnoreCase("") || ctype.length() == 0 ) { ctype = "r"; } SystemLog.write("1", "ritz unsub page ctype is:", ctype); /***************************************************************************** Form Controls for page *****************************************************************************/ SystemLog.write("1", "before declaring email form control", "before declaring email form control"); /* eMail */ EMailFormControl emailFC = new EMailFormControl("eMail", (EMailAttribute) pageOutput.attributeFromName("eMail")); emailFC.size(30); pageOutput.registerFormControl( emailFC); emailFC.optional(); SystemLog.write("1", "email form control defined", "email form control defined"); /* verify email form control */ /*TextBoxFormControl reemailFC = new TextBoxFormControl ("re-eMail", (StringAttribute) pageOutput.attributeFromName ("tempField")); reemailFC.size (30); pageOutput.registerFormControl (reemailFC);*/ /* Display only 2 used items for this mailing frequency. */ String[][] mailingFrequencyItems = { {"1 to 2 times a month","1"}, {"1 per month","2"}}; String[][] wklydealmailingFrequencyItems = { {"4 times a month","1"}, {"2 per month","2"}}; RadioButtonFormControl newsletterFC = null; RadioButtonFormControl ecenlFC = null; RadioButtonFormControl weeklydealnlFC = null; /*(newsletterFC.optional(); ecenlFC.optional(); weeklydealnlFC.optional();*/ try { division = pageOutput.getDivisionFromMasters(state.urlMasterId); eMail = (String) pageOutput.attributeValue("eMail"); session.setAttribute("currentemail", eMail); } catch (SQLException e) {} post.util.SystemLog.write("DEBUG", "RitzInteractive unsub","************division:"+division); if (division.equalsIgnoreCase("RIZ")){ divisionLogo = "ritzcamera_logo.gif"; divname = "ritzcamera.com"; if(ctype.equalsIgnoreCase("r")) { SystemLog.write("1", "ritz unsub page riz regular", "ritz unsub page riz regular"); newsletterFC = new RadioButtonFormControl ("riznlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("riznlfreq")); newsletterFC.displayItems (mailingFrequencyItems); newsletterFC.columns (1); pageOutput.registerFormControl (newsletterFC); newsletterFC.optional(); } else if(ctype.equalsIgnoreCase("ece")) { SystemLog.write("1", "ritz unsub page riz ece", "ritz unsub page riz ece"); ecenlFC = new RadioButtonFormControl ("rizecnlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("rizecnlfreq")); ecenlFC.displayItems (mailingFrequencyItems); ecenlFC.columns (1); pageOutput.registerFormControl (ecenlFC); ecenlFC.optional(); } else if (ctype.equalsIgnoreCase("wklydeal")) { SystemLog.write("1", "ritz unsub page riz wklydeal", "ritz unsub page riz wklydeal"); weeklydealnlFC = new RadioButtonFormControl ("rizweeklydealnlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("rizweeklydealnlfreq")); weeklydealnlFC.displayItems (wklydealmailingFrequencyItems); weeklydealnlFC.columns (1); pageOutput.registerFormControl (weeklydealnlFC); weeklydealnlFC.optional(); } else { response.sendRedirect("error.html"); } } else if (division.equalsIgnoreCase("WCZ")){ SystemLog.write("1", "ritz unsub page division is:", division); divisionLogo = "wolfcamera_logo.gif"; divname = "wolfcamera.com"; if(ctype.equalsIgnoreCase("r")) { SystemLog.write("1", "ritz unsub page wcz regular", "ritz unsub page wcz regular"); newsletterFC = new RadioButtonFormControl ("wcznlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("wcznlfreq")); newsletterFC.displayItems (mailingFrequencyItems); newsletterFC.columns (1); pageOutput.registerFormControl (newsletterFC); newsletterFC.optional(); } else if(ctype.equalsIgnoreCase("ece")) { SystemLog.write("1", "ritz unsub page wcz ece", "ritz unsub page wcz ece"); ecenlFC = new RadioButtonFormControl ("wczecnlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("wczecnlfreq")); ecenlFC.displayItems (mailingFrequencyItems); ecenlFC.columns (1); pageOutput.registerFormControl (ecenlFC); ecenlFC.optional(); } else if (ctype.equalsIgnoreCase("wklydeal")) { SystemLog.write("1", "ritz unsub page wcz wklydeal", "ritz unsub page wcz wklydeal"); weeklydealnlFC = new RadioButtonFormControl ("wczweeklydealnlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("wczweeklydealnlfreq")); weeklydealnlFC.displayItems (wklydealmailingFrequencyItems); weeklydealnlFC.columns (1); pageOutput.registerFormControl (weeklydealnlFC); weeklydealnlFC.optional(); } else { response.sendRedirect("error.html"); } } else if (division.equalsIgnoreCase("CWZ")){ divisionLogo = "cameraworld.gif"; divname = "cameraworld.com"; if(ctype.equalsIgnoreCase("r")) { SystemLog.write("1", "ritz unsub page cwz regular", "ritz unsub page cwz regular"); newsletterFC = new RadioButtonFormControl ("cwznlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("cwznlfreq")); newsletterFC.displayItems (mailingFrequencyItems); newsletterFC.columns (1); pageOutput.registerFormControl (newsletterFC); newsletterFC.optional(); } else if(ctype.equalsIgnoreCase("ece")) { SystemLog.write("1", "ritz unsub page cwz ece", "ritz unsub page cwz ece"); ecenlFC = new RadioButtonFormControl ("cwzecnlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("cwzecnlfreq")); ecenlFC.displayItems (mailingFrequencyItems); ecenlFC.columns (1); pageOutput.registerFormControl (ecenlFC); ecenlFC.optional(); } else if (ctype.equalsIgnoreCase("wklydeal")) { SystemLog.write("1", "ritz unsub page cwz wklydeal", "ritz unsub page cwz wklydeal"); weeklydealnlFC = new RadioButtonFormControl ("cwzweeklydealnlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("cwzweeklydealnlfreq")); weeklydealnlFC.displayItems (wklydealmailingFrequencyItems); weeklydealnlFC.columns (1); pageOutput.registerFormControl (weeklydealnlFC); weeklydealnlFC.optional(); } else { response.sendRedirect("error.html"); } } else if (division.equalsIgnoreCase("PAZ")){ divisionLogo = "pa_logo.gif"; divname = "photoalley.com"; if(ctype.equalsIgnoreCase("r")) { newsletterFC = new RadioButtonFormControl ("paznlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("paznlfreq")); newsletterFC.displayItems (mailingFrequencyItems); newsletterFC.columns (1); pageOutput.registerFormControl (newsletterFC); newsletterFC.optional(); } else if(ctype.equalsIgnoreCase("ece")) { SystemLog.write("1", "ritz unsub page paz ece", "ritz unsub page paz ece"); ecenlFC = new RadioButtonFormControl ("pazecnlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("pazecnlfreq")); ecenlFC.displayItems (mailingFrequencyItems); ecenlFC.columns (1); pageOutput.registerFormControl (ecenlFC); ecenlFC.optional(); } else if (ctype.equalsIgnoreCase("wklydeal")) { SystemLog.write("1", "ritz unsub page paz wklydeal", "ritz unsub page paz wklydeal"); weeklydealnlFC = new RadioButtonFormControl ("pazweeklydealnlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("pazweeklydealnlfreq")); weeklydealnlFC.displayItems (wklydealmailingFrequencyItems); weeklydealnlFC.columns (1); pageOutput.registerFormControl (weeklydealnlFC); weeklydealnlFC.optional(); } else { response.sendRedirect("error.html"); } } else if (division.equalsIgnoreCase("BWZ")){ divisionLogo = "boatersworld.gif"; divname = "boatersworld.com"; if(ctype.equalsIgnoreCase("r")) { newsletterFC = new RadioButtonFormControl ("bwznlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("bwznlfreq")); newsletterFC.displayItems (mailingFrequencyItems); newsletterFC.columns (1); pageOutput.registerFormControl (newsletterFC); newsletterFC.optional(); } else if(ctype.equalsIgnoreCase("ece")) { SystemLog.write("1", "ritz unsub page bwz ece", "ritz unsub page bwz ece"); ecenlFC = new RadioButtonFormControl ("bwzecnlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("bwzecnlfreq")); ecenlFC.displayItems (mailingFrequencyItems); ecenlFC.columns (1); pageOutput.registerFormControl (ecenlFC); ecenlFC.optional(); } else if (ctype.equalsIgnoreCase("wklydeal")) { SystemLog.write("1", "ritz unsub page bwz wklydeal", "ritz unsub page bwz wklydeal"); weeklydealnlFC = new RadioButtonFormControl ("bwzweeklydealnlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("bwzweeklydealnlfreq")); weeklydealnlFC.displayItems (wklydealmailingFrequencyItems); weeklydealnlFC.columns (1); pageOutput.registerFormControl (weeklydealnlFC); weeklydealnlFC.optional(); } else { response.sendRedirect("error.html"); } } else if (division.equalsIgnoreCase("OBZ")){ divisionLogo = "OuterBanksOutfitters.gif"; divname = "outerbanksoutfitters.com"; if(ctype.equalsIgnoreCase("r")) { newsletterFC = new RadioButtonFormControl ("obznlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("obznlfreq")); newsletterFC.displayItems (mailingFrequencyItems); newsletterFC.columns (1); pageOutput.registerFormControl (newsletterFC); newsletterFC.optional(); } else if(ctype.equalsIgnoreCase("ece")) { SystemLog.write("1", "ritz unsub page obz ece", "ritz unsub page obz ece"); ecenlFC = new RadioButtonFormControl ("obzecnlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("obzecnlfreq")); ecenlFC.displayItems (mailingFrequencyItems); ecenlFC.columns (1); pageOutput.registerFormControl (ecenlFC); ecenlFC.optional(); } else if (ctype.equalsIgnoreCase("wklydeal")) { SystemLog.write("1", "ritz unsub page obz wklydeal", "ritz unsub page obz wklydeal"); weeklydealnlFC = new RadioButtonFormControl ("obzweeklydealnlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("obzweeklydealnlfreq")); weeklydealnlFC.displayItems (wklydealmailingFrequencyItems); weeklydealnlFC.columns (1); pageOutput.registerFormControl (weeklydealnlFC); weeklydealnlFC.optional(); } else { response.sendRedirect("error.html"); } } else if (division.equalsIgnoreCase("EAZ")){ divisionLogo = "eAsite_logo2.gif"; divname = "eangler.com"; if(ctype.equalsIgnoreCase("r")) { newsletterFC = new RadioButtonFormControl ("eaznlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("eaznlfreq")); newsletterFC.displayItems (mailingFrequencyItems); newsletterFC.columns (1); pageOutput.registerFormControl (newsletterFC); newsletterFC.optional(); } else if(ctype.equalsIgnoreCase("ece")) { SystemLog.write("1", "ritz unsub page eaz ece", "ritz unsub page eaz ece"); ecenlFC = new RadioButtonFormControl ("eazecnlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("eazecnlfreq")); ecenlFC.displayItems (mailingFrequencyItems); ecenlFC.columns (1); pageOutput.registerFormControl (ecenlFC); ecenlFC.optional(); } else if (ctype.equalsIgnoreCase("wklydeal")) { SystemLog.write("1", "ritz unsub page eaz wklydeal", "ritz unsub page eaz wklydeal"); weeklydealnlFC = new RadioButtonFormControl ("eazweeklydealnlfreq", (EnumerationAttribute) pageOutput.attributeFromName ("eazweeklydealnlfreq")); weeklydealnlFC.displayItems (wklydealmailingFrequencyItems); weeklydealnlFC.columns (1); pageOutput.registerFormControl (weeklydealnlFC); weeklydealnlFC.optional(); } else { response.sendRedirect("error.html"); } } else if (division.equalsIgnoreCase("SSZ")){ divisionLogo = "shark_logo_RI2.gif"; divname = "shopatshark.com"; } session.setAttribute ("divisionLogo", divisionLogo); if(pageOutput.argumentsSubmitted() ) { SystemLog.write("1", "inside args submitted", "inside args submitted"); /* validates Required fields only */ if ( pageOutput.argumentsSubmitted () && !pageOutput.isValidInput() ) { /*if ( emailFC.lastError() == "Required.") { otherError = true; } if ( emailFC.lastError().equals(EMailFormControl.emailAlreadyExistsMessage) ) { emailExistsError = true; } */ } if ( pageOutput.argumentsSubmitted () && (pageOutput.isValidInput() || (!otherError && emailExistsError) ) ){ /* Get email from FormControl post data as the data has not been loaded in the session yet */ boolean emailUpdated = false; if(emailFC.value( 0, request) != null) { emailUpdated = true; SystemLog.write("1", "email is not null", "email is not null"); eMail = ((String) emailFC.value( 0, request)).trim(); SystemLog.write("1", "currentemail is:", eMail); } else { SystemLog.write("1", "email is null", "email is null"); emailUpdated = false; } /*String reemail = ((String) reemailFC.value( 0, request)).trim(); /* check if verify email address entered matches with email */ /*if( !reemail.equalsIgnoreCase( email)) { reemailFC.lastError("The e-mail addresses you entered do not match. Please re-enter your e-mail address."); } else{ reemailFC.lastError("");}*/ if (emailFC.lastError()=="") { SystemLog.write("1", "all ok:begin processing", "all ok:begin processing"); /* Process data from form controls into session */ pageOutput.processInput(); if (emailUpdated == false) { SystemLog.write("1", "email not updated", "email not updated"); eMail = (String) session.getAttribute("currentemail"); SystemLog.write("1", "currentemail is:", eMail); pageOutput.attributeValue("eMail", eMail); SystemLog.write("1", "after setting email attribute", "after setting email attribute"); } pageOutput.attributeValue("lastModifiedOnWebTime", currentTime); pageOutput.updateUser (Event.ModifyEC, null); SystemLog.write("1", "profile modified", "profile modified"); pageOutput.resetSession(); response.sendRedirect ("emailchange-confirm.html"); return; } } } %> Unsubscribe Page
<% out.print("\"\"");%>
User Profile Update



Update your mailing frequency or change your email

Update Mailing Frequency: <% if(ctype.equalsIgnoreCase("r")) { SystemLog.write("1", "ritz unsub page wcz regular html", "ritz unsub page wcz regular html"); out.println (pageOutput.formatFormControlError (newsletterFC.lastError ())); out.println (newsletterFC.html (0, request, state.attributeValues, null)); } else if(ctype.equalsIgnoreCase("ece")) { SystemLog.write("1", "ritz unsub page wcz ece html", "ritz unsub page wcz ece html"); out.println (pageOutput.formatFormControlError (ecenlFC.lastError ())); out.println (ecenlFC.html (0, request, state.attributeValues, null)); } else if(ctype.equalsIgnoreCase("wklydeal")) { SystemLog.write("1", "ritz unsub page wcz wklydeal html", "ritz unsub page wcz wklydeal html"); out.println (pageOutput.formatFormControlError (weeklydealnlFC.lastError ())); out.println (weeklydealnlFC.html (0, request, state.attributeValues, null)); } else { response.sendRedirect("error.html"); } %>
New E-mail Address: <% if (emailExistsError) { emailFC.lastError(""); } if ( emailFC.lastError().equals("Required.") ) { emailFC.lastError("Please enter your e-mail address.");} out.println (pageOutput.formatFormControlError (emailFC.lastError ())); out.println (emailFC.html (0, request, empty, null)); %>



<% if ((divisionLogo != null) && (divisionLogo.length()!=0)) out.print("\"\""); %>

We regret that you have chosen to unsubscribe from the <%=divname%> newsletter. Please verify your e-mail address and hit the "Unsubscribe" button below.

E-mail Address:   

 
Example of an e-newsletter from RitzCamera.com

With e-newsletters from RitzCamera.com, you get:

  • Helpful articles, tips, and advice
  • Access to our hottest deals
  • Exclusive offers
  • Special promotions
<% } catch (Exception e) { pageOutput.unhandledException (e); } finally { pageOutput.endPage (); } %>