<%@page import="org.activiti.engine.repository.ProcessDefinition"%>
<%@page import="org.activiti.bpmn.model.*"%>
<%@page import="com.blueland.bpm.engine.config.model.*"%>
<%@page import="com.blueland.bpm.common.page.*"%>
<%@page import="com.blueland.bpm.common.util.*"%>
<%@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>
<link href="${ctx}/resource/js/plugins/loadmask/jquery.loadmask.css" rel="stylesheet" type="text/css" />
<script type='text/javascript' src='${ctx}/resource/js/plugins/loadmask/jquery.loadmask.js'></script>

<script type="text/javascript">
	$(document).ready(function() {

	});

	function createActUser(values,names) {
		var url="${ctx}/actInfo/setActResource/save.do";
		setMask("main-container");
		$.post(url, {"procDefId":$("#procDefId").val(),"actId":$("#actId").val(),"resourceStr":values},
				function (data){
					alert(data);
					window.location.reload();
			});
	}
	function deleteActUser() {
		if (!hasOneChecked("resources")) {
	    	alert('请选择要操作的对象!');
	        return;
	    }
	    if(!window.confirm('确定执行[删除]操作?')){
		   return;
	    }
	    setMask("main-container");
		var url="${ctx}/actInfo/setActResource/delete.do";
		$.post(url,$('#queryForm',document).serialize(),
				function (data){
					alert(data);
					window.location.reload();
				}
		);
	}
	
</script>
</head>
<body id="content" class="white-page">
	<%@ include file="/commons/messages.jsp"%>
	
<c:if test="${opDataSource=='true'}">
	<div class="alert alert-block alert-info">
		<button type="button" class="close" data-dismiss="alert">
				<i class="ace-icon fa fa-times"></i>
		</button>
		新建、删除资源后请点击发布流程按钮：<button type="button" onclick="postAjax('${ctx}/procDefMgr/releaseProcess.do?procDefId=${procDefId}','发布成功!',false,true);" class="btn btn-xs btn-success">
							发&nbsp;&nbsp;布
						</button>
	</div>
</c:if>
	<form id="queryForm" name="queryForm"
		action="${ctx}/actInfo/setActResource/list.do" method="post"
		style="display: inline;">
		<input name="actId" id="actId" value="${userTask.id}" type="hidden"/>
		<input name="procDefId" id="procDefId" value="${procDefId}" type="hidden"/>
		<div class="main-container" id="main-container">
			<div class="panel panel-primary">
				<div class="panel-body" style="padding:3px;">
					<div class="well well-sm" style="margin: 0 0 5px 10px !important;padding: 0 !important;">

						<table border="0" cellspacing="0" cellpadding="0"
							class="table-search">
				<tr>
					<td colspan="7">
						<button type="button" onclick="showDiaLog('${ctx}/pages/user_org_select.jsp?orgId=0&showTreeType=USER', '新增环节人员', '850px', '600px');" class="btn btn-xs btn-success">
							新&nbsp;&nbsp;增
							<i class="ace-icon fa fa-plus bigger-110"></i>
						</button>
						<button type="button" onclick="deleteActUser();" class="btn btn-xs btn-danger">
							删&nbsp;&nbsp;除
							<i class="ace-icon fa fa-trash-o bigger-110"></i>
						</button>
						
						<!-- <button onclick="art.dialog.close();" type="button" class="btn btn-xs btn-primary">
							关闭
							<i class="ace-icon fa fa-times bigger-110"></i>
						</button> -->
					</td>
				</tr>
			</table>
			</div>
		<div class="row">
						<div class="col-xs-12">
							<div class="table-responsive" style="margin: 0 0 0 10px !important;padding: 0!important;">
								<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('resources',this.checked)"></th>	
				<th>资源类型</th>
				<th>资源名称</th>
				<th>资源值</th>
			</tr>
</thead>
									<tbody>
									
									<c:forEach items="${activityResources}" var="item" varStatus="status">
										<tr class="${status.count % 2 == 0 ? 'odd' : 'even'}">
											<td><input type="checkbox" name="resources" value="${item.type}#${item.id}"></td>
											<td>${item.parentId}</td>
											<td>${item.name}&nbsp;</td>
											<td>
											<c:choose>
												<c:when test="${item.type=='ROLE'}">
													<a href="javascript:void(0);" onclick="showDiaLog('${ctx}/pages/role_user_select.jsp?showTreeType=USER&roleId=${item.id}', '角色关联成员列表', '764px', '494px');">${item.remark}</a>
												</c:when>
												<c:otherwise>
													${item.remark }
												</c:otherwise>
											</c:choose>
											</td>
										</tr>
									</c:forEach>
			
		</tbody>
								</table>
								
							</div>
							<!-- /.table-responsive -->
						</div>
						<!-- /span -->
					</div>
				</div>
			</div>

		</div>
	</form>
</body>
</html>