Rev 56 | 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[] names = new String[]{};
Object[] args = new Object[]{};
int topAnnouncements=1;
int centerAnnouncements=1;
int bottomAnnouncements=1;
List<AnnouncementView> announcementViews = (List<AnnouncementView>) sm.execute(RequestUtils.getRequester(request), "LoadTargetMaxAnnouncements", 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>
<logic:iterate id="item" name="Announcements" type="pt.estgp.estgweb.domain.views.AnnouncementView">
<logic:equal value="bottom.flash.news" name="item" property="type">
<%if(centerAnnouncements<=Globals.NUMBER_ANNOUNCEMENT_TYPE_BOTTOM_FLASH_NEWS_INDEX)
{
if(centerAnnouncements==1)
{ %>
<div id="flashCenterNews">
<table class="container">
<tr>
<%}%>
<td class="imageContainer">
<%if(item.getSmallImage() != null){%><img alt="<%=item.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=item.getSmallImage().getId()%>"><%}%>
</td>
<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">
<%if(!item.getHaveAllText())
{%>
<h2><html:link href="${item.url}">${item.title}</html:link></h2>
<p><html:link href="${item.url}">${item.textSummarySmall}</html:link></p>
<%}
else
{%>
<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:notEmpty>
</td>
<%if(centerAnnouncements==Globals.NUMBER_ANNOUNCEMENT_TYPE_BOTTOM_FLASH_NEWS_INDEX)
{%>
</tr>
</table>
</div>
<%
}
centerAnnouncements++;
}
else if(bottomAnnouncements<=Globals.NUMBER_ANNOUNCEMENT_TYPE_NEW_INDEX)
{
if(bottomAnnouncements==1)
{
%>
<div id="flashBottomNews">
<table class="container">
<tr>
<%}%>
<td>
<div class="imageContainer">
<%if(item.getSmallImage() != null){%><img alt="<%=item.getTitle()%>" src="<%=request.getContextPath()%>/imageStream/<%=item.getSmallImage().getId()%>"><%}%>
</div>
<div 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">
<%if(!item.getHaveAllText())
{%>
<h2><html:link href="${item.url}">${item.title}</html:link></h2>
<p><html:link href="${item.url}">${item.textSummarySmall}</html:link></p>
<%}
else
{%>
<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:notEmpty>
</div>
</td>
<%if(bottomAnnouncements==Globals.NUMBER_ANNOUNCEMENT_TYPE_NEW_INDEX)
{%>
</tr>
</table>
</div>
<%
}
bottomAnnouncements++;
}
%>
</logic:equal>
</logic:iterate>
<%if(bottomAnnouncements>1 && bottomAnnouncements<=Globals.NUMBER_ANNOUNCEMENT_TYPE_NEW_INDEX)
{
%>
</tr>
</table>
</div>
<%}%>
<%if(centerAnnouncements>1 && centerAnnouncements<=Globals.NUMBER_ANNOUNCEMENT_TYPE_BOTTOM_FLASH_NEWS_INDEX)
{
%>
</tr>
</table>
</div>
<%}%>
</div>