<%@ page language="java" %>
<%@ include file="inc/taglib.inc.jsp" %>
<%@ include file="inc/helper.inc.jsp" %>
<vkc:init/>
<html:html locale="true">
<head>
    <title><vkc:message key="wf.workflow"/></title>
    <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 />

	<link rel="stylesheet" href="<vkc:rewrite page='/templates/${template.name}/workflow/vkc-wf.css'/>"/>

	<script type="text/javascript" src="<vkc:rewrite page='/common/utils.js'/>"></script>
</head>
<body>
<form action="<%=self(request, new String[]{"detailId", "pkgId", "procDefId"})%>" method="post">
<input type="hidden" name="action" value="partMapping.save" />
<bean:define id="form" name="definitionsForm"/>

<table cellspacing="1" cellpadding="2" width="100%" border="0">
 <tr><td></td><td align="left"><h2><vkc:message key="wf.start_workflow.desc"/></h2></td></tr>
 <vkc:hline colspan="2" lineClass="hline" lineHeight="1" topSpace="5" bottomSpace="5"/>
  <tr>
    <td width="200" align="left" valign="top" nowrap="nowrap">
	<jsp:include page="inc/navigation.inc.jsp">
		<jsp:param name="wf-action" value="definitions"/>
	</jsp:include>
	</td>
		<td width="100%" align="center" valign="center">
<!-- Neuen Workflow starten -->
		<table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
				<tr>
					<td>
					<table width="100%" cellspacing="0" cellpadding="2" border="0" align="center">
<!-- Fehlermeldungen -->
		      		<jsp:include page="inc/error.inc.jsp">
		      			<jsp:param name="colspan" value="3"/>
		      		</jsp:include>
<!-- Messages -->
			      	<jsp:include page="inc/messages.inc.jsp">
		      			<jsp:param name="colspan" value="3"/>
		      		</jsp:include>
					<tr><td class="tableheader">Name</td><td class="tableheader">Beschreibung</td><td class="tableheader">Aktionen</td></tr>
<!-- Package loop -->
					<logic:iterate id="pkg" indexId="index" name="packages" type="vkc.workflow.model.PackageInfo">
						<%if(index.intValue() % 2 == 0 ) out.print( "<tr>" ); else out.print( "<tr class=\"tablerow\">" );%>
						<td nowrap valign="top">
							<logic:empty name="pkg" property="processDefinitions">
								<vkc:link page="/definitions.do" paramId="detailId" paramName="pkg" paramProperty="packageId">
									<vkc:img page='/../templates/${template.name}/gfx/plus.gif' border="0" alt="Details"/>
								</vkc:link>
							</logic:empty>
							<logic:notEmpty name="pkg" property="processDefinitions">
								<vkc:link page="/definitions.do?action=collapse">
									<vkc:img page='/../templates/${template.name}/gfx/minus.gif' border="0" alt="Collaps"/>
								</vkc:link>
							</logic:notEmpty>
							&#160;<vkc:img page='/../templates/${template.name}/gfx/wf-package.png' border="0" alt=""/>&#160;
							<b><vkc:write name="pkg" property="packageId"/></b>
						</td>
						<td><vkc:write name="pkg" property="path"/></td>
						<td nowrap>
							<a href="<%=self(request,"detailId")%>action=partMapping.show&pkgId=<%=pkg.getPackageId()%>"><vkc:img page='/../templates/${template.name}/gfx/wf-partmapping.png' border="0" alt=""/></a>&#160;
							<vkc:hasAdminPrivileges>
							<vkc:link page="/definitions.do?action=closePackage" paramId="pkgId" paramName="pkg" paramProperty="packageId">
								<vkc:img page='/../templates/${template.name}/gfx/wf-close.png' border="0" alt=""/></vkc:link>&#160;
							<a href="<%=self(request,"detailId")%>action=enable&pkgId=<%=pkg.getPackageId()%>">
								<vkc:img page='/../templates/${template.name}/gfx/wf-enabled.png' border="0" alt=""/></a>&#160;
							<a href="<%=self(request,"detailId")%>action=disable&pkgId=<%=pkg.getPackageId()%>">
								<vkc:img page='/../templates/${template.name}/gfx/wf-disabled.png' border="0" alt=""/></a>
							</vkc:hasAdminPrivileges>
						</td>
						</tr>
						<logic:equal parameter="action" value="partMapping.show">
						<logic:equal parameter="pkgId" value="<%=pkg.getPackageId()%>">
						<logic:notPresent parameter="procDefId">
