Mercurial Hosting > nabble
diff src/nabble/view/web/embed/EmbedInfo.jtp @ 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 diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/nabble/view/web/embed/EmbedInfo.jtp Thu Mar 21 19:15:52 2019 -0600 @@ -0,0 +1,65 @@ +<% +package nabble.view.web.embed; + +import nabble.model.Site; +import nabble.model.Node; +import nabble.view.lib.Jtp; +import nabble.view.lib.Shared; + +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 EmbedInfo extends HttpServlet { + + protected void service(HttpServletRequest request, HttpServletResponse response) + throws ServletException, IOException + { + Jtp.dontCache(response); + + PrintWriter out = response.getWriter(); + String nodeID = request.getParameter("node"); + if (nodeID == null) { + response.sendError(HttpServletResponse.SC_NOT_FOUND); + return; + } + + String clientID = request.getParameter("cid"); + String hash = request.getParameter("hash"); + String conf = request.getParameter("conf"); + + Site site = Jtp.getSite(request); + Node embeddedNode = site==null ? null : site.getNode(Long.parseLong(nodeID)); + %> + <html> + <head> + <script src="<%=Shared.getJQueryPath()%>"></script> + <script type="text/javascript"> + var hash = "<%=hash%>"; + var what = '<%=embeddedNode == null? "" : embeddedNode.getKind() == Node.Kind.APP? Jtp.viewName(embeddedNode).toLowerCase():"topic"%>'; + function canScroll() { return <%=conf == null || conf.indexOf("noscroll") == -1%>; } + + var clientID = '<%=clientID%>'; + + <%/* Runs when everything here is ready */%> + function start() { + try { + parent.nabbleready.location = "/util/Empty.jtp"; + } catch(err) { + setTimeout(start, 100); + } + } + start(); + </script> + </head> + <body> + </body> + </html> + <% + } +} +%>