<%@ page language="java" buffer="64kb" %>

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

<%@ page import="vkc.db.entities.VKCDocumentStatus" %>
<%@ page import="vkc.view.WebShare" %>
<%@ page import="vkc.db.entities.VKCUser" %>
<%@ page import="org.apache.struts.Globals" %>
<%@ page import="vkc.view.PageId" %>
<%@ page import="vkc.db.entities.VKCCategory" %>

<vkc:init/>

<bean:define id="form" name="form" type="vkc.procoba.project.ProjectViewForm" scope="request"/>
<bean:define id="documents" name="form" property="virtualDocuments"/>

<logic:empty name="documents">
  <tr>
    <td colspan="1">
      <table width="100%" cellpadding="0" cellspacing="5">
        <vkc:hline colspan="1" lineClass="hline" topSpace="0" bottomSpace="0" lineHeight="1"/>
        <tr><td align="left"><b><vkc:message key="vkc.virtual_docs"/>:</b></td></tr>
        <tr><td align="left"><vkc:message key="project.info.no.virtual.documents"/></td></tr>
      </table>
    </td>
  </tr>    
</logic:empty>

<logic:notEmpty name="documents">
  <bean:define id="userDocumentViewSettings" name="documentViewSettings" type="vkc.view.bean.DocumentViewSettings" toScope="request" />
  <tr>
    <td colspan="1">
      <table cellpadding="0" cellspacing="5" width="100%">
        <vkc:hline colspan="1" lineClass="hline" topSpace="0" bottomSpace="0" lineHeight="1"/>
        <tr><td align="left"><b><vkc:message key="vkc.virtual_docs"/>:</b></td></tr>

        <%-- Liste der Dokumente --%>
        <logic:iterate id="doc" name="documents" type="vkc.db.entities.VKCDocument" indexId="docIndex">
          <bean:define id="documentId" name="doc" property="documentId" type="java.lang.Integer"/>
          <tr>
            <td>
          	  <a name='doc<vkc:write name="doc" property="documentId"/>'></a>
              <table width="100%" cellspacing="0" cellpadding="0" border="0">
                <tr>
                  <td>
                    <table id='<%=documentId + "a"%>' width="100%" cellspacing="0" cellpadding="0" border="0">
                      <tbody>
                        <tr class="color_doctitle">
						  <logic:equal name="form" property='<%= "showDocDetails[" + documentId + "]" %>' value="false">
						  <td><vkc:link href='<%= "javascript:showDocumentDetails(" + documentId + ");" %>'><vkc:img page="/templates/${template.name}/gfx/plus.gif" border="0" titleKey="vkc.tooltip.show.document.details"/></vkc:link></td>
						  </logic:equal>          
		
						  <logic:equal name="form" property='<%= "showDocDetails[" + documentId + "]" %>' value="true">
						  <td><vkc:link href='<%= "javascript:hideDocumentDetails(" + documentId + ");" %>'><vkc:img page="/templates/${template.name}/gfx/minus.gif" border="0" titleKey="vkc.tooltip.hide.document.details"/></vkc:link></td>
						  </logic:equal>          

                          <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="4" height="10"/></td>
                          <td><vkc:img page='<%="/templates/${template.name}" + doc.getVirtualDocumentIcon()%>' alt='' border='0'/></td>
                          <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="2" height="10"/></td>
                          <td width="100%" align="left"><b><vkc:write name="doc" property="header"/></b></td>

                          <bean:define id="virtualDocument" name="doc" type="vkc.db.entities.VKCDocument" toScope="request" />

                          <vkc:hasAdminPrivileges>
                          <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5" height="10"/></td>
                    	  <td><vkc:link page="<%=doc.getDocumentSysLink()%>" target="_new"><vkc:img page="/templates/${template.name}/gfx/document-jump.gif" border="0" titleKey="vkc.string.jump_to_real_doc"/></vkc:link></td>
                          </vkc:hasAdminPrivileges>

                          <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5" height="10"/></td>
                          <td align="right"><vkc:img page="/templates/${template.name}/gfx/border.gif" alt="|" width="2" height="15"/></td>
                          <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5" height="10"/></td>
                      
                          <td><a href="#top" onclick="this.blur();" onfocus="this.blur();"><vkc:img page="/templates/${template.name}/gfx/button-top.gif" border="0" alt="" titleKey="vkc.tooltip.gototop"/></a></td>
                          <td><vkc:img page="/templates/${template.name}/gfx/trans.gif" alt="" width="5" height="24"/></td>
                        </tr>
                      </tbody>
                    </table>
                  </td>
                </tr>

      			<bean:define id="displayCategoryPath" type="java.lang.String" value="false" toScope="request"/>
          		<bean:define id="document" name="doc" type="vkc.db.entities.VKCDocument" toScope="request" />
      			<bean:define id="currentUser" name="form" property="user" type="vkc.db.entities.VKCUser" toScope="request"/>

		  		<logic:equal name="form" property='<%= "showDocDetails[" + documentId + "]" %>' value="true">
	      		<bean:define id="documentViewSettings" name="documentViewSettings" property="fullviewDocumentViewSettings" type="vkc.view.bean.DocumentViewSettings" toScope="request" />
		  		</logic:equal>          
		  		<logic:equal name="form" property='<%= "showDocDetails[" + documentId + "]" %>' value="false">
	      		<bean:define id="documentViewSettings" name="userDocumentViewSettings" type="vkc.view.bean.DocumentViewSettings" toScope="request" />
		  		</logic:equal>          
          		
	            <bean:define id="rowId" value="true" type="java.lang.String" toScope="request" />
    		    <jsp:include page='<%="/templates/" + template + "/common/DocumentView.jsp"%>'/>
		      </table>
		    </td>
		  </tr>      
        </logic:iterate>
      </table>
    </td>
  </tr>      
</logic:notEmpty>
