<%@page contentType="text/html;charset=UTF-8" pageEncoding="ISO-8859-1" session="true"
%><%@page errorPage="AdminException.jsp"
%><%@page import="com.fujitsu.iflow.model.workflow.WFSession"
%><%@page import="com.fujitsu.iflow.model.workflow.WFObjectFactory"
%><%@page import="com.fujitsu.iflow.model.workflow.Plan"
%><%@page import="com.fujitsu.iflow.model.workflow.ProcessInstantiator"
%><%@page import="com.fujitsu.iflow.model.workflow.ProcessMigrationResult"
%><%@page import="com.fujitsu.iflow.model.wfcore.WFAdminSessionImpl"
%><%@page import="java.util.Enumeration"
%><%@page import="java.util.StringTokenizer"
%><%@page import="com.fujitsu.iflow.model.util.URLEncoder"
%><%@page import="com.fujitsu.iflow.model.bpm.BPMAdmin"
%><%@page import="com.fujitsu.iflow.model.bpm.BPMSession"
%><%@page import="com.fujitsu.iflow.model.bpmcore.BPMAdminImpl"
%><%
    request.setCharacterEncoding("UTF-8");request.getParameterNames(); //Need dummy call for WL9.1
    BPMSession bps = (BPMSession) session.getAttribute("BPMSession");
    if (bps == null) {
        %><jsp:include page="PasswordPanel.jsp" flush="true"/><%
        return;
    }

    BPMAdmin bpas = bps.getAdmin();
    WFAdminSessionImpl wfSession = ((BPMAdminImpl)bpas)._wfas;

	String processId = request.getParameter("processIds");
%>
<html>
<head><title>Interstage Business Process Manager | Migrate Process Instances</title>
<jsp:include page="StyleSheet.jsp" flush="true"/>
<script language="javascript" src="styles/clockscripts.js"></script>
<SCRIPT>

function migrateProcesses(id)
{

    if (document.migrateForm.templateId.value == "" || isNaN(document.migrateForm.templateId.value))
    {
        alert("Please enter a valid Process Definition ID.");
        document.migrateForm.templateId.focus();
        document.migrateForm.templateId.select();
        return false;
    }
    
	var rad_val;
	for (var i=0; i < document.migrateForm.markError.length; i++)
	{
		if (document.migrateForm.markError[i].checked)
		{
			rad_val = document.migrateForm.markError[i].value;
		}
	}
	var templateId = document.migrateForm.templateId.value;
	document.location.href = 'MigrateProcessesAction.jsp?processId=' + id + '&planId=' + templateId + '&markAsError=' + rad_val;
}

</SCRIPT>
</head>
<body class="adminBodyClass">
<jsp:include page="AdminHeader.jsp" flush="true"/>
<br/><br/>
<form name="migrateForm" method="get" action="MigrateProcessesAction.jsp">
<center>

<table bgcolor="#CCCCCC" border="0" cellpadding="4" cellspacing="1" class="tableClass" width=450 align="center">
<tr align="center" class="headrow">
    <td bgcolor="#EEEEEE" style="filter:progid:DXImageTransform.Microsoft.Gradient(startColorStr='#FFFFFF', endColorStr='#6699CC', gradientType='1')"><font color="#000000" size="2">Migrate Process Instances</font></td>
</tr>
</table> 

<TABLE border="0" cellpadding="4" cellspacing="0" bgcolor="#CCCCCC" class="tableClass" width="450">
	<tr>
	<td bgcolor="#FFFFFF">For process instances that can not be migrated:
	</td>
	</tr>
	<tr><td bgcolor="#FFFFFF"><input type="radio" name="markError" value = "false" checked="checked"> Leave Unchanged<br>
    <input type="radio" name="markError" value="true"> Change and mark error</td></tr>
    <tr>
            <td bgcolor="#FFFFFF" align="left"> Process Definition Id:
            <input type="text" name="templateId" width="300">
            <br/><br/></td>
    </tr>
    <tr>
        <td valign="middle" align="center" bgcolor="#EEEEEE">
        <input type="button" onClick="migrateProcesses('<%= processId %>')" value="Migrate" name="migrate" class="core-button"></td>
    </tr>

    
</table>
</center>
</form>

</body>
</html>


<%!
    public WFAdminSessionImpl getiFlowSession(Object modelObject)
    {
    		return (WFAdminSessionImpl)(modelObject);
    }        
    
%>