buf.append("<div class='article-content'>\n");
buf.append("<div class='article-title'>\n");
- appendA(buf, a.title, "redirect?url=" + URLEncoder.encode(a.link, "UTF-8"), null);
+ appendA(buf, a.title, "/redirect?url=" + URLEncoder.encode(a.link, "UTF-8"), null);
buf.append("</div>\n");
buf.append("<div class='article-info'>" + a.website + " - " + a.publicationDate + "</div>");
buf.append("</div>\n");
}
- private static void appendMenu(StringBuffer buf, Category catActive) {
+ private static void appendMenu(StringBuffer buf, Category catActive, Category[] cats) {
String cl;
buf.append("<nav>\n");
buf.append("<ul>\n");
- for (Category cat: Category.values()) {
+ for (Category cat: cats) {
buf.append("<li>");
if (cat.equals(catActive))
else
cl = null;
- appendA(buf, cat.getId(), cat.getId(), cl);
+ appendA(buf, cat.getName(), cat.getURL(), cl);
buf.append("</li>");
}
buf.append("</nav>\n");
}
- public static String toHTML(List<Article> articles, Category catActive) {
+ public static String toHTML(List<Article> articles, Category catActive, Category[] cats) {
StringBuffer buf;
int i;
buf.append("<html lang='fr'>\n");
buf.append("<head>\n");
buf.append("<meta charset=\"UTF-8\">\n");
- buf.append("<link rel='stylesheet' href='style.css' />\n");
- buf.append("<title>PNews</title>\n");
+ buf.append("<link rel='stylesheet' href='/style.css' />\n");
+ buf.append("<title>");
+ buf.append(catActive.getTitle());
+ buf.append(" - PNews</title>\n");
buf.append("</head>\n");
buf.append("<body>\n");
- appendMenu(buf, catActive);
+ appendMenu(buf, catActive, cats);
i = 0;
for (Article e: articles) {