Mercurial Hosting > nabble
comparison src/nabble/view/web/catalog/ExportConfirmation.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.catalog; | |
3 | |
4 import fschmidt.util.servlet.AuthorizingServlet; | |
5 import nabble.model.ModelHome; | |
6 import nabble.model.Node; | |
7 import nabble.model.User; | |
8 import nabble.model.export.Export; | |
9 import nabble.view.lib.Jtp; | |
10 import nabble.view.lib.Shared; | |
11 import org.slf4j.Logger; | |
12 import org.slf4j.LoggerFactory; | |
13 | |
14 import javax.servlet.ServletException; | |
15 import javax.servlet.http.HttpServlet; | |
16 import javax.servlet.http.HttpServletRequest; | |
17 import javax.servlet.http.HttpServletResponse; | |
18 import java.io.IOException; | |
19 import java.io.PrintWriter; | |
20 | |
21 | |
22 public class ExportConfirmation extends HttpServlet implements AuthorizingServlet { | |
23 private static final Logger logger = LoggerFactory.getLogger(ExportConfirmation.class); | |
24 | |
25 public String getAuthorizationKey(HttpServletRequest request) throws ServletException { | |
26 return Jtp.getReadAuthorizationKey( Jtp.getSiteNotNull(request).getNode(Jtp.getLong(request,"node")) ); | |
27 } | |
28 | |
29 public boolean authorize(String key,HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { | |
30 return Jtp.authorizeForRead(key,request,response); | |
31 } | |
32 | |
33 protected void service(HttpServletRequest request, HttpServletResponse response) | |
34 throws ServletException, IOException | |
35 { | |
36 PrintWriter out = response.getWriter(); | |
37 String nodeId = request.getParameter("node"); | |
38 Node node = Jtp.getSiteNotNull(request).getNode(Long.valueOf(nodeId)); | |
39 if (node == null) { | |
40 response.sendError(HttpServletResponse.SC_NOT_FOUND); | |
41 return; | |
42 } | |
43 | |
44 User user = Jtp.getUser(request, response); | |
45 boolean allowed = Jtp.canBeRemovedBy(node,user); | |
46 if (!allowed) { | |
47 Jtp.login("Only administrators can proceed in this area.", request, response); | |
48 return; | |
49 } | |
50 | |
51 String url = request.getParameter("url"); | |
52 if (url == null || !Export.isValidExportServer(url)) { | |
53 logger.error("Invalid export URL: ["+url+"] referer="+request.getHeader("referer")+" user="+Jtp.getUser(request,response)+" user-agent="+request.getHeader("user-agent")); | |
54 return; | |
55 } | |
56 | |
57 String action = request.getParameter("action"); | |
58 if ("export".equals(action) && "POST".equals(request.getMethod())) { | |
59 logger.info("Starting export of node ID=" + node.getId() + " to [" + url + ']'); | |
60 node.export(url, user.getEmail()); | |
61 response.sendRedirect(url); | |
62 return; | |
63 } | |
64 %> | |
65 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> | |
66 <html> | |
67 <head> | |
68 <% Shared.title(request, response, "Parent Options / Export Confirmation"); %> | |
69 </head> | |
70 <body> | |
71 <% Shared.minHeader(request,response, node); %> | |
72 <% Shared.editHeader(node.getSubjectHtml(), "Parent Options", out); %> | |
73 | |
74 <h2 style="margin-bottom:.6em">Export Confirmation</h2> | |
75 You have requested the following URL to be the new parent of <em>"<%=node.getSubjectHtml()%>"</em>: | |
76 <div class="highlight rounded" style="padding:.5em;margin: .5em 0 1em;font-weight:bold"> | |
77 <%=url%> | |
78 </div> | |
79 This new parent is not related to <em><%=node.getSubjectHtml()%></em>, | |
80 so Nabble must migrate the contents of your <%=Jtp.viewName(node).toLowerCase()%> to that new location. | |
81 You should understand that: | |
82 <ul> | |
83 <li style="padding-bottom:1em"> | |
84 <strong>This change may not happen immediately</strong>. | |
85 <div> | |
86 The system will have to move post by post to the new location and this may | |
87 take hours (or even days) to finish depending on the size of the moved elements. | |
88 You will be notified by email when the process is complete. | |
89 </div> | |
90 </li> | |
91 <li style="padding-bottom:1em"> | |
92 <strong>All links to the moved elements will change (including links to posts and replies).</strong> | |
93 <div> | |
94 <span class="important" style="font-weight:bold">Previous links will NOT work anymore.</span> | |
95 Users should update their links if they want to visit those pages again in the future. | |
96 </div> | |
97 </li> | |
98 <li style="padding-bottom:1em"> | |
99 <strong>Some user accounts may not be moved.</strong> | |
100 <div> | |
101 The system will move posts and all associated user accounts to the new destination. | |
102 Non-related users accounts will not be moved. | |
103 </div> | |
104 </li> | |
105 <li> | |
106 <strong>Customizations will not be moved.</strong> | |
107 <div> | |
108 Custom NAML code and other changes (e.g., font size, CSS and other settings from the <i>Change Appearance</i> page) will not be moved. | |
109 </div> | |
110 </li> | |
111 </ul> | |
112 <div style="margin-top:1.5em"> | |
113 Do you really want to start the export process for <em><%=node.getSubjectHtml()%></em>? | |
114 </div> | |
115 | |
116 <form method="post" action="/catalog/ExportConfirmation.jtp" accept-charset="UTF-8"> | |
117 <input type="hidden" name="action" value="export" /> | |
118 <input type="hidden" name="node" value="<%=node.getId()%>" /> | |
119 <input type="hidden" name="url" value="<%=url%>" /> | |
120 | |
121 <div style="margin-top:1.4em"> | |
122 <input type="submit" name="save" value="Yes, Export it" /> or <a href="<%=Jtp.path(node)%>">Cancel</a> | |
123 </div> | |
124 </form> | |
125 | |
126 <% Shared.footer(request, response); %> | |
127 <% Shared.analytics(request,response); %> | |
128 </body> | |
129 </html> | |
130 <% | |
131 } | |
132 } | |
133 %> |