Page content
<%@ page isELIgnored="false" import="de.cmsbs.connector.*, de.cmsbs.connector.util.*, java.util.*" buffer="16kb" %> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> <% if (!wum.ping()) { %><% } // ping %> <% /* * The current channel list */ wum.getCurrentChannels().setPublicOnly(true); // when the entry is loaded, load the unconfirmed requests with it wum.um().getRequestedAttributes().addTable("chaction", "action == 'r' and status == 'p'"); // >UM5.1 Entry e = null; if (wum.hasParam("c")) { try { e = wum.um().getEntryByCookie(wum.getParam("c")); // {cookie} or {msgid} if (e != null) { // confirm all channels and activat the subscription // load confirmable table fragment Table chaction = e.getTable("chaction"); // the subset we requested above ChannelList allChannels = wum.um().getChannels(); Map confirmChannels = new LinkedHashMap(); // Channel-IDs to Multiselect-Values, keeps order // process the requests and collect the channels for (Iterator it = chaction.getRows(); it.hasNext(); ) { TableRow row = (TableRow) it.next(); Channel c = allChannels.get(row.get("channel")); // null: channel does not exist anymore row.set("status", "c"); // "confirmed" >UM5.1 if (c != null) confirmChannels.put(c.getId(), row.getMultiselect("medium")); } // now do the actual subscriptions ChannelSubscriptions subs = e.getSubscriptions(); Date now = new Date(); for (Iterator it = confirmChannels.entrySet().iterator(); it.hasNext(); ) { Map.Entry me = (Map.Entry) it.next(); String cid = (String) me.getKey(); String[] n = (String[]) me.getValue(); // the subsciption (per medium) subs.subscribeEmail(cid, Multiselect.contains(n, "e")); //subs.subscribeSMS(cid, Multiselect.contains(n, "s")); // keep the history TableRow row = chaction.append(); row.set("channel", cid); row.set("action", "s"); // "subscribe" row.set("medium", n); row.set("date", now); row.set("ctp", wum.getThisPage()); row.set("processed", true); } } // Send a welcome message: //e.getNotifiction.setMessageId("changes"); // TBI: Revive some past newsletter and send it personally e.commit(); wum.success(); } catch (Exception ex) { ex.printStackTrace(); // ease up debugging wum.errors().add(ex); } } %> <% if (wum.hasSuccess()) { %>

Thank you for subscribing to our newsletter!

<% } else { %>

We're sorry, your registration was not successful.

Perhaps the validity of the link has expired or you did not copy it completely.

<% } // !wum.hasSuccess %>