<%@ page contentType="text/html;charset=UTF-8"%>
<%@page import="com.blueland.bpm.engine.config.model.*"%>
<%@ include file="/commons/taglibs.jsp"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<%@ include file="/commons/meta.jsp"%>
<base href="<%=basePath%>">
<script>
	$(document).ready(function() {

		$("#submitButton").click(function() {
			var calledElement = $("#calledElement").val();
			if(null == calledElement || "" == calledElement){
				alert("贯穿流程必须选择！");
				$("#procDefName").focus();
				return false;
			}
			//用jquery中的ajax方法，向服务器提交请求 
			//setMask("main-container");
			jQuery.ajax({
				type : "POST",
				url : "${ctx}/actInfo/otherTask/editCallActivity.do",
				data : $('#myform').serialize(),
				success : function(resp) {
					alert(resp);
					art.dialog.close();
				}
			});
		});
		
		$("#deleteBtn").click(function() {
			if (!hasOneChecked("sourceRefs")) {
				alert('请选择要操作的对象!');
				return;
			}
			if (!window.confirm('确定执行[删除]操作?')) {
				return;
			}
			//用jquery中的ajax方法，向服务器提交请求 
			jQuery.ajax({
				type : "POST",
				url : "${ctx}/actInfo/otherTask/deleteCallActProperty.do",
				data : $('#myform').serialize(),
				success : function(resp) {
					alert(resp);
					window.location.reload();
				}
			});
		});

	});
	
	function procDefNameOnDbClick(name, value) {
		$("#procDefName").val(name);
		$("#calledElement").val(value);
	}
</script>
<title>流程贯穿服务任务设置</title>
</head>
<body class="white-page">
	<form action="${ctx}/actInfo/otherTask/editCallActivity.do" method="post"
		id="myform">
		<div class="main-container" id="main-container">
			<div class="panel panel-primary">

				<div class="panel-body">
					<table class='table table-bordered form-table' border="0" cellspacing="0"
						cellpadding="0" id="myTable">
						<!-- 存放隐藏域的区域 -->
						<input type="hidden" name="activityDefId"
							value="${activityInfoConfig.activityDefId}" />
						<input type="hidden" name="activityDefName"
							value="${activityInfoConfig.activityDefName}" />
						<input type="hidden" name="processDefId"
							value="${activityInfoConfig.processDefId}" />
						<input type="hidden" name="processDefName"
							value="${activityInfoConfig.processDefName}" />
						<!-- <input type="hidden" name="activityDefChildType" value="through" />-->
						<!-- 存放表单的区域 -->
						<tr>
							<td width="20%">环节ID<font color="red">*</font>：
							</td>
							<td><input style="width: 400px;" readonly type="text" name="name"
								value="${callActivity.id}" id="name" /></td>
						</tr>
						<tr>
							<td width="10%">环节名称<font color="red">*</font>：
							</td>
							<td><input style="width: 400px;" readonly type="text" name="name"
								value="${callActivity.name}" id="name" /></td>
						</tr>
						

						<tr>
							<td>贯穿流程<font color="red">*</font>：
							</td>
							<td>
							<input style="width: 400px;" type="text"
								name="procDefName" 
								<c:choose>
									<c:when test="${not empty callProcDefModel.procDefName}">
										value="${callProcDefModel.procDefName}" 
									</c:when>
									<c:otherwise>
										value="请选择"
									</c:otherwise>
								</c:choose>
								id="procDefName" readonly onclick="showMenu('procDefName','',''); return false;" />
								<input style="width: 400px;" type="hidden"
								name="calledElement" value="${callActivity.calledElement}" id="calledElement" />
							</td>
						</tr>
						<tr>
						 <td>
							环节处理类型：
					</td>
				    <td>
				    	<select name="activityDefDealType" id="activityDefDealType">
				    		<option ${activityInfoConfig.activityDefDealType=='single'?'selected':''} value="single">单人处理</option>
				    		<option ${activityInfoConfig.activityDefDealType=='multi'?'selected':''} value="multi">多人处理</option>
				    	</select>
				    </td>
				    </tr>
				    <tr>
				    	 <td>
							环节子类型：
						</td>
					    <td>
					    	<select name="activityDefChildType" id="activityDefChildType">
					    		<option ${activityInfoConfig.activityDefChildType=='inside'?'selected':''} value="inside">内部流程</option>
					    		<option ${activityInfoConfig.activityDefChildType=='through'?'selected':''} value="through">流程贯穿</option>
					    	</select>
					    </td>
				    </tr>
						<tr>
							<td>备注：</td>
							<td><textarea style="width: 600px; height: 80px"
									name="documentation" id="documentation">${callActivity.documentation}</textarea></td>
						</tr>
					</table>
					<!-- 
					<div class="panel panel-primary">
						<div class="panel-heading">贯穿流程属性映射</div>
						<div class="panel-body">
							<div class="form-group well well-sm">

								<table border="0" cellspacing="0" cellpadding="0"
									class="table-search">
									<tr>
										<td colspan="7">
											<button type="button" class="btn btn-xs btn-success"
												onclick="showDiaLog('${ctx}/actInfo/otherTask/createProperty.do?processDefId=${activityInfoConfig.processDefId}&activityDefId=${activityInfoConfig.activityDefId}','新增扩展属性','500px','300px')" />
											新  增
											</button>
											<button type="button" id="deleteBtn" class="btn btn-xs btn-danger">删  除
											</button>

										</td>
									</tr>
								</table>
							</div>
							<div class="row">
								<div class="col-xs-12">
									<div class="table-responsive">
										<table id="sample-table-1"
											class="table table-striped table-bordered table-hover">
											<thead>
												<tr>
													<th style="width: 25px;"><input type="checkbox"
														onclick="setAllCheckboxState('sourceRefs',this.checked)"></th>
													<th style="width: 300px">源流程变量名</th>
													<th>目标程变量名</th>
													<th>操作</th>
												</tr>
											</thead>
											<tbody>
												<c:forEach items="${dataInputAssociations}"
													var="item" varStatus="status">
													<tr class="${status.count % 2 == 0 ? 'odd' : 'even'}">
														<td><input type="checkbox" name="sourceRefs" value="${item.sourceRef}"></td>
														<td>${item.sourceRef}&nbsp;</td>
														<td>${item.targetRef}&nbsp;</td>
														<td><a href="javascript:void(0);"
															onclick="showDiaLog('${ctx}/actInfo/otherTask/editProperty.do?sourceRef=${item.sourceRef}','修改扩展属性','500px','300px')">修改</a></td>
													</tr>
												</c:forEach>
											</tbody>
										</table>
									</div>
								</div>
							</div>
							</div> -->
					<div class="col-md-offset-1 col-md-9" style="text-align: center;">
						<button id="submitButton" class="btn btn-sm btn-primary"
							name="submitButton" type="button">
							<span class="icon_save">保存</span>
							<i class="ace-icon fa fa-save bigger-110"></i>
						</button>
						<button type="button" class="btn btn-sm btn-primary"
							onclick="art.dialog.close()">
							<span class="icon_back">关闭</span>
						</button>

					</div>
				</div>
			</div>
		</div>
	</form>
	<jsp:include page="../../../pages/procDefMgr/procDefTree.jsp" flush="false" />
</body>
</html>