|
a/tool/src/utils/html.java |
|
b/tool/src/utils/html.java |
|
... |
|
... |
16 |
import java.io.File;
|
16 |
import java.io.File;
|
17 |
import java.io.UnsupportedEncodingException;
|
17 |
import java.io.UnsupportedEncodingException;
|
18 |
import java.util.ArrayList;
|
18 |
import java.util.ArrayList;
|
19 |
import main.core;
|
19 |
import main.core;
|
20 |
import script.log;
|
20 |
import script.log;
|
|
|
21 |
import utils.vogella.Feed;
|
|
|
22 |
import utils.vogella.FeedMessage;
|
|
|
23 |
import utils.vogella.RSSFeedParser;
|
21 |
import www.RequestOrigin;
|
24 |
import www.RequestOrigin;
|
22 |
import www.WebRequest;
|
25 |
import www.WebRequest;
|
23 |
|
26 |
|
24 |
|
27 |
|
25 |
/**
|
28 |
/**
|
|
... |
|
... |
33 |
br = "\n<br>",
|
36 |
br = "\n<br>",
|
34 |
_div = "</div>\n",
|
37 |
_div = "</div>\n",
|
35 |
space = " ",
|
38 |
space = " ",
|
36 |
divider = space + "|" + space;
|
39 |
divider = space + "|" + space;
|
37 |
|
40 |
|
|
|
41 |
|
|
|
42 |
|
|
|
43 |
/**
|
|
|
44 |
* Retrieves an RSS feed from the Internet
|
|
|
45 |
* @param wwwLink The URL for the RSS feed
|
|
|
46 |
* @return an HTML formatted text
|
|
|
47 |
*/
|
|
|
48 |
public static String getRSS(String wwwLink){
|
|
|
49 |
String result = "";
|
|
|
50 |
|
|
|
51 |
RSSFeedParser parser = new RSSFeedParser(wwwLink);
|
|
|
52 |
Feed feed = parser.readFeed();
|
|
|
53 |
//System.out.println(feed);
|
|
|
54 |
for (FeedMessage msg : feed.getMessages()) {
|
|
|
55 |
|
|
|
56 |
result +=
|
|
|
57 |
html.link(msg.getTitle(), msg.getLink())
|
|
|
58 |
+ html.br
|
|
|
59 |
+ msg.getDescription()
|
|
|
60 |
+ html.br
|
|
|
61 |
+ html.br
|
|
|
62 |
;
|
|
|
63 |
//System.out.println(msg);
|
|
|
64 |
}
|
|
|
65 |
return result;
|
|
|
66 |
}
|
38 |
|
67 |
|
39 |
|
68 |
|
40 |
public static String getIcon(String iconName, WebRequest request){
|
69 |
public static String getIcon(String iconName, WebRequest request){
|
41 |
String result = iconName;
|
70 |
String result = iconName;
|
42 |
if(request.requestOrigin == RequestOrigin.BROWSER){
|
71 |
if(request.requestOrigin == RequestOrigin.BROWSER){
|