<%@ page import="vkc.view.TabId" %>

<%@ taglib uri="struts-bean"  prefix="bean"  %>
<%@ taglib uri="struts-html"  prefix="html"  %>
<%@ taglib uri="struts-logic" prefix="logic" %>
<%@ taglib uri="vkc-taglib"   prefix="vkc"   %>

<vkc:init/>
<html:html locale="true">
<head>
    <meta http-equiv="content-type"  content="text/html; charset=iso-8859-1" />
	<vkc:cssinclude />

    <script type="text/javascript" src="<vkc:rewrite page='/common/utils.js'/>"></script>

    <script type="text/javascript">

    window.name = "MAINVIEW";
    var associatedTabId = <%=TabId.NEWS_TAB%>;

    function init() {
        var tabView = getTabView();
        var tabViewForm = tabView.document.forms[0];

        if (tabView && tabView.systemviewtype == "categoryview" && tabView.selectedTabId != associatedTabId) {
        	tabView.location.replace("<%=ctxPath%>/vkcTabView.do?selectedTabId=<%=TabId.NEWS_TAB%>"
          						   + "&lastCategoryId=" + tabViewForm.lastCategoryId.value
          						   + "&lastFunctionalId=" + tabViewForm.lastFunctionalId.value
          						   + "&lastProjectId=" + tabViewForm.lastProjectId.value);
        }
    }
    </script>
</head>

