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);
}
}
// TODO: Add a method on IPathable to count childs objects instead of getChilds().size()
@Override
public void body(StringBuilder response, Path path, IPathable object) {
DBTopic topic = (DBTopic)object;
response.append("<div id=\"forum48\" class=\"main-item odd main-first-item\">" +
"<span class=\"icon \"><!-- --></span>" +
"<div class=\"item-subject\">" +
"<h3 class=\"hn\"><a href=\""+ ForumPages.Page.getUrl(topic) +"\"><span>"+ topic.getTitle() +"</span></a></h3>" +
"<p>"+topic.getDescription()+"</p>" +
"</div>" +
"<ul class=\"item-info\">" +
"<li class=\"info-topics\"><strong>"+ topic.getChilds().size() +"</strong> <span class=\"label\">topics</span></li>"+
"<li class=\"info-posts\"><strong>X</strong> <span class=\"label\">posts</span></li>" +
"<li class=\"info-lastpost\"><span class=\"label\">Last post:</span> <strong><a href=\"http://punbb.informer.com/forums/post/145563/#p145563\">2012-06-28 07:06</a></strong> <cite>by CReatiVe4w3</cite></li>" +
"</ul>" +
"</div>");
}
});
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);
}
}