Rev 205 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page import="jomm.utils.MessageResources" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tlds/struts-nested.tld" prefix="nested" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/baco.tld" prefix="baco" %>
<jsp:useBean id="BlogView" type="pt.estgp.estgweb.domain.views.BlogView" scope="request"/>
<%
String fromAction = "";
String from = "";
String user = "";
if (request.getParameter("from") != null)
{
user = "/user";
fromAction = "From" + request.getParameter("from");
from = "?from=" + request.getParameter("from");
}
request.setAttribute("from", from);
request.setAttribute("user", user);
request.setAttribute("fromAction", fromAction);
%>
<html:errors/>
<jomm:messages/>
<div class="blog">
<div class="seccao">
<div class="postHeader">
<h1>
<bean:write name="BlogView" property="title"/>
</h1>
<baco:canManage name="BlogView">
<%
String confirmDelete = MessageResources.getMessage(request,"blog.confirm.delete");
request.setAttribute("confirmDelete",confirmDelete);
%>
<!--valid="false">-->
<html:link action="${user}/startEditBlog${fromAction}?id=${BlogView.id}">
<bean:message key="edit"/>
</html:link>
<html:link onclick="return confirm('${confirmDelete}')" action="${user}/startDeleteBlog${fromAction}?id=${BlogView.id}">
<bean:message key="delete"/>
</html:link>
</baco:canManage>
<table>
<tr>
<td valign="top">
<%
if (BlogView.getImage() != null)
{
%>
<div class="imageBlog">
<img align="left" alt="<%=BlogView.getTitle()%>"
src="<%=request.getContextPath()%>/imageStream/<%=BlogView.getImage().getId()%>">
</div>
<%
}
%>
</td>
<td valign="top">
${BlogView.description}
</td>
</tr>
</table>
</div>
<div class="toolsContainer">
<div class="tools">
<baco:canAddContent name="BlogView">
<a href="<%=request.getContextPath()%>${user}/startAddPost${fromAction}.do?id=<%=BlogView.getId()%>"><bean:message key="blog.add.post"/></a>
</baco:canAddContent>
</div>
</div>
<baco:canAddContent name="BlogView">
<logic:present name="BlogPostView">
<html:form action="${user}/blogsController${fromAction}${from}" enctype="multipart/form-data">
<input type="hidden" name="dispatch" value="savePost">
<html:hidden property="blogView.id"/>
<div class="form">
<table>
<tr>
<th>
<bean:message key="blogpost.title"/>
</th>
<td>
<html:text styleClass="text" property="blogPostView.title"/>
</td>
<tr>
<tr>
<th>
<bean:message key="blog.image"/>
</th>
<td>
<html:file styleClass="text" property="image"/>
</td>
<tr>
</tr>
<th>
<bean:message key="blogpost.text"/>
</th>
<td>
<html:textarea styleClass="textarea" property="blogPostView.text"/>
</td>
</tr>
<tr class="buttons">
<td colspan="2">
<input type="button" onclick="set(this.form,'savePost');this.form.submit()"
value="<bean:message key="confirm"/>"/>
</td>
</tr>
</table>
</div>
</html:form>
</logic:present>
</baco:canAddContent>
<table cellpadding="0" cellspacing="0" border="0">
<tr>
<td class="postsContainer">
<logic:notEmpty name="BlogView" property="lastPosts">
<%
String confirmDeletePost = MessageResources.getMessage(request,"blog.confirm.delete.post");
request.setAttribute("confirmDeletePost",confirmDeletePost);
%>
<logic:notEqual value="0" name="BlogView" property="month">
<h2><bean:message key="month.${BlogView.month}.year" arg0="${BlogView.year}"/></h2>
</logic:notEqual>
<table class="posts">
<logic:iterate id="post" name="BlogView" property="lastPosts"
type="pt.estgp.estgweb.domain.views.BlogPostView">
<baco:canLoad name="post">
<tr>
<td colspan="2" class="title">
<a name="post${post.id}"></a>${post.title}
<baco:canManage name="post">
<a onclick="return confirm('${confirmDeletePost}')" href="<%=request.getContextPath()%>${user}/startDeletePost${fromAction}.do?id=${post.id}&blogId=${BlogView.id}"><bean:message key="blog.delete.post"/></a>
<baco:canManage name="BlogView">
<%
if(post.getStatus())
{
%>
<a href="<%=request.getContextPath()%>${user}/startValidatePost${fromAction}.do?status=false&id=${post.id}&blogId=${BlogView.id}"><bean:message key="blog.status.invalidate"/></a>
<%
}
else
{
%>
<a href="<%=request.getContextPath()%>${user}/startValidatePost${fromAction}.do?status=true&id=${post.id}&blogId=${BlogView.id}"><bean:message key="blog.status.validate"/></a>
<%
}
%>
</baco:canManage>
</baco:canManage>
</td>
</tr>
<tr>
<td valign="top">
${post.text}
</td>
<td valign="top">
<%
if (post.getImage() != null)
{
%>
<div class="imageBlog">
<img align="left" alt="<%=BlogView.getTitle()%>"
src="<%=request.getContextPath()%>/imageStream/<%=post.getImage().getId()%>">
</div>
<%
}
%>
</td>
</tr>
<tr>
<td colspan="2" class="pFooter">
Posted by: ${post.ownerUsername} AT ${post.formatedSaveDate}
</td>
</tr>
</baco:canLoad>
</logic:iterate>
</table>
</logic:notEmpty>
</td>
<td class="oldMonths" id="rightPagePosition">
<logic:notEmpty name="BlogView" property="months">
<div class="linkMenuBlockRight">
<div class="linkMenuBlockTitle">
<bean:message key="blog.old.months"/>
</div>
<div class="linkRightMenu">
<div class="listClean">
<ul>
<logic:iterate id="month" name="BlogView" property="months" type="pt.estgp.estgweb.domain.views.BlogView.MonthPosts">
<li>
<a href="<%=request.getContextPath()%>${user}/startLoadBlogMonth${fromAction}.do?id=${BlogView.id}&month=${month.month}&year=${month.year}">
<bean:message key="month.${month.month}"/> <bean:message key="from"/> ${month.year} (${month.count} posts)
</a>
</li>
</logic:iterate>
</ul>
</div>
</div>
</div>
</logic:notEmpty>
</td>
</tr>
</table>
<div class="pFooter">
<%
String identifier = "" + BlogView.getId();
if(BlogView.getName() != null && BlogView.getName().length() > 0)
identifier = BlogView.getName();
%>
<a href="<%=request.getContextPath()%>/blog/<%=identifier%>">
<%=Globals.SITE_URL + "/blog/" + identifier%>
</a>
<bean:message key="blog.owner"/>
<a href="mailto:${BlogView.ownerEmail}">${BlogView.owner.name}</a>
<bean:message key="at"/>
${BlogView.formatedSaveDate}
</div>
</div>
</div>