Subversion Repositories bacoAlunos

Rev

Rev 320 | Blame | Compare with Previous | Last modification | View Log | RSS feed

<%@ page import="pt.estgp.estgweb.Globals" %>
<%@ 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="AnnouncementsForm" type="pt.estgp.estgweb.web.form.announcements.AnnouncementsForm" scope="request"/>
<jsp:useBean id="UserSession" type="pt.estgp.estgweb.domain.UserSession" scope="request"/>
<jomm:messages/>
<html:errors/>
<%
    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:form action="${user}/submitAnnouncement${fromAction}${from}" enctype="multipart/form-data">
<html:hidden property="role"/>
<html:hidden property="announcementView.id"/>
<html:hidden property="smallImageStr"/>
<html:hidden property="bigImageStr"/>
<input type="hidden" name="dispatch" value="removeRole">
<table class="form">

<baco:isAdmin>
    <tr>
        <th>
            <bean:message key="announcement.status"/>
        </th>
        <td>
            <html:select property="announcementView.status">
                <html:option value="true">
                    <bean:message key="yes"/>
                </html:option>
                <html:option value="false">
                    <bean:message key="no"/>
                </html:option>
            </html:select>
        </td>
    </tr>
</baco:isAdmin>
<tr>
    <th>
        <bean:message key="announcement.internal"/>
    </th>
    <td>
        <html:select property="announcementView.internal">
            <html:option value="true">
                <bean:message key="announcement.internal.yes"/>
            </html:option>
            <html:option value="false">
                <bean:message key="announcement.internal.no"/>
            </html:option>
        </html:select>
    </td>
</tr>

<tr>
    <th>
        <bean:message key="announcement.typeAnnouncement"/>
    </th>
    <td>
        <html:select property="announcementView.type">
            <logic:present name="AnnouncementsForm" property="announcementTypes">
                <logic:iterate id="item" name="AnnouncementsForm" property="announcementTypes">
                    <%
                        if(!Globals.ANNOUNCEMENT_NOT_STANDARD.contains(item))
                        {
                    %>
                    <jomm:option itemName="item" comparableObjectName="AnnouncementsForm"
                                 comparableObjectProperty="announcementView.type">
                        <bean:message key="announcements.type.${item}"/>
                    </jomm:option>
                    <%
                        }
                    %>
                </logic:iterate>
            </logic:present>
        </html:select>
    </td>
</tr>

<logic:present name="UserSession" property="user">
    <baco:isRealOwner name="AnnouncementsForm" property="announcementView">
        <logic:notEmpty name="UserSession" property="user.ownerRoles">
            <tr>
                <th>
                    <bean:message key="announcement.sendAnnouncementLike"/>
                </th>
                <td>
                    <html:select property="announcementView.choosedOwnerRole">
                        <logic:iterate id="item" name="UserSession" property="user.ownerRoles">
                            <jomm:option itemName="item" comparableObjectName="AnnouncementsForm"
                                         comparableObjectProperty="announcementView.choosedOwnerRole">
                                <bean:message key="user.role.${item}"/>
                            </jomm:option>
                        </logic:iterate>
                    </html:select>
                </td>
            </tr>
        </logic:notEmpty>
    </baco:isRealOwner>
</logic:present>

