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

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

<%@ page import="vkc.db.entities.VKCDocument" %>

<vkc:init/>
<html:html locale="true">
<head>

    <meta http-equiv="content-type"  content="text/html; charset=iso-8859-1" />
    <meta http-equiv="cache-control" content="no-cache" />
    <meta http-equiv="pragma"        content="no-cache" />
    <meta http-equiv="expires"       content="0" />

    <vkc:cssinclude />

    <script type="text/javascript" src="<vkc:rewrite page='/common/calendar.js'/>"></script>
    <script type="text/javascript" src="<vkc:rewrite page='/common/utils.js'   />"></script>
    <script type="text/javascript" src="<vkc:rewrite page='/common/overlib/overlib.js'/>"><!-- overLIB (c) Erik Bosrup --></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 init(){
        setAnchor();
    }

    function setAnchor() {
        <logic:present parameter="anchor">
            <bean:parameter id="anchor2" name="anchor"/>
            this.location.hash = '<%=anchor2%>';
        </logic:present>
    }

    function deleteAttribute( index ) {
        var form = document.forms[0];
        form.selectedIndex.value = index;
        return true;
    }

    function unloadPage() {
        if ( currentCalendar != null ) {
              hideCalendar();
        }
    }
	
	function editText(elem) {
        if (document.getElementById) {
	        while (document.getElementById("documentDescription").value.search(/\r\n/)!=-1 
	             || document.getElementById("documentDescription").value.search(/\r/)!=-1 
	             || document.getElementById("documentDescription").value.search(/\n/)!=-1) {
			    if (document.getElementById("documentDescription").value.search(/\r\n/)!= -1) {
			        document.getElementById("documentDescription").value = document.getElementById("documentDescription").value.replace(/\r\n/," ");
			    } else {
			 		if (document.getElementById("documentDescription").value.search(/\r/)!=-1) {
			 		    document.getElementById("documentDescription").value = document.getElementById("documentDescription").value.replace(/\r/," ");
			 		}
			 		
			 		if (document.getElementById("documentDescription").value.search(/\n/) != -1) {
			 		    document.getElementById("documentDescription").value = document.getElementById("documentDescription").value.replace(/\n/," ");
			 		}
			 	}
		    }
        }
	}
	
    function showHelpText() {
    	var text = '<vkc:message javascript="true" filter="false" key="vkc.keywords.help"/>';
        
        return overlib( text, STICKY, MOUSEOFF, WIDTH, 200, OFFSETX, 30, OFFSETY, -10, RIGHT );
    }

    function toggleTinyMCEToolbar() {
        var form = document.forms[0];
    	<logic:equal name="editDocumentForm" property="showTinyMCEToolbar" value="true">
    	form.showTinyMCEToolbar.value = 'false';
    	</logic:equal>
    	<logic:equal name="editDocumentForm" 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();
    }

    </script>

</head>

