<%@page import="com.blueland.bpm.engine.config.model.*" %>
<%@page import="com.blueland.bpm.common.page.*" %>
<%@page import="java.util.*" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib tagdir="/WEB-INF/tags/simpletable" prefix="simpletable"%>
<%@ 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">
<head>
	<%@ include file="/commons/meta.jsp" %>
	<base href="<%=basePath%>">
	<title>流程数据对象关联表管理</title>
	<link href="${ctx_js_plugins}/simpletable/simpletable.css" type="text/css" rel="stylesheet">
	<script type="text/javascript" src="${ctx_js_plugins}/simpletable/simpletable.js"></script>

	<script type="text/javascript" >
		$(document).ready(function() {
			// 分页需要依赖的初始化动作
			window.simpleTable = new SimpleTable('queryForm','${page.thisPageNumber}','${page.pageSize}','${pageRequest.sortColumns}');
		});
		function delObj(){
			if (!hasOneChecked("items")) {
				alert('请选择要操作的对象!');
				return;
			}
			if(window.confirm('确定执行[删除]操作?')){
				jQuery.ajax({
					type : "POST",
					url : "${ctx}/dataObjectRelation/delete.do",
					data : $('#queryForm').serialize(),
					success : function(resp) {
						alert(resp);
						window.location.reload();
					}
				});
			}
		}
	</script>
</head>
<body class="white-page">
<%@ include file="/commons/messages.jsp" %>
<form id="queryForm" name="queryForm" action="${ctx}/dataObjectRelation/list.do" method="get" style="display: inline;">

	<div class="panel panel-primary">
		<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}/dataObjectRelation/create.do?processDefId=${query.processDefId}&activityDefId=${query.activityDefId}&dorType=A','新增环节变量','600px','400px')">
								新增
								<i class="ace-icon fa fa-plus bigger-110"></i>
							</button>
							<button type="button" class="btn btn-xs btn-danger" onclick="delObj();">
								删除
								<i class="ace-icon fa fa-trash-o bigger-110"></i>
							</button>
							<!-- <a class="btn btn-xs btn-primary" onclick="art.dialog.close();">关闭
                            <i class="ace-icon fa fa-times bigger-110"></i>
                            </a> -->
						</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 form-table">
							<thead>
							<tr>
								<th style="width:25px;"><input type="checkbox" onclick="setAllCheckboxState('items',this.checked)"></th>
								<!-- 排序时为th增加sortColumn即可,new SimpleTable('sortColumns')会为tableHeader自动增加排序功能; -->
								<th sortColumn="objKey" >变量KEY</th>
								<th sortColumn="objName" >变量名称</th>
								<th sortColumn="objValue" >变量值</th>
								<th sortColumn="objType" >变量类型</th>
								<th>操作</th>
							</tr>
							</thead>
							<tbody>

							<c:forEach items="${dataObjectRelations}" var="item" varStatus="status">

								<tr class="${status.count % 2 == 0 ? 'odd' : 'even'}">

									<td><input type="checkbox" name="items" value="dorId=${item.dorId}&"></td>

									<td>${item.dataObject.objKey}&nbsp;</td>
									<td>${item.dataObject.objName}&nbsp;</td>
									<td>${item.dataObject.objValue}&nbsp;</td>
									<td>${item.dataObject.objType}&nbsp;</td>
									<td>
										<a href="javascript:void(0);" onclick="showDiaLog('${ctx}/dataObjectRelation/edit.do?dorId=${item.dorId}','编辑环节变量','600px','400px')">修改</a>
									</td>
								</tr>

							</c:forEach>
							</tbody>
						</table>

					</div>
					<!-- /.table-responsive -->
				</div>
				<!-- /span -->
			</div>
		</div>
	</div>
</form>
</body>
</html>	
