Subversion Repositories bacoAlunos

Rev

Rev 1306 | Rev 1312 | Go to most recent revision | 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/baco.tld" prefix="baco" %>
<%@ 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);



    names = new String[]{};
    args = new Object[]{Globals.ANNOUNCEMENT_TYPE_POPUP, subTarget};
    List<AnnouncementView> popupViews = (List<AnnouncementView>) sm.execute(RequestUtils.getRequester(request, response), "LoadTypeMaxAnnouncements", args, names);

    request.setAttribute("Popups", popupViews);

    for(AnnouncementView popup: popupViews)
    {
%>
    <script type="text/javascript">

        window.open('<%=popup.getUrl()%>','<%=popup.getTitle()%>',"status=0,toolbar=0,menubar=0,scrollbars=0,location=0,resizable=0,width=<%=popup.getPopupwidth()%>,height=<%=popup.getPopupheight()%>");

    </script>
<%
    }
%>


<jomm:messages/>
<html:errors/>


<div class="indexPage">


<%
    if(announcementViews != null && announcementViews.size() > 0)
    {
%>
        <div id="flashCenterNews">
            <table class="container" cellspacing="0">
                <tr>
<%
                int i;
                for(i = 0; i < announcementViews.size() && i < 0; 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>
                                <baco:canManage name="item">
                                <tr>
                                    <td colspan="2"><a href="<%=request.getContextPath()%>/startEditAnnouncement.do?id=${item.id}">Editar</a></td>
                                </tr>
                                </baco:canManage>
                            </table>
<%
                }
%>
                </tr>
            </table>
        </div>
<%
        if(i < announcementViews.size())
        {
%>
            <div id="flashBottomNews">
                <table class="container" cellspacing="10">
<%
                while(i < announcementViews.size())
                {
%>
                    <tr>
<%                  int j;

                    for(j = i; j < announcementViews.size() && j - i < 2; 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>
                                <baco:canManage name="item">
                                <tr>
                                    <td colspan="2"><a href="<%=request.getContextPath()%>/startEditAnnouncement.do?id=${item.id}">Editar</a></td>
                                </tr>
                                </baco:canManage>
                            </table>
    <%
                        }
                        i = j;
    %>
                        </td>
                    </tr>

<%
                }
%>
                </table>
            </div>
<%
        }

    }
%>
</div>