});
addSection(DBConversation.tagName, new Template.ITemplateSection() {
@Override
public void head(StringBuilder response, Path path, IPathable object) {
DBConversation conversation = (DBConversation) object;
// TODO: Ajouter paging
response.append("<div id=\"brd-pagepost-top\" class=\"main-pagepost gen-content\">"+
"<p class=\"paging\"><span class=\"pages\">Pages</span> <strong class=\"first-item\">1</strong></p>"+
"<p class=\"posting\">You must <a href=\"http://punbb.informer.com/forums/login/\">login</a> or <a href=\"http://punbb.informer.com/forums/register/\">register</a> to post a reply</p>"+
"</div>");
response.append("<div class=\"main-head\">"+
"<p class=\"options\"><span class=\"feed first-item\"><a class=\"feed\" href=\"/\">RSS topic feed</a></span></p>"+
"<h2 class=\"hn\"><span><span class=\"item-info\">Posts: "+ conversation.getChilds().size() +"</span></span></h2>"+
"</div>");
response.append("<div id=\"forum68\" class=\"main-content main-topic\">");
}
@Override
public void foot(StringBuilder response, Path path, IPathable object) {
response.append("</div>");
if(Action.actionAuthorized(object, Action.ActionType.createChild))
{
Action action = Action.buildAction(object, Action.ActionType.createChild);
TemplatePunBB.writeActionAsForm(action, response);
}
}
@Override
public void body(StringBuilder response, Path path, IPathable object) {
DBConversation conversation = (DBConversation) object;
@SuppressWarnings("unchecked")
List<DBComment> lcomments = (List<DBComment>) conversation.getChilds(0, 1);
String author="";
if(lcomments.size() > 0)
{
DBComment c = lcomments.get(0);
DBUser a = c.getAuthor();
author=a.getEmail();
}
// TODO: Counter of view in DBConversation
// TODO: Search last post
// TODO: Replace all id by real GAEForum id, or remove it !
// TODO: Add the "em closed" only if topic is closed
// TODO: Add a possibility to close a topic
response.append("<div id=\"topic24927\" class=\"main-item odd main-first-item sticky closed\">"+
"<span class=\"icon sticky closed\"><!-- --></span>"+
"<div class=\"item-subject\">"+
"<h3 class=\"hn\"><span class=\"item-num\">1</span> <span class=\"item-status\"><em class=\"closed\">Closed</em>:</span> <a href=\""+ Page.getUrl(conversation) +"\">"+ conversation.getTitle() +"</a></h3>"+
"<p><span class=\"item-starter\">by <cite>"+ author +"</cite></span> <span class=\"item-nav\">( <span>Pages </span><a class=\"first-item\" href=\""+ Page.getUrl(conversation) +"\">1</a> <a href=\""+ Page.getUrl(conversation) +"\">2</a> )</span></p>"+
"</div>" +
"<ul class=\"item-info\">" +
"<li class=\"info-replies\"><strong>"+ conversation.getChilds().size() +"</strong> <span class=\"label\">replies</span></li>"+
"<li class=\"info-views\"><strong>X</strong> <span class=\"label\">views</span></li>"+
"<li class=\"info-lastpost\"><span class=\"label\">Last post</span> <strong><a href=\"/\">X</a></strong> <cite>by X</cite></li>"+
"</ul>"+
"</div>");
}
});
addSection(DBComment.tagName, new Template.ITemplateSection() {
@Override
public void head(StringBuilder response, Path path, IPathable object) {
}
@Override
public void foot(StringBuilder response, Path path, IPathable object) {
}
@Override
public void body(StringBuilder response, Path path, IPathable object) {
DBComment comment = (DBComment) object;
DBUser author = comment.getAuthor();
DBConversation conversation = (DBConversation) path.getObjectByTagName(DBConversation.tagName);
// TODO: ajouter firstpost, lastpost, ou rien, pour la class du premier div
// TODO: Add a class of user (Admin, and personalized class ?)
// TODO: User can be online or not.
// TODO: Determiner le nombre de posts d'un author
// TODO: Ajouter une methode de formatage des messages(directement HTML ? ATTENTION au risque d'injection de JavaScript)
// TODO: Add a signature on comments, and on profile.
response.append("<div class=\"post odd topicpost\">"+
"<div id=\"p146029\" class=\"posthead\">"+
"<h3 class=\"hn post-ident\"><span class=\"post-num\">1</span> <span class=\"post-byline\"><span>Topic by </span><em class=\"group_color_7\"><a title=\"Go to "+ author.getEmail() +"'s profile\" href=\"/\">"+ author.getEmail() +"</a></em></span> <span class=\"post-link\"><a class=\"permalink\" rel=\"bookmark\" title=\"Permanent link to this post\" href=\""+ Page.getUrl(comment) +"\">"+ comment.getDateDiscription().toLocaleString() +"</a></span></h3>"+
"</div>"+
"<div class=\"postbody\">"+
"<div class=\"post-author\">"+
"<ul class=\"author-ident\">"+
"<li class=\"username\"><a title=\"Go to "+ author.getEmail() +"'s profile\" href=\"/\">"+ author.getEmail() +"</a></li>"+
"<li class=\"usertitle\"><span>Standard user</span></li>"+
"<li class=\"userstatus\"><span>Offline</span></li>"+
"</ul>"+
"<ul class=\"author-info\">"+
"<li><span>Registered: <strong>"+ author.getDateInscription() +"</strong></span></li>"+
"<li><span>Posts: <strong>X</strong></span></li>"+
"</ul>"+
"</div>"+
"<div class=\"post-entry\">"+
"<h4 id=\"pc146029\" class=\"entry-title hn\">"+ conversation.getTitle() +"</h4>"+
"<div class=\"entry-content\">"+
"<p>"+ comment.getTextComment() +"</p>"+
"<div class=\"sig-content\"><span class=\"sig-line\"><!-- --></span>Not implemented yes</div>"+
"</div>"+
"</div>"+