<%@ include file="taglib.inc.jsp" %>
<%@ page import="vkc.workflow.WfConstants" %>
<%@ page import="vkc.workflow.model.VariableInfo" %>
<bean:define id="var" name="var" type="vkc.workflow.model.VariableInfo"/>
<bean:define id="ctxPath" name="ctxPath" type="java.lang.String"/>
<bean:define id="template" name="template" type="java.lang.String"/>

<tr>
    <logic:equal name="var" property="showDataTypes" value="true"><td colspan="2">&#160;</td></logic:equal>
    <logic:equal name="var" property="showDataTypes" value="false"><td>&#160;</td></logic:equal>
    <td><vkc:write name="var" property="description"/></td>
</tr>
<tr>
	<td valign="top" nowrap><b><vkc:write name="var" property="displayName"/></b></td>
	<logic:equal name="var" property="showDataTypes" value="true"><td valign="top" nowrap><vkc:write name="var" property="displayType"/></td></logic:equal>
	<td width="100%">
<% if (!VariableInfo.isSpecialVar(var.getName()) && !VariableInfo.isSpecialVar(var.getId())) {%>
<%-- STRING --%>	
	<logic:equal name="var" property="typeKey" value="<%=WfConstants.STRING_KEY%>">
		<logic:equal name="var" property="readOnly" value="true">
			<textarea rows="5" name="dummy" style="width:100%;" disabled="disabled"><%=var.getValue()%></textarea>
		</logic:equal>
		<logic:equal name="var" property="readOnly" value="false">
			<textarea rows="5" name="dynaValue(<%=var.getId()%>)" style="width:100%;"><%=var.getValue()%></textarea>
		</logic:equal>
	</logic:equal>
<%-- BOOLEAN --%>
	<logic:equal name="var" property="typeKey" value="<%=WfConstants.BOOLEAN_KEY%>">
		<logic:equal name="var" property="readOnly" value="true">
			<input type="checkbox" name="dummy" disabled="disabled" value="true"<%if(var.getValue().equals("true")) out.print(" checked=\"checked\"");%> />
		</logic:equal>
		<logic:equal name="var" property="readOnly" value="false">
			<input type="checkbox" name="dynaValue(<%=var.getId()%>)" value="true"<%if(var.getValue().equals("true")) out.print(" checked=\"checked\"");%> />
		</logic:equal>
	</logic:equal>

<%-- REST --%>	
	<logic:notEqual name="var" property="typeKey" value="<%=WfConstants.STRING_KEY%>">
	<logic:notEqual name="var" property="typeKey" value="<%=WfConstants.BOOLEAN_KEY%>">
		<logic:equal name="var" property="readOnly" value="true">
			<input type="text" name="dummy" value="<%=var.getValue()%>" disabled="disabled" style="width:100%;" />
		</logic:equal>
		<logic:equal name="var" property="readOnly" value="false">
			<input type="text" name="dynaValue(<%=var.getId()%>)" value="<%=var.getValue()%>" style="width:100%;" />
		</logic:equal>
	</logic:notEqual>
	</logic:notEqual>
	
<%-- Behandlung  von speziellen Variablen --%>	
<% } else if (var.getName().toLowerCase().endsWith(VariableInfo.CATEGORY_ID_SUFFIX) || var.getId().toLowerCase().endsWith(VariableInfo.CATEGORY_ID_SUFFIX)) { %>
		<table width="100%" cellpadding="0" cellspacing="0" border="0">
	      <tr>
	      	<logic:equal name="var" property="readOnly" value="false">
	      	<input type="hidden" name="dynaValue(<%=var.getId()%>)" value="<%=var.getValue()%>" />
	        <td nowrap="nowrap"><input type="image" name="btn_explorer" src="<%=ctxPath%>/workflow/../templates/<%=template%>/gfx/my_computer.gif" onclick="return showExplorer('<%=var.getId()%>', '<%=var.getValue()%>');" /></td>
	        <td nowrap="nowrap">&nbsp;&nbsp;&nbsp;</td>
	        </logic:equal>
	        <td width="100%"><a href="<%=ctxPath%>/showCategory.do?categoryId=<%=var.getValue()%>"><vkc:write name="var" property="displayValue"/></a></td>
	      </tr>  
	    </table>
	<% } else if (var.getName().toLowerCase().endsWith(VariableInfo.DOCUMENT_ID_SUFFIX) || var.getId().toLowerCase().endsWith(VariableInfo.DOCUMENT_ID_SUFFIX)) { %>
	      	<logic:equal name="var" property="readOnly" value="false">
		      	<input type="text" name="dynaValue(<%=var.getId()%>)" value="<%=var.getValue()%>" style="width:100%;" />
		        <br />
	        </logic:equal>
	        <a href="<%=ctxPath%>/sysLink.do?linkType=documentLink&objectId=<%=var.getValue()%>"><vkc:write name="var" property="displayValue"/></a></td>
	<% } else if (var.getName().toLowerCase().endsWith(VariableInfo.PASSWORD_SUFFIX) || var.getId().toLowerCase().endsWith(VariableInfo.PASSWORD_SUFFIX)) { %>
	      	<logic:equal name="var" property="readOnly" value="false">
		      	<input type="password" name="dynaValue(<%=var.getId()%>)" value="<%=var.getValue()%>" style="width:100%;" />
		        <br />
	        </logic:equal>
			<logic:equal name="var" property="readOnly" value="true">
		      	<input type="password" name="dynaValue(<%=var.getId()%>)" value="<%=var.getValue()%>" disabled="disabled" style="width:100%;" />
		        <br />
	        </logic:equal>
	<% } %>
	
	</td>
<tr>
