Mercurial Hosting > nabble
comparison src/nabble/view/web/mailing_list/UnsubscribeFromMailingList.jtp @ 0:7ecd1a4ef557
add content
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 21 Mar 2019 19:15:52 -0600 |
parents | |
children | 18cf4872fd7f |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7ecd1a4ef557 |
---|---|
1 <% | |
2 package nabble.view.web.mailing_list; | |
3 | |
4 import fschmidt.util.servlet.AuthorizingServlet; | |
5 import nabble.model.MailingList; | |
6 import nabble.model.ModelHome; | |
7 import nabble.model.Node; | |
8 import nabble.model.User; | |
9 import nabble.view.lib.Jtp; | |
10 import nabble.view.lib.Shared; | |
11 | |
12 import javax.servlet.ServletException; | |
13 import javax.servlet.http.HttpServlet; | |
14 import javax.servlet.http.HttpServletRequest; | |
15 import javax.servlet.http.HttpServletResponse; | |
16 import java.io.IOException; | |
17 import java.io.PrintWriter; | |
18 | |
19 | |
20 public final class UnsubscribeFromMailingList extends HttpServlet implements AuthorizingServlet { | |
21 | |
22 public String getAuthorizationKey(HttpServletRequest request) throws ServletException { | |
23 return Jtp.getReadAuthorizationKey( Jtp.getSiteNotNull(request).getNode(Jtp.getLong(request,"node")) ); | |
24 } | |
25 | |
26 public boolean authorize(String key,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { | |
27 return Jtp.authorizeForRead(key,request,response); | |
28 } | |
29 | |
30 protected void service(HttpServletRequest request,HttpServletResponse response) | |
31 throws ServletException, IOException | |
32 { | |
33 User user = Jtp.getUser(request,response); | |
34 | |
35 if (user == null) { | |
36 Jtp.login("You must login to unsubscribe from a mailing list.", request, response); | |
37 return; | |
38 } | |
39 | |
40 Node forum = Jtp.getSiteNotNull(request).getNode(Jtp.getLong(request, "node")); | |
41 boolean allowed = Jtp.canBeEditedBy(forum,user); | |
42 if (!allowed) { | |
43 Jtp.login("Only administrators can proceed in this area.", request, response); | |
44 return; | |
45 } | |
46 | |
47 String errorMsg = null; | |
48 boolean isSendEmail = "SendEmail".equals(request.getParameter("action")); | |
49 | |
50 MailingList mailingList = forum.getMailingList(); | |
51 String subscriptionAddress = mailingList.getSubscriberAddress().getAddrSpec(); | |
52 PrintWriter out = response.getWriter(); | |
53 char c = 'A'; | |
54 %> | |
55 <html> | |
56 <head> | |
57 <META NAME="robots" CONTENT="noindex,nofollow"> | |
58 <% Shared.title(request,response,"How to Unsubscribe this Forum"); %> | |
59 <style type="text/css"> | |
60 div.field-title { | |
61 margin-top: 0; | |
62 } | |
63 td.number { | |
64 width: 3em; | |
65 padding-bottom: .2em; | |
66 } | |
67 span.number { | |
68 font-size: 200%; | |
69 padding: 0 .3em .03em; | |
70 border-width:1px; | |
71 border-style:solid; | |
72 } | |
73 </style> | |
74 </head> | |
75 <body> | |
76 <% Shared.minHeader(request, response, forum);%> | |
77 <% Shared.editHeader(forum.getSubjectHtml(), "How to Unsubscribe this Forum", out); %> | |
78 <% Shared.errorMessage(request,response,errorMsg, "Please fix the error and try again." ); %> | |
79 <% | |
80 if (isSendEmail && "POST".equals(request.getMethod())) { | |
81 errorMsg = SubscribeToMailingList.sendRequest(forum, request, out); | |
82 Shared.errorMessage(request, response, errorMsg, "Failed to send the request." ); | |
83 } | |
84 %> | |
85 | |
86 <div class="field-box light-border-color"> | |
87 <div class="second-font field-title">General Instructions</div> | |
88 <div style="margin-left:1.5em"> | |
89 If you want to unsubscribe this forum from a mailing list, you have to remove the following email address from the mailing list subscriber's list: | |
90 <div class="info-message" style="margin:.2em;padding:.2em;font-weight:bold"><%=subscriptionAddress%></div> | |
91 This can be done in several ways. Below you can find the most common ones. | |
92 </div> | |
93 </div> | |
94 | |
95 <div class="second-font field-title" style="margin-top:1em">Unsubscription Options</div> | |
96 <div class="weak-color">Choose the best option for this mailing list.</div> | |
97 | |
98 <div class="field-box light-border-color"> | |
99 <table style="margin-left:1.3em"> | |
100 <tr valign="top"> | |
101 <td class="number"><span class="number shaded-bg-color medium-border-color"><%=c++%></span></td> | |
102 <td> | |
103 <div class="second-font field-title">Remove from subscriber's list</div> | |
104 Mailing list administrators usually can remove email addresses from the subscribers' list directly. | |
105 If you can do this, remove <b><%=subscriptionAddress%></b> from that list. | |
106 </td> | |
107 </tr> | |
108 </table> | |
109 </div> | |
110 | |
111 <div class="field-box light-border-color"> | |
112 <table style="margin-left:1.3em"> | |
113 <tr valign="top"> | |
114 <td class="number"><span class="number shaded-bg-color medium-border-color"><%=c++%></span></td> | |
115 <td> | |
116 <div class="second-font field-title">Go to mailing list website</div> | |
117 You can go to the mailing list homepage (<a href="<%=mailingList.getUrl()%>"><%=mailingList.getUrl()%></a>) | |
118 and unsubscribe <b><%=subscriptionAddress%></b> from the list. | |
119 The confirmation email will be forwarded to your email address as soon as it is received by Nabble.com. | |
120 You will have to follow the instructions in that email to confirm this request. | |
121 </td> | |
122 </tr> | |
123 </table> | |
124 </div> | |
125 <% SubscribeToMailingList.emailForm(forum, false, "Unsubscribe by email", "Send Unsubscription Request", c, request, out); %> | |
126 <% Shared.footer(request,response); %> | |
127 <% Shared.analytics(request,response); %> | |
128 </body> | |
129 </html> | |
130 <% | |
131 } | |
132 | |
133 } | |
134 %> |