<body onLoad="init();">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
  <html:form action="/showNews" method="post">
  <bean:define id="form" name="showNewsForm" scope="request" type="vkc.news.form.ShowNewsForm"/>
  
  <logic:notEmpty name="form" property="news">
  <logic:iterate id="news" name="form" property="news" type="vkc.db.entities.VKCNews">

  <logic:equal name="news" property="valid" value="true">
  <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" width="20" height="20" border="0" alt=""/></td></tr>
  <tr> 
	<td>  
      <table cellspacing="3" cellpadding="0" border="0" width="100%">
        <tr>
          <td colspan="2">
            <table cellspacing="0" cellpadding="0" border="0" width="100%">
              <tr class="color_doctitle">
                <td width="99%"><b><vkc:write name="news" property="headline"/></b></td>
                <td align="right" width="1%"><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" height="24" width="1"/></td>
                <td align="right" nowrap><b>[<vkc:message key="vkc.news.creator"/></b>&nbsp;<vkc:write name="news" property="creatorName"/>&nbsp;(<vkc:write name="news" property="creatorFirstname"/>&nbsp;<vkc:write name="news" property="creatorLastname"/>)&nbsp;<b><vkc:message key="vkc.news.at"/></b>&nbsp;<vkc:write name="news" property="created" formatKey="date.medium.format"/><b>]</b></td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td width="1%" nowrap="nowrap" valign="top"><b><vkc:message key="vkc.news.newstext"/>:</b>&nbsp;</td>
          <td width="99%">
          <logic:equal name="form" property="tinyMCECompatible" value="true">
          <vkc:write name="news" property="newsText" displayAsHTML="true" renderNewLine="true"/>
          </logic:equal>
          <logic:equal name="form" property="tinyMCECompatible" value="false">
          <vkc:write name="news" property="newsText" stripHTML="true" renderNewLine="true"/>
          </logic:equal>
          </td>
        </tr>
        <tr>
          <td width="1%" nowrap="nowrap"><b><vkc:message key="vkc.news.infourl"/>:</b>&nbsp;</td>
          <td width="99%"><a href="<vkc:write name='news' property='infoUrl'/>" target="_blank"><vkc:write name="news" property="infoUrl"/></a></td>
        </tr>
        <logic:notEmpty name="news" property="validFrom">
        <tr>
          <td width="1%" nowrap="nowrap"><b><vkc:message key="vkc.news.validFrom"/>:</b>&nbsp;</td>
          <td width="99%"><vkc:write name="news" property="validFrom" formatKey="date.medium.format"/></td>
        </tr>
        </logic:notEmpty>
        <logic:notEmpty name="news" property="validUntil">
        <tr>
          <td width="1%" nowrap="nowrap"><b><vkc:message key="vkc.news.validUntil"/>:</b>&nbsp;</td>
          <td width="99%"><vkc:write name="news" property="validUntil" formatKey="date.medium.format"/></td>
        </tr>
        </logic:notEmpty>
      </table>
	</td>
  </tr>
  </logic:equal>

  <logic:equal name="news" property="valid" value="false">
  <logic:equal name="form" property="considerValidNewsOnly" value="false">
  <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" width="20" height="20" border="0" alt=""/></td></tr>
  <tr> 
	<td>  
      <table cellspacing="3" cellpadding="0" border="0" width="100%">
        <tr>
          <td colspan="2">
            <table cellspacing="0" cellpadding="0" border="0" width="100%">
              <tr class="headerSelected">
                <td width="99%"><font style="color:#aaaaaa" ><b><vkc:write name="news" property="headline"/></b></font></td>
                <td align="right" width="1%"><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" height="24" width="1"/></td>
                <td align="right" nowrap><font style="color:#aaaaaa" ><b>[<vkc:message key="vkc.news.creator"/></b>&nbsp;<vkc:write name="news" property="creatorName"/>&nbsp;(<vkc:write name="news" property="creatorFirstname"/>&nbsp;<vkc:write name="news" property="creatorLastname"/>)&nbsp;<b><vkc:message key="vkc.news.at"/></b>&nbsp;<vkc:write name="news" property="created" formatKey="date.medium.format"/><b>]</b></font></td>
              </tr>
            </table>
          </td>
        </tr>
        <tr>
          <td width="1%" nowrap="nowrap" valign="top"><font style="color:#aaaaaa" ><b><vkc:message key="vkc.news.newstext"/>:</b>&nbsp;</font></td>
          <td width="99%">
          <font style="color:#aaaaaa" >
          <logic:equal name="form" property="tinyMCECompatible" value="true">
          <vkc:write name="news" property="newsText" displayAsHTML="true" renderNewLine="true"/>
          </logic:equal>
          <logic:equal name="form" property="tinyMCECompatible" value="false">
          <vkc:write name="news" property="newsText" stripHTML="true" renderNewLine="true"/>
          </logic:equal>
          </font>
          </td>
        </tr>
        <tr>
          <td width="1%" nowrap="nowrap"><font style="color:#aaaaaa" ><b><vkc:message key="vkc.news.infourl"/>:</b>&nbsp;</font></td>
          <td width="99%"><a href="<vkc:write name='news' property='infoUrl'/>" target="_blank"><font style="color:#aaaaaa" ><vkc:write name="news" property="infoUrl"/></font></a></td>
        </tr>
        <logic:notEmpty name="news" property="validFrom">
        <tr>
          <td width="1%" nowrap="nowrap"><font style="color:#aaaaaa" ><b><vkc:message key="vkc.news.validFrom"/>:</b>&nbsp;</font></td>
          <td width="99%"><font style="color:#aaaaaa" ><vkc:write name="news" property="validFrom" formatKey="date.medium.format"/></font></td>
        </tr>
        </logic:notEmpty>
        <logic:notEmpty name="news" property="validUntil">
        <tr>
          <td width="1%" nowrap="nowrap"><font style="color:#aaaaaa" ><b><vkc:message key="vkc.news.validUntil"/>:</b>&nbsp;</font></td>
          <td width="99%"><font style="color:#aaaaaa" ><vkc:write name="news" property="validUntil" formatKey="date.medium.format"/></font></td>
        </tr>
        </logic:notEmpty>
      </table>
	</td>
  </tr>
  </logic:equal>
  </logic:equal>

  </logic:iterate>
  </logic:notEmpty>
  
  <logic:empty name="form" property="news">
  <tr><td>&nbsp;</td></tr>
  <tr><td width="100%" align="center"><b><vkc:message key="vkc.news.nonews"/></b></td></tr>
  </logic:empty>
  
  </html:form>
</table>
</body>
</html:html>
