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

<%-- JSP-Seite gibt die Daten zu einem Dokument aus ( ohne Toolbar ) --%>

<bean:define id="document"   name="document" scope="request" type="vkc.db.entities.VKCDocument"/>
<bean:define id="documentId" name="document" property="documentId" type="java.lang.Integer"/>
<bean:define id="ctxPath"    name="ctxPath"  type="java.lang.String"/>
<bean:define id="user"       name="currentUser" type="vkc.db.entities.VKCUser"/>

<tr>
  <td>
    <table id='<%=request.getAttribute("rowId") != null ? documentId : new Integer(0)%>' cellspacing="5" cellpadding="0" width="100%" border="0">
      <colgroup><col/><col width="50%"/><col/><col width="50%"/></colgroup>
      <logic:present name="displayCategoryPath" scope="request">
        <logic:empty name="document" property="categoryPath">
        <tr valign="top">
          <td nowrap="nowrap"><b><vkc:message key="vkc.category"/>:</b></td>
          <td colspan="3">????</td>
        </tr>
        </logic:empty>

        <logic:notEmpty name="document" property="categoryPath">
        <bean:define id="absPathDescr" name="document"     property="categoryPath" />
        <bean:define id="pathNodes"    name="absPathDescr" property="pathNodes"    />
        <tr valign="top">
          <td nowrap="nowrap"><b><vkc:message key="vkc.category"/>:</b></td>
          <td colspan="3">
          <logic:iterate id="pathdescr" name="pathNodes" indexId="index" type="vkc.util.VKCCategoryPathNode">
            <logic:greaterThan name="index" value="0">
              <span dir="ltr">
              <vkc:img page="/templates/${template.name}/gfx/dot.gif" alt="" border="0"/>
              </span>
            </logic:greaterThan>
            <logic:equal name="pathdescr" property="lastNode" value="false" >
              <span dir="ltr">
              <vkc:write name="pathdescr" property="shortPathName"/>
              </span>
            </logic:equal>
            <logic:equal name="pathdescr" property="lastNode" value="true" >
              <logic:equal name="displayCategoryPath" value="true">
                <span dir="ltr">
                <b><vkc:link page="/showCategory.do" paramId="categoryId" paramName="document" paramProperty="categoryId" anchor='<%="doc" + documentId%>' title='<%=pathdescr.getPathName()%>'><vkc:write name="pathdescr" property="pathName"/></vkc:link></b>
                </span>
              </logic:equal>
              <logic:equal name="displayCategoryPath" value="false">
                <span dir="ltr">
                <b><vkc:write name="pathdescr" property="pathName"/></b>
                </span>
              </logic:equal>
            </logic:equal>
          </logic:iterate>
          </td>
        </tr>
        </logic:notEmpty>
      </logic:present>

      <logic:equal name="documentViewSettings" property="fileNameORFileFormat" value="true">
      <tr valign="top">
        <logic:equal name="documentViewSettings" property="fileName" value="true">
        <td nowrap="nowrap"><b><vkc:message key="vkc.document.type.file"/>:</b></td>
        <td nowrap="nowrap">
          <table align="left" valign="top" cellspacing="0" cellpadding="0" border="0">
            <tr valign="top">
              <td><vkc:displaydocument name="document" style="font-weight:normal;" target="_blank" ><vkc:write name="document" property="name"/></vkc:displaydocument></td>
	          <logic:notPresent name="refuseDocumentEditing" scope="request">
	          <logic:equal name="document" property="editable" value="true">
	          <vkc:hasPermission context="document" requiredPerm="w">
	          <script type="text/javascript">
	           var name = navigator.userAgent.toLowerCase()
						//InternetExplorer
			   var ie = (name.indexOf("msie")>-1)					  	
			   var opera = (name.indexOf("opera")>-1)			  	
			   if (ie && !opera){
	            document.write('<td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>');
	            document.write('<td><vkc:displaydocument name="document" editable="true" style="font-weight:normal;" target="_blank"><vkc:img page="/templates/${template.name}/gfx/editable.gif" border="0" titleKey="vkc.tooltip.documentedit"/></vkc:displaydocument></td>');
	          }
	          </script>
	          </vkc:hasPermission>
	          </logic:equal>
	          </logic:notPresent>
	          <logic:present name="displayWebDAVLink" scope="request">
	          <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5"/></td>
	          <td><a target="webdav" href="" FOLDER="<vkc:write name='category' property='webDAVPath'/><vkc:write name='document' property='name'/>"><vkc:img page="/templates/${template.name}/gfx/webfolder-document.gif" border="0" alt=""/></a></td>
	          </logic:present>
            </tr>
          </table>
        </td>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="fileName" value="false">
          <td colspan="2">&nbsp;</td>
        </logic:equal>

        <logic:equal name="documentViewSettings" property="fileFormat" value="true">
          <td nowrap="nowrap"><b><vkc:message key="vkc.document.type.fileformat"/>:</b></td>
          <td nowrap="nowrap"><vkc:write name="document" property="documentType.extension"/></td>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="fileFormat" value="false">
          <td colspan="2">&nbsp;</td>
        </logic:equal>
      </tr>
      </logic:equal>

      <logic:equal name="documentViewSettings" property="classTypeORFileSize" value="true">
      <tr valign="top">
        <logic:equal name="documentViewSettings" property="classType" value="true">
          <logic:equal name="categorySettings" property="showDocumentClass" value="true">
          <td nowrap="nowrap"><b><vkc:message key="vkc.document.class"/>:</b></td>
          <logic:notEmpty name="document" property="documentClass">
            <td nowrap="nowrap"><vkc:message name="document" property="documentClass.nameKey"/></td>
          </logic:notEmpty>
          <logic:empty name="document" property="documentClass">
            <td nowrap="nowrap">&nbsp;</td>
          </logic:empty>
          </logic:equal>
          <logic:equal name="categorySettings" property="showDocumentClass" value="false">
            <td colspan="2">&nbsp;</td>
          </logic:equal>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="classType" value="false">
          <td colspan="2">&nbsp;</td>
        </logic:equal>

        <logic:equal name="documentViewSettings" property="fileSize" value="true">
          <td nowrap="nowrap"><b><vkc:message key="vkc.document.type.filesize"/>:</b></td>
          <td nowrap="nowrap"><vkc:write name="document" property='<%= "formattedDocSize(" + user.getLanguageId() + ")" %>'/></td>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="fileSize" value="false">
          <td colspan="2">&nbsp;</td>
        </logic:equal>
      </tr>
      </logic:equal>

      <logic:equal name="documentViewSettings" property="versionNoORVersionLabel" value="true">
      <tr valign="top">
        <logic:equal name="documentViewSettings" property="versionNo" value="true">
          <td nowrap="nowrap"><b><vkc:message key="vkc.document.version"/>:</b></td>
          <td nowrap="nowrap"><vkc:write name="document" property="versionNo"/></td>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="versionNo" value="false">
          <td colspan="2">&nbsp;</td>
        </logic:equal>

        <logic:equal name="documentViewSettings" property="versionLabel" value="true">
          <td nowrap="nowrap"><b><vkc:message key="vkc.document.label"/>:</b></td>
          <td nowrap="nowrap"><vkc:write name="document" property="versionHigh"/>.<vkc:write name="document" property="versionLow"/></td>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="versionLabel" value="false">
          <td colspan="2">&nbsp;</td>
        </logic:equal>
      </tr>
      </logic:equal>

      <logic:equal name="documentViewSettings" property="versionDescrORExpires" value="true">
      <tr valign="top">
        <logic:equal name="documentViewSettings" property="versionDescr" value="true">
          <td nowrap="nowrap"><b><vkc:message key="vkc.document.versiondescr"/>:</b></td>
          <td nowrap="nowrap"><vkc:write name="document" property="versionDescr"/></td>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="versionDescr" value="false">
          <td colspan="2">&nbsp;</td>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="expires" value="true">
        <logic:notEmpty name="document" property="expires">
          <td nowrap="nowrap"><b><vkc:message key="vkc.document.expires"/>:</b></td>
          <td nowrap="nowrap"><vkc:write name="document" property="expires" formatKey="date.short.format"/></td>
        </logic:notEmpty>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="expires" value="false">
          <td colspan="2">&nbsp;</td>
        </logic:equal>
      </tr>
      </logic:equal>

      <logic:equal name="documentViewSettings" property="publishedORAuthor" value="true">
      <tr valign="top">
        <logic:equal name="documentViewSettings" property="published" value="true">
          <td nowrap="nowrap"><b><vkc:message key="vkc.published"/>:</b></td>
          <td nowrap="nowrap"><vkc:write name="document" property="published" formatKey="date.medium.format"/></td>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="published" value="false">
          <td colspan="2">&nbsp;</td>
        </logic:equal>

        <logic:equal name="documentViewSettings" property="author" value="true">
          <td nowrap="nowrap"><b><vkc:message key="vkc.author"/>:</b></td>
          <td nowrap="nowrap"><vkc:write name="document" property="authorName"/></td>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="author" value="false">
          <td colspan="2">&nbsp;</td>
        </logic:equal>
      </tr>
      </logic:equal>

      <logic:equal name="documentViewSettings" property="creationDateORPublisher" value="true">
      <tr valign="top">
        <logic:equal name="documentViewSettings" property="creationDate" value="true">
          <logic:equal name="categorySettings" property="showCreationDate" value="true">
          <td nowrap="nowrap"><b><vkc:message key="vkc.creationdate"/>:</b></td>
          <td nowrap="nowrap"><vkc:write name="document" property="creationDate" formatKey="date.medium.format"/></td>
          </logic:equal>
          <logic:equal name="categorySettings" property="showCreationDate" value="false">
          <td colspan="2">&nbsp;</td>
          </logic:equal>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="creationDate" value="false">
          <td colspan="2">&nbsp;</td>
        </logic:equal>

        <logic:equal name="documentViewSettings" property="publisher" value="true">
          <bean:define id="publisherId" name="document" property="publisherId" type="java.lang.Integer"/>
          <td nowrap="nowrap"><b><vkc:message key="vkc.publisher"/>:</b></td>
          <td nowrap="nowrap"><vkc:link href='<%="javascript:openUserInfoWindow(" + publisherId.intValue() + ");"%>' style='font-weight:normal;'><vkc:write name="document" property="publisherName"/></vkc:link></td>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="publisher" value="false">
          <td colspan="2">&nbsp;</td>
        </logic:equal>
      </tr>
      </logic:equal>

      <logic:equal name="documentViewSettings" property="accessCountORLastAccessed" value="true">
      <tr valign="top">
        <logic:equal name="documentViewSettings" property="accessCount" value="true">
        <td valign="top" nowrap="nowrap"><b><vkc:message key="vkc.accesscount"/>:</b></td>
        <td valign="top" nowrap="nowrap" width="100%"><vkc:write name="document" property="accessCount"/></td>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="accessCount" value="false">
        <td colspan="2">&nbsp;</td>
        </logic:equal>

        <logic:equal name="documentViewSettings" property="lastAccessed" value="true">
        <td valign="top" nowrap="nowrap"><b><vkc:message key="vkc.lastaccessed"/>:</b></td>
        <td valign="top" nowrap="nowrap" width="100%"><vkc:write name="document" property="lastAccessed" formatKey="date.medium.format"/></td>
        </logic:equal>
        <logic:equal name="documentViewSettings" property="lastAccessed" value="false">
        <td colspan="2">&nbsp;</td>
        </logic:equal>
      </tr>
      </logic:equal>

      <vkc:hasAdminPrivileges>
      <tr valign="top">
        <td colspan="2">&nbsp;</td>
        <td nowrap="nowrap"><b><vkc:message key="vkc.lastaccessor"/>:</b></td>
        <logic:notEmpty name="document" property="lastAccessorId">
        <bean:define id="accessorId" name="document" property="lastAccessorId" type="java.lang.Integer"/>
        <td nowrap="nowrap"><vkc:link href='<%="javascript:openUserInfoWindow(" + accessorId.intValue() + ");"%>' style='font-weight:normal;'><vkc:write name="document" property="lastAccessorName"/></vkc:link></td>
        </logic:notEmpty>
        <logic:empty name="document" property="lastAccessorId">
        <td nowrap="nowrap">&nbsp;</td>
        </logic:empty>
      </tr>
      </vkc:hasAdminPrivileges>

      <vkc:hasAdminPrivileges>
	  <tr>
	    <td colspan="2">&nbsp;</td>
	    <td valign="top" nowrap="nowrap"><b><vkc:message key="vkc.lastchanged"/>:</b></td>
	    <logic:notEmpty name="document" property="lastChanged">
		<td valign="top" nowrap="nowrap" width="100%"><vkc:write name="document" property="lastChanged" formatKey="date.medium.format"/></td>
		</logic:notEmpty>
		<logic:empty name="document" property="lastChanged">
        <td>&nbsp;</td>
        </logic:empty>
      </tr>
      </vkc:hasAdminPrivileges>

	  <vkc:hasAdminPrivileges>
      <tr valign="top">
        <td colspan="2">&nbsp;</td>
        <td nowrap="nowrap"><b><vkc:message key="vkc.lastchanger"/>:</b></td>
        <logic:notEmpty name="document" property="lastChangerId">
        <bean:define id="changerId" name="document" property="lastChangerId" type="java.lang.Integer"/>
        <td nowrap="nowrap"><vkc:link href='<%="javascript:openUserInfoWindow(" + changerId.intValue() + ");"%>' style='font-weight:normal;'><vkc:write name="document" property="lastChangerName"/></vkc:link></td>
        </logic:notEmpty>
        <logic:empty name="document" property="lastChangerId">
        <td nowrap="nowrap">&nbsp;</td>
        </logic:empty>
      </tr>
      </vkc:hasAdminPrivileges>
	  
      <logic:equal name="documentViewSettings" property="statusType" value="true">
      <logic:equal name="categorySettings" property="showDocumentStatus" value="true">
      <tr valign="top">
        <td nowrap="nowrap"><b><vkc:message key="vkc.document.status"/>:</b></td>
        <logic:notEmpty name="document" property="documentStatus">
        <td colspan="3"><vkc:message name="document" property="documentStatus.descriptionKey"/></td>
        </logic:notEmpty>
      </tr>
      </logic:equal>
      </logic:equal>

      <logic:equal name="documentViewSettings" property="keywords" value="true">
      <tr valign="top">
        <td nowrap="nowrap"><b><vkc:message key="vkc.keywords"/>:</b></td>
        <td colspan="3"><vkc:write name="document" property="externalKeywordsString"/></td>
      </tr>
      </logic:equal>

      <logic:equal name="documentViewSettings" property="description" value="true">
      <tr valign="top">
        <td nowrap="nowrap"><b><vkc:message key="vkc.description"/>:</b></td>
        <td colspan="3">
          <logic:equal name="form" property="tinyMCECompatible" value="true">
          <vkc:write name="document" property="description" displayAsHTML="true" renderNewLine="true"/>
          </logic:equal>
          <logic:equal name="form" property="tinyMCECompatible" value="false">
          <vkc:write name="document" property="description" stripHTML="true" renderNewLine="true"/>
          </logic:equal>
        </td>
      </tr>
      </logic:equal>

      <%-- Additional Document Formats --%>
      <logic:equal name="documentViewSettings" property="additionalFormats" value="true">
      <tr valign="top">
        <td nowrap="nowrap"><b><vkc:message key="vkc.document.additional_formats"/>:</b></td>
        <td colspan="3">
        <logic:iterate id="docFormat" name="document" type="vkc.db.entities.VKCAdditionalDocumentFormat" property="additionalDocumentFormats">
          <logic:notEqual name="docFormat" property="internalDocFormat" value="1">
            <bean:define id="ext" name="docFormat" property="docType.lowerCaseExtension" type="java.lang.String"/>
            <logic:equal name="ext" value="html">
              <a href="<%=ctxPath%>/display/<vkc:write name="document" property="documentId"/>_<vkc:write name="docFormat" property="addDocFormatId"/>/index.html;jsessionid=<%=request.getSession().getId()%>" target="about:blank" style="font-weight:normal;"><vkc:write name="docFormat" property="docType.extension"/></a>
            </logic:equal>
            <logic:notEqual name="ext" value="html">
              <a href="<%=ctxPath%>/display/<vkc:write name="document" property="documentId"/>_<vkc:write name="docFormat" property="addDocFormatId"/>/index.<vkc:write name="ext"/>;jsessionid=<%=request.getSession().getId()%>"  target="about:blank" style="font-weight:normal;"><vkc:write name="docFormat" property="docType.extension"/></a>
            </logic:notEqual>
          </logic:notEqual>
          <logic:equal name="docFormat" property="internalDocFormat" value="1">
            <logic:equal name="categorySettings" property="showDisplayAscii" value="true">
              &nbsp;<a href="<%=ctxPath%>/displayAscii/<vkc:write name="document" property="documentId"/>/index.txt;jsessionid=<%=request.getSession().getId()%>" target="about:blank" style="font-weight:normal;">ASCII</a>
            </logic:equal>
          </logic:equal>
        </logic:iterate>
        </td>
      </tr>
      </logic:equal>

      <%-- Dynamische Attribute ausgeben --%>
      <logic:equal name="documentViewSettings" property="dynaAttributes" value="true">
      <logic:iterate id="dynaAttribute" name="document" property="dynaAttributes">
      <tr valign="top">
        <td nowrap="nowrap"><b><vkc:write name="dynaAttribute" property="name"/>:</b></td>
        <td colspan="3"><vkc:write name="dynaAttribute" property="value"/></td>
      </tr>
      </logic:iterate>
      </logic:equal>

      <%-- Globale Attribute ausgeben --%>
      <logic:equal name="documentViewSettings" property="addAttributes" value="true">
      <logic:iterate id="addAttribute" name="document" property="addAttributes">
      <tr valign="top">
        <td nowrap="nowrap"><b><vkc:write name="addAttribute" property="name"/>:</b></td>
        <logic:empty name="addAttribute" property="valuestring">
          <td colspan="3"><vkc:write name="addAttribute" property="defaultValue"/></td>
        </logic:empty>
        <logic:notEmpty name="addAttribute" property="valuestring">
          <td colspan="3"><vkc:write name="addAttribute" property="valuestring"/></td>
        </logic:notEmpty>
      </tr>
      </logic:iterate>
      </logic:equal>
    </table>
  </td>
</tr>