view src/nabble/view/web/mailing_list/MailingListOptions.java @ 0:7ecd1a4ef557

add content
author Franklin Schmidt <fschmidt@gmail.com>
date Thu, 21 Mar 2019 19:15:52 -0600
parents
children
line wrap: on
line source


package nabble.view.web.mailing_list;

import nabble.model.ListServer;
import nabble.model.MailingList;
import nabble.model.ModelHome;
import nabble.model.Node;
import nabble.view.lib.Jtp;
import nabble.view.lib.Shared;
import nabble.view.lib.help.Help;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;


public final class MailingListOptions extends HttpServlet {

	protected void service(HttpServletRequest request,HttpServletResponse response)
		throws ServletException, IOException
	{
		PrintWriter out = response.getWriter();
		Node forum = Jtp.getSiteNotNull(request).getNode(Jtp.getLong(request,"forum"));
		if (forum == null) {
			response.sendError(HttpServletResponse.SC_GONE, "This app has been deleted.");
			return;
		}

		MailingList mailingList = forum.getAssociatedMailingList();
		ListServer listServer = mailingList.getListServer();
		
		out.print( "\r\n<html>\r\n	<head>\r\n		" );
 Shared.title(request,response,"Mailing List Options"); 
		out.print( "\r\n	</head>\r\n	<body>\r\n	" );
 Shared.minHeader(request, response, forum);
		out.print( "\r\n	" );
 Shared.editHeader(forum.getSubjectHtml(), "Mailing List Options", out); 
		out.print( "\r\n	\r\n	" );

			if( listServer.canSubscribe() ) {
				
		out.print( "\r\n<p>\r\nNabble provides a web archive and gateway to the mailing list: <strong>" );
		out.print( (mailingList.getListAddress()) );
		out.print( "</strong> (<a href=\"" );
		out.print( (Help.mailingListIntro.url(request)) );
		out.print( "\">What is a mailing list?</a>).\r\n</p>\r\n<p>Below are a set of mailing list actions you can take through Nabble. (You may also visit the <a href=\"" );
		out.print( (mailingList.getUrl()) );
		out.print( "\" target=\"_top\">" );
		out.print( (mailingList.getListAddress()) );
		out.print( " website</a> for additional information and options.)\r\n</p>\r\n\r\n<h3>Subscribe to " );
		out.print( (mailingList.getListAddress()) );
		out.print( "</h3>\r\n<p>\r\n	Most mailing lists require subscription before you can post messages. Click <strong>Subscribe</strong> below to send a subscription request to the mailing list: " );
		out.print( (mailingList.getListAddress()) );
		out.print( ".\r\n</p>\r\n\r\n<p>\r\n	<strong>REMEMBER</strong>: Clicking \"Subscribe\" only sends the request to the mailing list. You have the following additional step to complete the subscription process.</p>\r\n\r\n<p>\r\n	After clicking Subscribe, wait for a confirmation email which will provide instructions on how to confirm your subscription. Follow the instructions in the confirmation email to confirm your subscription. This usually requires replying to an email or clicking the confirmation link.\r\n	(<strong>NOTE: </strong>Most mailing lists send the confirmation email almost instantaneously. However, some may require that you wait for a few hours.)\r\n</p>\r\n\r\n<p>\r\n<form action=\"Subscribe.jtp\">\r\n<input type=\"hidden\" name=\"forum\" value=\"" );
		out.print( (forum.getId()) );
		out.print( "\" />\r\n<input type=\"submit\" value=\"Subscribe\" />\r\n</form>\r\n</p>\r\n" );

				if( !listServer.supportsDeliveryOff() ) {
					
		out.print( "\r\n<p>\r\n	Becoming a subscriber allows you to post to a mailing list, but at the same time, you will also receive all the emails posted to the mailing list. If you prefer not to receive the emails, you can unsubscribe after posting to the list.\r\n</p>\r\n\r\n<h3>Unsubscribe</h3>\r\n<p>\r\n	This mailing list does not support the option to turn off email delivery, so you may want to consider unsubscribing; it's acceptable to subscribe to a mailing list to post a message, but then unsubscribe after the message is sent.\r\n</p>\r\n" );

				} else if( listServer.needsDefaults() ) {
					
		out.print( "\r\n<p>\r\n	Becoming a subscriber allows you to post messages to a mailing list. However, you also have to receive all the emails posted to the mailing list. If you prefer not to receive the emails, you have the option to turn off mail delivery.\r\n</p>\r\n\r\n<h3>Turn off mail delivery</h3>\r\n<p>This mailing list may allow you to turn off email delivery but remain a subscriber. This means you can post messages without having to receive the emails. This option works only after you have become a subscriber.</p>\r\n" );

					if ( listServer == ListServer.google ) {
						
		out.print( "\r\n<p>To turn off email delivery, please visit <a href=\"" );
		out.print( (mailingList.getUrl()) );
		out.print( "\">" );
		out.print( (mailingList.getListAddress()) );
		out.print( "'s website</a>.</p>\r\n" );

					} else {
						
		out.print( "\r\n<p><b>Please Note</b>: This option may not work for some early versions of Mailman. In that case, use the Unsubscribe option below.</p>\r\n<p>\r\n<form action=\"SubscribeDefaults.jtp\">\r\n<input type=\"hidden\" name=\"Action\" value=\"set\" />\r\n<input type=\"hidden\" name=\"forum\" value=\"" );
		out.print( (forum.getId()) );
		out.print( "\" />\r\n<input type=\"submit\" value=\"Turn off mail delivery\" />\r\n</form>\r\n</p>\r\n" );

					}
					
		out.print( "\r\n<h3>Unsubscribe</h3>\r\n<p>You may unsubscribe from this mailing list.</p>\r\n" );

				} else {
					
		out.print( "\r\n<p>Your subscription will be with email delivery turned off, so you can post messages without having to receive all list emails.</p>\r\n<h3>Unsubscribe</h3>\r\n<p>You may unsubscribe from this mailing list.</p>\r\n" );

				}
				
		out.print( "\r\n<form action=\"Unsubscribe.jtp\">\r\n<input type=\"hidden\" name=\"forum\" value=\"" );
		out.print( (forum.getId()) );
		out.print( "\" />\r\n<input type=\"submit\" value=\"Unsubscribe\" />\r\n</form>\r\n" );

			} else {
				
		out.print( "\r\n<p>\r\n	Nabble provides a web archive and gateway to the mailing list: <strong>" );
		out.print( (mailingList.getListAddress()) );
		out.print( "</strong> (<a href=\"" );
		out.print( (Help.mailingListIntro.url(request)) );
		out.print( "\">?</a>).\r\n</p>\r\n<p>\r\n	To subscribe or unsubscribe, please visit <a href=\"" );
		out.print( (mailingList.getUrl()) );
		out.print( "\">" );
		out.print( (mailingList.getListAddress()) );
		out.print( "'s website</a>.\r\n</p>\r\n<p>\r\n	<strong>NOTE:</strong> Please complete the subscription process before posting any messages to this mailing list to ensure that your messages are accepted by the mailing list.\r\n</p>\r\n" );

			}
			
		out.print( "\r\n" );
 Shared.footer(request,response); 
		out.print( "\r\n" );
 Shared.analytics(request,response); 
		out.print( "\r\n</body>\r\n</html>\r\n" );

	}
}