Mercurial Hosting > nabble
comparison src/nabble/view/lib/EmbedUtils.java @ 0:7ecd1a4ef557
add content
author | Franklin Schmidt <fschmidt@gmail.com> |
---|---|
date | Thu, 21 Mar 2019 19:15:52 -0600 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:7ecd1a4ef557 |
---|---|
1 | |
2 package nabble.view.lib; | |
3 | |
4 import nabble.model.Node; | |
5 | |
6 import javax.servlet.http.HttpServletRequest; | |
7 | |
8 | |
9 public final class EmbedUtils { | |
10 private EmbedUtils() {} // never | |
11 | |
12 private static String url(HttpServletRequest request, Node node) { | |
13 return Jtp.getBaseUrl(request) + Jtp.path(node); | |
14 } | |
15 | |
16 private static String getRawForumSnippet(HttpServletRequest request, Node app) { | |
17 return | |
18 "<a id=\"nabblelink\" href=\"" | |
19 +(url(request,app)) | |
20 +"\">" | |
21 +(app.getSubject()) | |
22 +"</a>\r\n<script src=\"" | |
23 +(Jtp.getBaseUrl(request)) | |
24 +"/embed/f" | |
25 +(app.getId()) | |
26 +"\"></script>" | |
27 ; | |
28 } | |
29 | |
30 public static String getForumSnippet(HttpServletRequest request, Node app) { | |
31 return getRawForumSnippet(request,app).replace("<", "<").replace(">", ">"); | |
32 } | |
33 | |
34 public static String getTopicSnippet(HttpServletRequest request, Node rootPost) { | |
35 return | |
36 "<a id=\"nabblelink\" href=\"" | |
37 +(url(request,rootPost)) | |
38 +"\">" | |
39 +(rootPost.getSubject()) | |
40 +"</a>\r\n<script src=\"" | |
41 +(rootPost.getSite().getBaseUrl()) | |
42 +"/embed/p" | |
43 +(rootPost.getId()) | |
44 +"\"></script>" | |
45 | |
46 .replace("<", "<").replace(">", ">"); | |
47 } | |
48 | |
49 } | |
50 |