<body onload="init();" onUnload="unloadPage();" marginwidth="5" marginheight="0" topmargin="0" bottommargin="5" leftmargin="5" rightmargin="5">
<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
<table width="100%" cellspacing="5" cellpadding="0" border="0">
  <logic:present name="<%=org.apache.struts.Globals.ERROR_KEY%>">
  <html:messages id="error" message="false">
  <tr><td align="left" nowrap="nowrap" colspan="2"><span class="error"><b><vkc:write name="error"/></b></span></td></tr>
  </html:messages>
  <tr><td colspan="2"><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" height="5" border="0"/></td></tr>
  </logic:present>

  <html:form action="/editDocument" method="post">

  <bean:define id="form" name="editDocumentForm"/>

  <html:hidden property="documentId"    name="form"/>
  <html:hidden property="selectedIndex" name="form" value="-1"/>
  <html:hidden property="sourcePageId"  name="form"/>
  <logic:notEmpty name="form" property="targetId">
    <html:hidden property="targetId"    name="form"/>
  </logic:notEmpty>
  <logic:notEmpty name="form" property="subTargetId">
    <html:hidden property="subTargetId" name="form"/>
  </logic:notEmpty>

  <vkc:hidden property="showTinyMCEToolbar"/>

  <logic:notEmpty name="form" property="document">
  <logic:notEmpty property="documentCategory" name="form">
  <bean:define id="document" name="form" property="document"/>
  <tr>
    <td width="100%" align="left" colspan="2">
      <table width="100%" cellpadding="0" cellspacing="0">
        <tr>
          <td align="left" nowrap="nowrap" colspan="1"><b><vkc:message key="vkc.dialog.editdocument"/>:</b></td>
          <td align="right" nowrap="nowrap" colspan="1">&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>
    </td>
  </tr>

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

	<vkc:hasAdminPrivileges>	  
    <tr>
	  <td colspan="2">
        <table border="0" width="100%">
		  <tr>
	        <td align="left"><small><b><vkc:message key="vkc.publisher"/>:</b></small></td>
	        <td align="left"><small><vkc:write name="form" property="document.publisherName" /></small></td>
	        <td align="left"><small><b><vkc:message key="vkc.lastchanger"/>:</b></small></td>
	        <td align="left"><small><vkc:write name="form" property="document.lastChangerName" /></small></td>
	        <td align="left"><small><b><vkc:message key="vkc.lastaccessor"/>:</b></small></td>
	        <td align="left"><small><vkc:write name="form" property="document.lastAccessorName" /></small></td>
		  </tr>
		  <tr>
		    <td align="left"><small><b><vkc:message key="vkc.published"/>:</b></small></td>
		    <td align="left"><small><vkc:write name="form" property="document.published" formatKey="date.medium.format" /></small></td>
		    <td align="left"><small><b><vkc:message key="vkc.lastchanged"/>:</b></small></td>
		    <td align="left"><small><vkc:write name="form" property="document.lastChanged" formatKey="date.medium.format" /></small></td>
		    <td align="left"><small><b><vkc:message key="vkc.lastaccessed"/>:</b></small></td>
		    <td align="left"><small><vkc:write name="form" property="document.lastAccessed" formatKey="date.medium.format" /></small></td>
		  </tr>
	    </table>
	  </td>
	</tr>
	<vkc:hline bottomSpace="0" topSpace="0" colspan="2" lineClass="hline" lineHeight="1"/>
	</vkc:hasAdminPrivileges>
  
  <tr>
    <td nowrap="nowrap"><b><vkc:message key="vkc.category"/>:</b></td>
    <td colspan="1">
      <table cellpadding="0" cellspacing="0">
        <tr>
          <td>
            <logic:iterate id="pathdescr" name="form" property="document.category.absPathDescr.pathNodes" indexId="index">
            <logic:greaterThan name="index" value="0">
            <span dir="ltr">
            <vkc:img page="/templates/${template.name}/gfx/dot.gif" border="0" alt=""/>
            </span>
            </logic:greaterThan>

            <logic:equal value="true" name="pathdescr" property="lastNode">
            <span dir="ltr">
            <b><vkc:write name="pathdescr" property="pathName"/></b>
            </span>
            </logic:equal>

            <logic:equal value="false" name="pathdescr" property="lastNode">
            <span dir="ltr">
            <vkc:write name="pathdescr" property="pathName"/>
            </span>
            </logic:equal>
            </logic:iterate>
          </td>
        </tr>
      </table>
    </td>
  </tr>
  
  <vkc:hline bottomSpace="0" topSpace="0" colspan="2" lineClass="hline" lineHeight="1"/>
  
  <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>

  <logic:equal name="form" property="document.file" value="true">
  <%-- Behandlung von normalen Dateien --%>
  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.file"/>:</b></td>
    <td width="100%" align="left"><vkc:write name="document" property="name"/></td>
  </tr>

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.filetype"/>:</b></td>
    <td width="100%" align="left"><vkc:write name="document" property="documentType.extension"/></td>
  </tr>

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.author"/>:</b></td>
    <td width="100%" align="left"><vkc:text name="form" property="documentAuthorName" style="width:100%;" maxlengthProperty="document.authorname"/></td>
  </tr>

  <logic:equal name="categorySettings" property="showCreationDate" value="true">
  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.creationdate"/>:</b></td>
    <td width="100%" align="left">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><html:text property="creationDate" maxlength="10" size="10" styleClass="dateField"/></td>
          <td><vkc:calendarbutton buttonName="btn_creationDate" /></td>
          <td>&nbsp;[<vkc:message key="vkc.profile.date_format"/>]</td>
        </tr>
      </table>
    </td>
  </tr>
  </logic:equal>

  <logic:equal name="categorySettings" property="showDocumentClass" value="true">
  <logic:notEmpty name="form" property="documentClasses">
  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.class"/>:</b></td>
    <td width="100%" align="left" nowrap="nowrap">
      <html:select property="documentClassId">
        <logic:iterate id="documentClass" name="form" property="documentClasses" type="vkc.db.entities.VKCDocumentClass">
        <html:option value="<%=String.valueOf( documentClass.getDocClassId() )%>"><vkc:message name="documentClass" property="nameKey"/></html:option>
        </logic:iterate>
      </html:select>
    </td>
  </tr>
  </logic:notEmpty>
  </logic:equal>

  <logic:equal name="categorySettings" property="showDocumentStatus" value="true">
  <logic:notEmpty name="form" property="documentStati">
  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.status"/>:</b></td>
    <td width="100%" align="left" nowrap="nowrap">
      <html:select name="form" property="documentStatus" size="1">
        <logic:iterate id="status" name="form" property="documentStati" type="vkc.db.entities.VKCDocumentStatus">
        <html:option value="<%=String.valueOf( status.getStatus() )%>"><vkc:message name="status" property="descriptionKey"/></html:option>
        </logic:iterate>
      </html:select>
    </td>
  </tr>
  </logic:notEmpty>
  </logic:equal>

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.versiondescr"/>:</b></td>
    <td width="100%" align="left"><vkc:text name="form" property="versionDescription" style="width:100%;" maxlengthProperty="document.versiondesc"/></td>
  </tr>

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.label"/>:</b></td>
    <td width="100%" align="left">
      <table cellpadding="0" cellspacing="0">
        <tr>
          <td><vkc:text name="form" property="versionHigh" size="3" styleClass="monospaced"/></td>
          <td valign="bottom" >&nbsp;.&nbsp;</td>
          <td><vkc:text name="form" property="versionLow" size="3" styleClass="monospaced"/></td>
        </tr>
      </table>
    </td>
  </tr>

  <vkc:hline bottomSpace="0" topSpace="0" colspan="2" lineClass="hline" lineHeight="1"/>
  <tr>
	<td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.generate"/>:</b></td>
	<td width="100%" align="left" colspan="1">
	  <table cellpadding="0" cellspacing="0" border="0">
		<tr>
		  <td><html:checkbox property="autoTitle"/></td>
		  <td align="left" nowrap="nowrap"><vkc:message key="sysparam.context.document.enabledocumenttitle"/>&nbsp;&nbsp;&nbsp;</td>
		  <td><html:checkbox property="autoKeyword"/></td>
		  <td align="left" nowrap="nowrap"><vkc:message key="sysparam.context.document.enabledocumentkeyword"/>&nbsp;&nbsp;&nbsp;</td>
		  <td><html:checkbox property="autoDescription"/></td>
		  <td align="left" nowrap="nowrap"><vkc:message key="sysparam.context.document.enabledocumentdescription"/>&nbsp;&nbsp;&nbsp;</td>
          <logic:notEqual name="form" property="document.note" value="true">
          <!-- if document is of type note, do not offer analyse button -->  
          <td>&nbsp;</td>
          <td>
            <vkc:button property="action.analyse" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="button.analyse" /></vkc:button>
          </td>     
          </logic:notEqual>
		</tr>
	  </table>
	</td>
  </tr>

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.title"/>:&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></b></td>
    <td width="100%" align="left"><vkc:text name="form" property="documentTitle" style="width:100%;" maxlengthProperty="document.title"/></td>
  </tr>

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.keywords"/>:</b></td>
    <td width="100%" align="left"><vkc:text name="form" property="documentKeywords" style="width:100%;" maxlengthProperty="document.keywords" onfocus="return showHelpText();" onblur="return nd();"/></td>
  </tr>

  <tr>
    <td align="left" valign="top" nowrap="nowrap"><b><vkc:message key="vkc.description"/>:</b></td>
    <td width="100%" align="left">
   	  <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 rows="7" style="width:100%;" property="documentDescription" styleId="documentDescription"/>
    </td>
  </tr>
  </logic:equal>

  <logic:equal name="form" property="document.link" value="true">
  <%-- Behandlung von Links --%>
  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.link"/>:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
    <td width="100%" align="left" nowrap="nowrap"><vkc:write name="document" property="name"/></td>
  </tr>

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.author"/>:</b></td>
    <td width="100%" align="left"><vkc:text name="form" property="documentAuthorName" style="width:100%;" maxlengthProperty="document.authorname"/></td>
  </tr>

  <logic:equal name="categorySettings" property="showDocumentClass" value="true">
  <logic:notEmpty name="form" property="documentClasses">
  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.class"/>:</b></td>
    <td width="100%" align="left" nowrap="nowrap">
      <html:select property="documentClassId">
        <logic:iterate id="documentClass" name="form" property="documentClasses" type="vkc.db.entities.VKCDocumentClass">
        <html:option value="<%=String.valueOf( documentClass.getDocClassId() )%>"><vkc:message name="documentClass" property="nameKey"/></html:option>
        </logic:iterate>
      </html:select>
    </td>
  </tr>
  </logic:notEmpty>
  </logic:equal>

  <logic:equal name="categorySettings" property="showDocumentStatus" value="true">
  <logic:notEmpty name="form" property="documentStati">
  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.status"/>:</b></td>
    <td width="100%" align="left" nowrap="nowrap">
      <html:select name="form" property="documentStatus" size="1">
        <logic:iterate id="status" name="form" property="documentStati" type="vkc.db.entities.VKCDocumentStatus">
        <html:option value="<%=String.valueOf( status.getStatus() )%>"><vkc:message name="status" property="descriptionKey"/></html:option>
        </logic:iterate>
      </html:select>
    </td>
  </tr>
  </logic:notEmpty>
  </logic:equal>

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.versiondescr"/>:</b></td>
    <td width="100%" align="left"><vkc:text name="form" property="versionDescription" style="width:100%;" maxlengthProperty="document.versiondesc"/></td>
  </tr>

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.label"/>:</b></td>
    <td width="100%" align="left">
      <table cellpadding="0" cellspacing="0">
        <tr>
          <td><vkc:text name="form" property="versionHigh" size="3" styleClass="monospaced"/></td>
          <td valign="bottom" >&nbsp;.&nbsp;</td>
          <td><vkc:text name="form" property="versionLow" size="3" styleClass="monospaced"/></td>
        </tr>
      </table>
    </td>
  </tr>

  <vkc:hline bottomSpace="0" topSpace="0" colspan="2" lineClass="hline" lineHeight="1"/>
  <tr>
	<td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.generate"/>:</b></td>
	<td width="100%" align="left" colspan="1">
	  <table cellpadding="0" cellspacing="0" border="0">
		<tr>
		  <td><html:checkbox property="autoTitle"/></td>
		  <td align="left" nowrap="nowrap"><vkc:message key="sysparam.context.document.enabledocumenttitle"/>&nbsp;&nbsp;&nbsp;</td>
		  <td><html:checkbox property="autoKeyword"/></td>
		  <td align="left" nowrap="nowrap"><vkc:message key="sysparam.context.document.enabledocumentkeyword"/>&nbsp;&nbsp;&nbsp;</td>
		  <td><html:checkbox property="autoDescription"/></td>
		  <td align="left" nowrap="nowrap"><vkc:message key="sysparam.context.document.enabledocumentdescription"/>&nbsp;&nbsp;&nbsp;</td>
          <logic:notEqual name="form" property="document.note" value="true">
          <td>&nbsp;</td>
          <td>
            <vkc:button property="action.analyse" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="button.analyse" /></vkc:button>
          </td>
          </logic:notEqual>
		</tr>
	  </table>
	</td>
  </tr>

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.title"/>:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
    <td width="100%" align="left"><vkc:text name="form" property="documentTitle" style="width:100%;" maxlengthProperty="document.title"/></td>
  </tr>

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.keywords"/>:</b></td>
    <td width="100%" align="left"><vkc:text name="form" property="documentKeywords" style="width:100%;" maxlengthProperty="document.keywords" onfocus="return showHelpText();" onblur="return nd();"/></td>
  </tr>

  <tr>
    <td align="left" valign="top" nowrap="nowrap"><b><vkc:message key="vkc.description"/>:</b></td>
    <td width="100%" align="left">
   	  <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 rows="7" style="width:100%;" property="documentDescription" styleId="documentDescription"/>
    </td>
  </tr>
  </logic:equal>

  <logic:equal name="form" property="document.note" value="true">
  <%-- Behandlung von Notizen --%>
  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.author"/>:</b></td>
    <td width="100%" align="left"><vkc:text name="form" property="documentAuthorName" style="width:100%;" maxlengthProperty="document.authorname"/></td>
  </tr>

  <logic:equal name="categorySettings" property="showDocumentClass" value="true">
  <logic:notEmpty name="form" property="documentClasses">
  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.class"/>:</b></td>
    <td width="100%" align="left" nowrap="nowrap">
      <html:select property="documentClassId">
        <logic:iterate id="documentClass" name="form" property="documentClasses" type="vkc.db.entities.VKCDocumentClass">
        <html:option value="<%=String.valueOf( documentClass.getDocClassId() )%>"><vkc:message name="documentClass" property="nameKey"/></html:option>
        </logic:iterate>
      </html:select>
    </td>
  </tr>
  </logic:notEmpty>
  </logic:equal>

  <logic:equal name="categorySettings" property="showDocumentStatus" value="true">
  <logic:notEmpty name="form" property="documentStati">
  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.status"/>:</b></td>
    <td width="100%" align="left" nowrap="nowrap">
      <html:select name="form" property="documentStatus" size="1">
        <logic:iterate id="status" name="form" property="documentStati" type="vkc.db.entities.VKCDocumentStatus">
        <html:option value="<%=String.valueOf( status.getStatus() )%>"><vkc:message name="status" property="descriptionKey"/></html:option>
        </logic:iterate>
      </html:select>
    </td>
  </tr>
  </logic:notEmpty>
  </logic:equal>

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.versiondescr"/>:</b></td>
    <td width="100%" align="left"><vkc:text name="form" property="versionDescription" style="width:100%;" maxlengthProperty="document.versiondesc"/></td>
  </tr>

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.label"/>:</b></td>
    <td width="100%" align="left">
      <table cellpadding="0" cellspacing="0">
        <tr>
          <td><vkc:text name="form" property="versionHigh" size="3" styleClass="monospaced"/></td>
          <td valign="bottom" >&nbsp;.&nbsp;</td>
          <td><vkc:text name="form" property="versionLow" size="3" styleClass="monospaced"/></td>
        </tr>
      </table>
    </td>
  </tr>

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

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.title"/>:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
    <td width="100%" align="left"><vkc:text name="form" property="documentTitle" style="width:100%;" maxlengthProperty="document.title"/></td>
  </tr>

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.keywords"/>:</b></td>
    <td width="100%" align="left"><vkc:text name="form" property="documentKeywords" style="width:100%;" maxlengthProperty="document.keywords" onfocus="return showHelpText();" onblur="return nd();"/></td>
  </tr>

  <tr>
    <td align="left" valign="top" nowrap="nowrap"><b><vkc:message key="vkc.description"/>:</b></td>
    <td width="100%" align="left">
   	  <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 rows="7" style="width:100%;" property="documentDescription" styleId="documentDescription"/>
    </td>
  </tr>
  </logic:equal>

  <logic:equal name="form" property="tinyMCECompatible" value="false">
  <tr>
	<td align="left" nowrap="nowrap" valign="top"><b>&nbsp;</b></td>
    <td width="100%" align="right" nowrap="nowrap" valign="top"><vkc:button property="action.editText" onclick="javascript:editText(this);"><vkc:message key='button.format'/></vkc:button></td>
  </tr>
  </logic:equal>

  <logic:equal name="form" property="document.flag" value="<%=String.valueOf( VKCDocument.FLAG_TOBEPUBLISHED )%>">
  <vkc:hline bottomSpace="0" topSpace="0" colspan="2" lineClass="hline" lineHeight="1"/>

  <tr>
    <td align="left" nowrap><b><vkc:message key="vkc.document.publish"/>:</b></td>
    <td width="100%" align="left">
       <table cellpadding="0" cellspacing="0" border="0">
         <tr>
           <td><html:text property="publishingDate" maxlength="10" size="10" styleClass="dateField"/></td>
           <td><vkc:calendarbutton buttonName="btn_publishingDate" /></td>
           <td>&nbsp;[<vkc:message key="vkc.profile.date_format"/>]</td>
         </tr>
       </table>
    </td>
  </tr>
  </logic:equal>	

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

  <tr>
    <td align="left" nowrap="nowrap"><b><vkc:message key="vkc.document.expires"/>:</b></td>
    <td width="100%" align="left">
      <table cellpadding="0" cellspacing="0" border="0">
        <tr>
          <td><html:text property="expirationDate" maxlength="10" size="10" styleClass="dateField"/></td>
          <td><vkc:calendarbutton buttonName="btn_expirationDate" /></td>
          <td>&nbsp;[<vkc:message key="vkc.profile.date_format"/>]</td>
        </tr>
      </table>
    </td>
  </tr>

  <logic:notEmpty name="form" property="addDocAttributes">
  <%-- Beginn Verwaltung globaler Attribute --%>
  <vkc:hline bottomSpace="0" topSpace="0" colspan="2" lineClass="hline" lineHeight="1"/>
  <logic:iterate id="fieldName" indexId="fieldCtr" name="form" property="addDocAttributeKeys" type="java.lang.String">
  <tr>
    <td align="left"><b><vkc:write name="form" property='<%= String.valueOf( "addDocAttributeName(" + fieldName + ")" ) %>'/>:</b><logic:equal name="form" property='<%= String.valueOf( "addDocAttributeAllowNull(" + fieldName + ")" ) %>' value="false">&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></logic:equal></td>
       <td align="left"><vkc:text name="form" property='<%= String.valueOf( "addDocAttributeValue(" + fieldName + ")" ) %>' style="width:100%;"/></td>
  </tr>
  </logic:iterate>
  </logic:notEmpty>

  <!-- Beginn - Verwaltung dynamischer Attribute -->
  <vkc:hline bottomSpace="0" topSpace="0" colspan="2" lineClass="hline" lineHeight="1"/>
  <tr>
    <td align="left" valign="top" nowrap="nowrap"><b><vkc:message key="vkc.string.dynaAttributes"/>:</b></td>

    <logic:empty name="form" property="dynaAttributes">
    <td width="100%" align="left"><vkc:button property="action.add.dynaattribute" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="button.addDynaAttribute"/></vkc:button></td>
    </logic:empty>

    <logic:notEmpty name="form" property="dynaAttributes">
    <td width="100%" align="left">
      <a name="dynaattributes"></a>
      <table width="100%" cellspacing="3" cellpadding="0" border="0">
        <tr>
          <td>&nbsp;</td>
          <td width="200" ><b><vkc:message key="vkc.string.name"/>:</b>&nbsp;<vkc:img page="/templates/${template.name}/gfx/mandatoryField.gif" alt="*" border="0"/></td>
          <td width="100%"><b><vkc:message key="vkc.string.value"/>:</b></td>
          <td>&nbsp;</td>
        </tr>

        <logic:iterate id="dynaAttribute" name="form" property="dynaAttributes" indexId="index">
        <tr>
          <td align="right"><b><%=String.valueOf( ( (Integer)index ).intValue() + 1 ) + "."%></b></td>
          <td align="left" nowrap="nowrap"><input type="text" name="dynaAttributeLabel_<%=index%>" value="<vkc:write name='dynaAttribute' property='label'/>" style="width:200px;"></td>
          <td width="100%" align="left"><input type="text" name="dynaAttributeValue_<%=index%>" value="<vkc:write name='dynaAttribute' property='value'/>" style="width:100%;"></td>
          <td align="left" ><vkc:image page="/templates/${template.name}/gfx/button-deletecategory.gif" property="action.delete.dynaattribute" onclick='<%= String.valueOf( "return deleteAttribute(" + index + ")" )%>' titleKey="vkc.document.remove.attribute"/></td>
        </tr>
        </logic:iterate>

        <tr>
          <td align="left" colspan="2"><vkc:button property="action.add.dynaattribute" onclick="javascript:disableAllButtonsAndSubmit(this);"><vkc:message key="button.addDynaAttribute"/></vkc:button></td>
        </tr>
      </table>
    </td>
    </logic:notEmpty>
  </tr>
  <!-- Ende - Verwaltung dynamischer Attribute -->

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

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