Rev 238 | Blame | Compare with Previous | Last modification | View Log | RSS feed
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.IServiceManager" %>
<%@ page import="pt.utl.ist.berserk.logic.serviceManager.ServiceManager" %>
<%@ page import="pt.estgp.estgweb.web.utils.RequestUtils" %>
<%@ page import="pt.estgp.estgweb.domain.views.AnnouncementView" %>
<%@ page import="java.util.List" %>
<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ page language="java" %>
<%@ taglib uri="/WEB-INF/tlds/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tlds/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tlds/jomm.tld" prefix="jomm" %>
<%@ taglib uri="/WEB-INF/tlds/struts-bean.tld" prefix="bean" %>
<%
IServiceManager sm = ServiceManager.getInstance();
String subTarget = null;
String[] names = new String[]{};
Object[] args = new Object[]{Globals.ANNOUNCEMENT_TYPE_BOTTOM_FLASH_NEWS, subTarget};
List<AnnouncementView> announcementViews = (List<AnnouncementView>) sm.execute(RequestUtils.getRequester(request, response), "LoadTypeMaxAnnouncements", args, names);
request.setAttribute("Announcements", announcementViews);
%>
<jomm:messages/>
<html:errors/>
<script type="text/javascript">
<!--
getFlashNews('<%=request.getContextPath()%>/public/announcements/getFlashNews.jsp',<%=Globals.ANNOUNCEMENT_TYPE_TOP_FLASH_NEWS_TIMEOUT%>);
-->
</script>
<div class="indexPage">
<h1>
<bean:message key="mainAnnouncements"/>
</h1>
<div id="flashTopNews">
<table class="container">
<tr>
<td class="textContainer">
<bean:message key="announcements.loading"/>
</td>
<td class="imageContainer">
</td>
</tr>
</table>
</div>
<%
if(announcementViews != null && announcementViews.size() > 0)
{
%>
<div id="flashCenterNews">
<table class="container" cellspacing="0">
<tr>
<%
int i;
for(i = 0; i < announcementViews.size() && i < 2; i++)
{
AnnouncementView announcementView = announcementViews.get(i);
request.setAttribute("item",announcementView);
%> <td class="cont">
<table class="flashNew" cellpadding="0" cellspacing="0"><tr>
<th class="imageContainer">
<logic:present name="item" property="smallImage">
<img alt="${item.title}" src="<%=request.getContextPath()%>/imageStream/${item.smallImage.id}">
</logic:present>
</th>
<td class="textContainer">
<logic:empty name="item" property="url">
<h2>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.title}</html:link>
</h2>
<p>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.textSummarySmall}</html:link>
</p>
</logic:empty>
<logic:notEmpty name="item" property="url">
<logic:equal value="false" name="item" property="textBiggerThenPermited">
<h2>
<html:link href="${item.url}">${item.title}</html:link>
</h2>
<p>
<html:link href="${item.url}">${item.textSummarySmall}</html:link>
</p>
</logic:equal>
<logic:equal value="true" name="item" property="textBiggerThenPermited">
<h2>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.title}</html:link>
</h2>
<p>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.textSummarySmall}</html:link>
</p>
</logic:equal>
</logic:notEmpty>
</td>
</tr></table>
<%
}
%>
</tr>
</table>
</div>
<%
if(i < announcementViews.size())
{
%>
<div id="flashBottomNews">
<table class="container" cellspacing="0">
<%
while(i < announcementViews.size())
{
%>
<tr>
<% int j;
for(j = i; j < announcementViews.size() && j - i < 4; j++)
{
AnnouncementView announcementView = announcementViews.get(j);
request.setAttribute("item",announcementView);
%>
<td class="cont">
<table class="flashNew" cellpadding="0" cellspacing="0"><tr>
<th class="imageContainer">
<logic:present name="item" property="smallImage">
<img alt="${item.title}" src="<%=request.getContextPath()%>/imageStream/${item.smallImage.id}">
</logic:present>
</th>
<td class="textContainer">
<logic:empty name="item" property="url">
<h2>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.title}</html:link>
</h2>
<p>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.textSummarySmall}</html:link>
</p>
</logic:empty>
<logic:notEmpty name="item" property="url">
<logic:equal value="false" name="item" property="textBiggerThenPermited">
<h2>
<html:link href="${item.url}">${item.title}</html:link>
</h2>
<p>
<html:link href="${item.url}">${item.textSummarySmall}</html:link>
</p>
</logic:equal>
<logic:equal value="true" name="item" property="textBiggerThenPermited">
<h2>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.title}</html:link>
</h2>
<p>
<html:link action="/loadAnnouncement?id=${item.id}&dispatch=load">${item.textSummarySmall}</html:link>
</p>
</logic:equal>
</logic:notEmpty>
</td>
</tr></table>
<%
}
i = j;
%>
</td>
</tr>
<%
}
%>
</table>
</div>
<%
}
}
%>
</div>