0
|
1
|
|
2 package nabble.view.web.help;
|
|
3
|
|
4 import fschmidt.util.servlet.JtpContext;
|
|
5 import nabble.view.lib.Cache;
|
|
6 import nabble.view.lib.Jtp;
|
|
7 import nabble.view.lib.Shared;
|
|
8 import nabble.view.lib.help.Help;
|
|
9
|
|
10 import javax.servlet.ServletException;
|
|
11 import javax.servlet.http.HttpServlet;
|
|
12 import javax.servlet.http.HttpServletRequest;
|
|
13 import javax.servlet.http.HttpServletResponse;
|
|
14 import java.io.IOException;
|
|
15 import java.io.PrintWriter;
|
|
16
|
|
17
|
|
18 public class Answer extends HttpServlet {
|
|
19
|
|
20 protected void service(HttpServletRequest request,HttpServletResponse response)
|
|
21 throws ServletException, IOException
|
|
22 {
|
|
23 JtpContext jtpContext = (JtpContext)getServletContext().getAttribute(JtpContext.attrName);
|
|
24 jtpContext.setEtag(request,response);
|
|
25 PrintWriter out = response.getWriter();
|
|
26 Help help = Help.getHelp(Jtp.getInt(request,"id"));
|
|
27 if (help == null) {
|
|
28 Shared.simplePage("Invalid Help Article", null, "Invalid Help Article", "The help article you are trying to open doesn't exist or was removed.<br>Please contact Nabble Support if you need help.", request, response);
|
|
29 return;
|
|
30 }
|
|
31 String metaDescription = help.getMetaDescription();
|
|
32 String metaKeywords = help.getMetaKeywords();
|
|
33
|
|
34 out.print( "\r\n<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\r\n<html>\r\n<head>\r\n " );
|
|
35 if (metaDescription != null) {
|
|
36 out.print( "<META NAME=\"description\" CONTENT=\"" );
|
|
37 out.print( (metaDescription) );
|
|
38 out.print( "\">" );
|
|
39 }
|
|
40 out.print( "\r\n " );
|
|
41 if (metaKeywords != null) {
|
|
42 out.print( "<META NAME=\"keywords\" CONTENT=\"" );
|
|
43 out.print( (metaKeywords) );
|
|
44 out.print( "\">" );
|
|
45 }
|
|
46 out.print( "\r\n " );
|
|
47 Shared.canonical(request, response);
|
|
48 out.print( "\r\n " );
|
|
49 Shared.title(request,response,"Help - "+help.question);
|
|
50 out.print( "\r\n</head>\r\n<body>\r\n " );
|
|
51 Shared.helpHeader(request,response);
|
|
52 out.print( "\r\n <div class=\"content-description\">\r\n <h1>" );
|
|
53 out.print( (help.question) );
|
|
54 out.print( "</h1>\r\n " );
|
|
55 out.print( (help.answer()) );
|
|
56 out.print( "\r\n <p>If you still have questions, visit <a href=\"" );
|
|
57 out.print( (Jtp.helpIndexUrl(request,response)) );
|
|
58 out.print( "\">Nabble Help</a> or the " );
|
|
59 out.print( (Jtp.supportLink()) );
|
|
60 out.print( " forum.</p>\r\n\r\n <p><br />« <a href=\"javascript:history.back();\">Go Back</a></p>\r\n </div>\r\n " );
|
|
61 Shared.footer(request,response);
|
|
62 out.print( "\r\n " );
|
|
63 Shared.analytics(request,response);
|
|
64 out.print( "\r\n</body>\r\n</html>\r\n" );
|
|
65
|
|
66 }
|
|
67 }
|
|
68
|