<tr>
    <th>
        <bean:message key="announcement.target.roles"/>
    </th>
    <td>
        <html:select property="targetRolesStr">
            <baco:isAdmin>
                <logic:present name="AnnouncementsForm" property="targetRoles">
                    <logic:iterate id="item" name="AnnouncementsForm" property="targetRoles">
                        <jomm:option itemName="item" comparableObjectName="AnnouncementsForm"
                                     comparableObjectProperty="targetRolesStr">
                            <jomm:message patternMessage="user.role.{0}" name0="item"/>
                        </jomm:option>
                    </logic:iterate>
                    <input type="button" value="<bean:message key="add"/>"
                           onclick="set(this.form,'addRole');this.form.submit();">
                </logic:present>
            </baco:isAdmin>
            <baco:isNotAdmin>
                <html:option value="all">
                    <bean:message key="user.role.all"/>
                </html:option>
                <html:option value="student">
                    <bean:message key="user.role.student"/>
                </html:option>
                <html:option value="oldStudent">
                    <bean:message key="user.role.oldStudent"/>
                </html:option>
                <html:option value="futureStudent">
                    <bean:message key="user.role.futureStudent"/>
                </html:option>
                <html:option value="teacher">
                    <bean:message key="user.role.teacher"/>
                </html:option>
            </baco:isNotAdmin>
        </html:select>


        <logic:present name="AnnouncementsForm" property="selectedRoles">
            <logic:notEmpty name="AnnouncementsForm" property="selectedRoles">
                <table class="dataTable removeButton">
                    <logic:iterate id="item" name="AnnouncementsForm" property="selectedRoles">
                        <tr>
                            <th>
                                <jomm:message patternMessage="user.role.{0}" name0="item"/>
                            </th>
                            <td><input type="button" class="removeButton"
                                       onclick="AnnouncementsForm.role.value='${item}';set(this.form,'removeRole');this.form.submit();">
                            </td>
                        </tr>
                    </logic:iterate>
                </table>
            </logic:notEmpty>
        </logic:present>
    </td>
</tr>

<tr>
    <th>
        <bean:message key="announcement.title"/>
        *
    </th>
    <td>
        <html:text styleClass="text" property="announcementView.title" maxlength="250"/>
    </td>
</tr>
<baco:isAdmin>
    <tr>
        <th>
            <bean:message key="announcement.startDate"/>
        </th>
        <td>
            <a href="javascript:cal.select(getObjectById('startDate'),'anchor1','yyyy/MM/dd')" name="anchor1" id="anchor1"><html:text styleClass="date" property="startDate" styleId="startDate" readonly="true"/></a>
            <input type="button" class="removeButton" onClick="AnnouncementsForm.startDate.value=null">
        </td>
    </tr>
</baco:isAdmin>
<tr>
    <th>
        <bean:message key="announcement.expireDate"/>
        *
    </th>
    <td>
        <a href="javascript:cal.select(getObjectById('expireDate'),'anchor2','yyyy/MM/dd')" name="anchor2" id="anchor2"><html:text styleClass="date" property="expireDate" styleId="expireDate" readonly="true"/></a>
        <input type="button" class="removeButton" onClick="AnnouncementsForm.expireDate.value=null">
    </td>
</tr>
<tr>
    <th>
        <bean:message key="announcement.bigImage"/>
    </th>
    <td>
        <logic:equal name="AnnouncementsForm" property="announcementView.bigImageId" value="0">
            <html:file styleClass="file" styleId="bigImageId" property="bigImage" value="teste"/>
            <bean:message key="announcement.image.max"/>
            <%=Globals.MAX_BIGMAGE_FILE_SIZE_KBYTES + "kb"%>
        </logic:equal>
        <logic:notEqual name="AnnouncementsForm" property="announcementView.bigImageId" value="0">
            <table cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td>
                        <html:file styleClass="file" styleId="bigImageId" property="bigImage" value="teste"/>
                        <bean:message key="announcement.image.max"/>
                        <%=Globals.MAX_BIGMAGE_FILE_SIZE_KBYTES + "kb"%>
                    </td>
                    <td>
                        <img width="100px" src="<%=request.getContextPath()%>/imageStream/<%=AnnouncementsForm.getAnnouncementView().getBigImageId()%>">
                    </td>
                </tr>
            </table>

        </logic:notEqual>
    </td>
