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

<vkc:checkLogin />
<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" src="<vkc:rewrite page='/common/calendar.js'/>"></script>
    <script type="text/javascript" src="<vkc:rewrite page='/common/tiny_mce/tiny_mce.js'/>"></script>

    <script type="text/javascript">

    window.name = "MAINVIEW";
	initTinyMCE("<vkc:write name='user' property='language.shortName'/>", "<vkc:rewrite page='/templates/${template.name}/tiny_mce.css'/>");
    var currentCalendar = null;

    function toggleTinyMCEToolbar() {
        var form = document.forms[0];
    	<logic:equal name="editNewsForm" property="showTinyMCEToolbar" value="true">
    	form.showTinyMCEToolbar.value = 'false';
    	</logic:equal>
    	<logic:equal name="editNewsForm" property="showTinyMCEToolbar" value="false">
    	form.showTinyMCEToolbar.value = 'true';
    	</logic:equal>
        
        if (form.action.indexOf('?') == -1) {
          form.action = form.action + "?action.toggle.tinymcetoolbar=true";
        } else {
          form.action = form.action + "&action.toggle.tinymcetoolbar=true";
        }
        
        form.submit();
    }

    function unloadPage() {
        if ( currentCalendar!=null ) {
              hideCalendar();
        }
    }

    </script>

</head>

<body onUnload="unloadPage();" topmargin="0" marginheight="0">
<table cellspacing="3" cellpadding="0" border="0" width="100%">
  <tr>
    <td width="1%" nowrap="nowrap"><b><vkc:message key="vkc.administration.news.editnews"/></b></td>
    <td width="99%" align="right" nowrap="nowrap" align="right">&nbsp;<vkc:message key="mandatory.field1"/>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/>&nbsp;<vkc:message key="mandatory.field2"/></td>
  </tr>
</table>

<vkc:hline bottomSpace="5" topSpace="5" colspan="2" lineClass="hline" lineHeight="1"/>

<table cellspacing="3" cellpadding="0" border="0" width="100%">
  <html:form action="/editNews" method="post">
  <bean:define id="form" name="editNewsForm" scope="request" type="vkc.administration.form.EditNewsForm"/>

  <html:hidden property="newsId"/>
  <vkc:hidden property="showTinyMCEToolbar"/>

  <logic:equal name="form" property="tinyMCECompatible" value="true">
  <logic:equal name="form" property="showTinyMCEToolbar" value="false">
  <style type="text/css">
  .mceToolbar {
      display:none;
  }
  </style>
  </logic:equal>
  </logic:equal>

  <tr>
    <td width="1%" nowrap="nowrap"><b><vkc:message key="vkc.administration.news.headline"/>:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
    <td width="99%"><vkc:text name="form" property="headline" style="width:100%;"/></td>
  </tr>
  <tr><td></td><td><b><font color="#ff0000"><vkc:errors property="headline"/></font></b></td></tr>
  <tr>
    <td width="1%" nowrap="nowrap" valign="top"><b><vkc:message key="vkc.administration.news.newstext"/>:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
    <td width="99%">
      <logic:equal name="form" property="tinyMCECompatible" value="true">
      <logic:equal name="form" property="showTinyMCEToolbar" value="true">
	  <vkc:link href="javascript:toggleTinyMCEToolbar();"><vkc:img page="/templates/${template.name}/gfx/minus-big.gif" border="0" titleKey="vkc.string.htmleditor"/></vkc:link>
      </logic:equal>
      <logic:equal name="form" property="showTinyMCEToolbar" value="false">
	  <vkc:link href="javascript:toggleTinyMCEToolbar();"><vkc:img page="/templates/${template.name}/gfx/plus-big.gif" border="0" titleKey="vkc.string.htmleditor"/></vkc:link>
      </logic:equal>
      </logic:equal>
      <vkc:textarea name="form" property="newsText" style="width:100%;" cols="57" rows="10"/>
    </td>
  </tr>
  <tr><td></td><td><b><font color="#ff0000"><vkc:errors property="newstext"/></font></b></td></tr>

  <vkc:hline bottomSpace="5" topSpace="0" colspan="2" lineClass="hline" lineHeight="1"/>

  <tr>
    <td width="1%" nowrap="nowrap"><b><vkc:message key="vkc.administration.news.infourl"/>:</b></td>
    <td width="99%"><html:text name="form" property="infoUrl" style="width:100%;"/></td>
  </tr>
  <tr><td></td><td><b><font color="#ff0000"><vkc:errors property="url"/></font></b></td></tr>

  <vkc:hline bottomSpace="5" topSpace="0" colspan="2" lineClass="hline" lineHeight="1"/>

  <tr>
    <td width="1%" nowrap="nowrap"><b><vkc:message key="vkc.administration.news.validfrom"/>:</b></td>
    <td width="99%">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><html:text name="form" property="validFrom" maxlength="10" size="10" styleClass="dateField"/></td>
          <td><vkc:calendarbutton buttonName="btn_validFrom" /></td>
          <td>&nbsp;<vkc:message key="vkc.date_format"/></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr><td></td><td><b><font color="#ff0000"><vkc:errors property="validfrom"/></font></b></td></tr>
  <tr>
    <td width="1%" nowrap="nowrap"><b><vkc:message key="vkc.administration.news.validuntil"/>:</b></td>
    <td width="99%">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><html:text name="form" property="validUntil" maxlength="10" size="10" styleClass="dateField"/></td>
          <td><vkc:calendarbutton buttonName="btn_validUntil" /></td>
          <td>&nbsp;<vkc:message key="vkc.date_format"/></td>
        </tr>
      </table>
    </td>
  </tr>
  <tr><td></td><td><b><font color="#ff0000"><vkc:errors property="validuntil"/></font></b></td></tr>
  <tr><td></td><td><b><font color="#ff0000"><vkc:errors property="daterange"/></font></b></td></tr>

  <vkc:hline bottomSpace="5" topSpace="0" colspan="2" lineClass="hline" lineHeight="1"/>

  <tr>
    <td colspan="2" align="center">
      <vkc:button property="action.save.news" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="button.save"/></vkc:button>
      <vkc:button property="action.back" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="button.back"/></vkc:button>
    </td>
  </tr>
  </html:form>
</table>
</body>
</html:html>