<!-- Participant Mapping Package Level-->
						<tr><td colspan="3">
						<%@ include file="inc/partmapping.inc.jsp" %>
						</td>
						</tr>
						</logic:notPresent>
						</logic:equal>
						</logic:equal>
						
						<logic:notEmpty name="pkg" property="processDefinitions">
<!-- Definitions loop -->
						<logic:iterate id="p" indexId="indexP" name="pkg" property="processDefinitions" type="vkc.workflow.model.ProcessDefinitionInfo">
						<logic:equal name="p" property="category" value="Public">
						<%if(indexP.intValue() % 2 == 0 ) out.print( "<tr>" ); else out.print( "<tr class=\"tablerow\">" );%>
							<td nowrap valign="top"><vkc:img page='/../templates/${template.name}/gfx/trans.gif' border="0" width="15" height="1" alt=""/>
								<vkc:img page='/../templates/${template.name}/gfx/wf-icon.gif' border="0" altKey="wf.visualize_process"/></a>&#160;
								<b><vkc:write name="p" property="name"/></b>
							</td>
							<td><vkc:write name="p" property="description"/></td>
							<td valign="top" nowrap>
								<vkc:link href='<%="javascript:openWindow(640,480,'" + ctxPath + "/workflow/visualizeProcess.do?pkgId=" + p.getPackageId() + "&procDefId=" + p.getProcessDefId() + "','" + vkc.util.VKCStringUtils.replaceToken(p.getName(), " ", "_") + "');"%>'>
									<vkc:img page='/../templates/${template.name}/gfx/wf-view.png' border="0" altKey="wf.visualize_process"/></vkc:link>&#160;
								
								<a href="<%=self(request,"detailId")%>action=partMapping.show&pkgId=<%=p.getPackageId()%>&procDefId=<%=p.getProcessDefId()%>"><vkc:img page='/../templates/${template.name}/gfx/wf-partmapping.png' border="0" alt=""/></a>&#160;
								<a href="<%=self(request,"detailId")%>action=instantiateProcess&pkgId=<%=p.getPackageId()%>&procDefId=<%=p.getProcessDefId()%>"><vkc:img page='/../templates/${template.name}/gfx/wf-start.png' border="0" alt=""/></a>&#160;
								
								<vkc:hasAdminPrivileges>
								<logic:notEqual name="p" property="enabled" value="true">
								<a href="<%=self(request,"detailId")%>action=enable&pMgrName=<%=encode(p.getMgrName())%>">
									<vkc:img page='/../templates/${template.name}/gfx/wf-disabled.png' border="0" alt=""/></a>
								</logic:notEqual>
								<logic:equal name="p" property="enabled" value="true">
								<a href="<%=self(request,"detailId")%>action=disable&pMgrName=<%=encode(p.getMgrName())%>">
									<vkc:img page='/../templates/${template.name}/gfx/wf-enabled.png' border="0" alt=""/></a>
								</logic:equal>
								</vkc:hasAdminPrivileges>
							 </td>
						</tr>
						<logic:equal parameter="action" value="partMapping.show">
						<logic:equal parameter="procDefId" value="<%=p.getProcessDefId()%>">
<!-- Participant Mapping Process Level-->
						<tr><td colspan="3">
						<%@ include file="inc/partmapping.inc.jsp" %>
						</td>
						</tr>
						</logic:equal>
						</logic:equal>
						</logic:equal>
						</logic:iterate>
<!-- End Definitions loop -->
						</logic:notEmpty>
					</logic:iterate>
<!-- End Package loop -->
					</table>
					</td>
				</tr>
			</table>
		</td>
  </tr>
</table>
</form>
</body>
</html:html>