</tr>
<tr>
    <th>
        <bean:message key="announcement.smallImage"/>
    </th>
    <td>
        <logic:equal name="AnnouncementsForm" property="announcementView.smallImageId" value="0">
            <input class="file" id="smallImageId" name="smallImage" type="file" value="<%=AnnouncementsForm.getSmallImageStr()%>"/>
            <bean:message key="announcement.image.max"/>
            <%=Globals.MAX_SMALLIMAGE_FILE_SIZE_KBYTES + "kb"%>
        </logic:equal>
        <logic:notEqual name="AnnouncementsForm" property="announcementView.smallImageId" value="0">
            <table cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td>
                        <input class="file" id="smallImageId" name="smallImage" type="file"
                               value="<%=AnnouncementsForm.getSmallImageStr()%>"/>
                        <bean:message key="announcement.image.max"/>
                        <%=Globals.MAX_SMALLIMAGE_FILE_SIZE_KBYTES + "kb"%>
                    </td>
                    <td>
                        <img width="100px" src="<%=request.getContextPath()%>/imageStream/<%=AnnouncementsForm.getAnnouncementView().getSmallImageId()%>">
                    </td>
                </tr>
            </table>

        </logic:notEqual>

    </td>
</tr>

<tr>
    <th>
        <bean:message key="announcement.image.style"/>
    </th>
    <td>
        <html:select property="announcementView.style">
            <html:option value="announcement.style.img.left">
                <bean:message key="announcement.style.img.left"/>
            </html:option>
            <html:option value="announcement.style.img.left.top">
                <bean:message key="announcement.style.img.left.top"/>
            </html:option>
            <html:option value="announcement.style.img.left.bottom">
                <bean:message key="announcement.style.img.left.bottom"/>
            </html:option>
            <html:option value="announcement.style.img.right">
                <bean:message key="announcement.style.img.right"/>
            </html:option>
            <html:option value="announcement.style.img.right.top">
                <bean:message key="announcement.style.img.right.top"/>
            </html:option>
            <html:option value="announcement.style.img.right.bottom">
                <bean:message key="announcement.style.img.right.bottom"/>
            </html:option>
            <html:option value="announcement.style.img.top">
                <bean:message key="announcement.style.img.top"/>
            </html:option>
            <html:option value="announcement.style.img.top.left">
                <bean:message key="announcement.style.img.top.left"/>
            </html:option>
            <html:option value="announcement.style.img.top.right">
                <bean:message key="announcement.style.img.top.right"/>
            </html:option>
            <html:option value="announcement.style.img.embedded.left">
                <bean:message key="announcement.style.img.embedded.left"/>
            </html:option>
            <html:option value="announcement.style.img.embedded.right">
                <bean:message key="announcement.style.img.embedded.right"/>
            </html:option>
        </html:select>
    </td>
</tr>


<tr>
    <th>
        <bean:message key="announcement.linkAnnouncement"/>
    </th>
    <td>
        <html:select property="urlProtocol">
            <html:option value="http://">Http://</html:option>
            <html:option value="ftp://">ftp://</html:option>
            <html:option value="https://">Https://</html:option>
            <html:option value="">Relativo ao Baco (exemplo: /blog/bugs</html:option>
        </html:select>
        <html:text property="url" maxlength="250"/>
    </td>
</tr>


<tr>
    <th>
        <bean:message key="announcement.internalLinkAnnouncement"/>
    </th>
    <td>
        <html:select property="announcementView.internalUrlInclude">
            <html:option value="true">
                <bean:message key="announcement.internal.url.include.yes"/>
            </html:option>
            <html:option value="false">
                <bean:message key="announcement.internal.url.include.no"/>
            </html:option>
        </html:select>
        <html:text property="announcementView.internalUrlPath"/>
        <html:select property="announcementView.internalUrlServer">
            <html:option value="estgp">ESTG</html:option>
            <html:option value="ionline">IONLINE</html:option>
        </html:select>
    </td>
</tr>

<tr>
    <th>
        <bean:message key="announcement.text"/>
        *
    </th>
    <td>
        <html:textarea styleClass="textarea" property="announcementView.text"/>
    </td>
</tr>
<tr class="buttons">
    <td colspan="2">
        <input type="button"
               onclick="form.smallImageStr.value=form.smallImage.value;form.bigImageStr.value=form.bigImage.value; set(this.form,'save');this.form.submit()"
               value="<bean:message key="confirm"/>"/>
    </td>
</tr>
</table>
</html:form>

Generated by GNU Enscript 1.6.5.2.