<%@ page language="java" buffer="100kb" errorPage="/common/error.jsp"%>

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

<%@ 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>
	<vkc:cssinclude />
    <meta http-equiv="content-type"  content="text/html; charset=iso-8859-1" />
    <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">
    window.name = "MAINVIEW";
    var aclform = null;
    var associatedTabId = <%=TabId.LICENSE_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.LICENSE_TAB%>"
          						   + "&lastCategoryId=" + tabViewForm.lastCategoryId.value
          						   + "&lastFunctionalId=" + tabViewForm.lastFunctionalId.value
          						   + "&lastProjectId=" + tabViewForm.lastProjectId.value);
        }
       
		setAnchor();
	}
	
    function setAnchor() {
        <logic:present parameter="anchor">
        <bean:parameter id="anchor2" name="anchor"/>
        this.location.hash = '<%=anchor2%>';
        </logic:present>
    }
    </script>
</head>
<body onload="init();" topmargin="0" marginheight="0">
<table cellspacing="0" cellpadding="0" border="0" width="100%">
  <html:form action="/userLicense" method="post">
  <bean:define id="form" name="userLicenseForm" scope="request" type="vkc.view.form.UserLicenseForm" />

  <logic:notEmpty name="form" property="licenses">
  <logic:iterate id="license" name="form" property="licenses" type="vkc.db.entities.VKCLicense">
  <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" width="20" height="20" border="0" alt="" /></td></tr>

  <logic:equal name="license" property="valid" value="true">
  <tr>
    <td nowrap="nowrap"><b><vkc:message key="vkc.user.license.accepted" />:</b></td>
    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" width="10"  border="0" alt="" /></td>
    <td><vkc:write name="license" property="accepted" formatKey="date.medium.format"/></td>
  </tr>
  <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" width="10" height="10" border="0" alt="" /></td></tr>
  <tr >
    <td nowrap="nowrap" valign="top"><b><vkc:message key="vkc.user.license.terms" />:</b>&nbsp;</td>
    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" width="10"  border="0" alt="" /></td>
    <td width="100%" valign="top" class="color_doctitle">
      <logic:equal name="form" property="tinyMCECompatible" value="true">
      <vkc:write name="license" property='<%="license[" + user.getLanguage().getLanguageId() + "]"%>' displayAsHTML="true" renderNewLine="true" />
      </logic:equal>
      <logic:equal name="form" property="tinyMCECompatible" value="false">
      <vkc:write name="license" property='<%="license[" + user.getLanguage().getLanguageId() + "]"%>' stripHTML="true" renderNewLine="true" />
      </logic:equal>
    </td>
  </td>
  </tr>
  </logic:equal>
  
  <logic:equal name="license" property="valid" value="false">
  <tr>
    <td nowrap="nowrap" style="color:#aaaaaa"><b><vkc:message key="vkc.user.license.accepted" />:</b></td>
    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" width="10"  border="0" alt="" /></td>
    <td style="color:#aaaaaa"><vkc:write name="license" property="accepted" formatKey="date.medium.format"/></td>
  </tr>
  <tr><td><vkc:img page="/templates/${template.name}/gfx/trans.gif" width="10" height="10" border="0" alt="" /></td></tr>
  <tr >
    <td nowrap="nowrap" valign="top" style="color:#aaaaaa"><b><vkc:message key="vkc.user.license.terms" />:</b>&nbsp;</td>
    <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" width="10"  border="0" alt="" /></td>
    <td width="100%" valign="top" class="color_doctitle" style="color:#aaaaaa">
      <logic:equal name="form" property="tinyMCECompatible" value="true">
      <vkc:write name="license" property='<%="license[" + user.getLanguage().getLanguageId() + "]"%>' displayAsHTML="true" renderNewLine="true" />
      </logic:equal>
      <logic:equal name="form" property="tinyMCECompatible" value="false">
      <vkc:write name="license" property='<%="license[" + user.getLanguage().getLanguageId() + "]"%>' stripHTML="true" renderNewLine="true" />
      </logic:equal>
    </td>
	</td>
  </tr>
  </logic:equal>
  </logic:iterate>
  </logic:notEmpty>
  
  <logic:empty name="form" property="licenses">
  <tr>
	<td valign="top"><b><vkc:message key="vkc.user.license.nolicense" /></b></td>
  </tr>
  </logic:empty>
  </html:form>
</table>
</body>
</html:html>
