<%@page import="com.blueland.bpm.engine.config.model.*"%>
<%@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>


<script>
		$(document).ready(function() {
			// 分页需要依赖的初始化动作
			window.simpleTable = new SimpleTable('queryForm',${page.thisPageNumber},${page.pageSize},'${pageRequest.sortColumns}');
		});
		
	</script>
</head>
<body class="white-page">

	<%@ include file="/commons/messages.jsp"%>
	<div id="scrollContent" class="border_gray">
	<form id="queryForm" name="queryForm"
		action="${ctx}/activityInfo/actOperatePowerList.do"
		method="get" style="display: inline;">
		<input name="activityDefId" id="activityDefId"
			value="${query.activityDefId}" type="hidden" /> <input
			name="processDefId" id="processDefId" value="${query.processDefId}"
			type="hidden" />
			<div class="main-container" id="main-container">
		<div class="panel panel-primary">
			<div class="panel-body">
				<div class="form-group well well-sm" style="margin: 0 0 5px 10px !important;padding: 0 !important;">

				<table border="0" cellspacing="0" cellpadding="0"
					class="table-search form-table">
				<tr>
					<td colspan="7">
						<button type="button"
							onclick="showDiaLog('${ctx}/actInfo/activityOperatePower/list.do?activityDefId=${query.activityDefId}&processDefId=${query.processDefId}','绑定环节权限','900px','600px');" class="btn btn-xs btn-success">
							绑&nbsp;&nbsp;定
							<i class="ace-icon fa fa-chain bigger-110"></i>
						</button>
						<button type="button"
							onclick="removePower('${ctx}/activityInfo/removeActOperatePower.do')" 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">
						关&nbsp;&nbsp;闭
						<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="padding: 0 !important;margin: 0 0 0 10px !important;">
							<table id="sample-table-1"
								class="table table-striped table-bordered table-hover">
								<thead>
				<tr>
					<th style="width: 25px;"><input type="checkbox"
						onclick="setAllCheckboxState('opIds',this.checked)"></th>
					<!-- 排序时为th增加sortColumn即可,new SimpleTable('sortColumns')会为tableHeader自动增加排序功能; -->
					<th sortColumn="opName">权限名称</th>
					<th sortColumn="opType">权限类型</th>
					<th sortColumn="opSort">权限排序</th>
					<th sortColumn="opScope">权限范围</th>
					<!--  <th sortColumn="opClassPath">权限控制处理器</th>  -->

				</tr>
	</thead>
<tbody>

				<c:forEach items="${activityOperatePowerList}" var="item"
					varStatus="status">
					<tr class="${status.count % 2 == 0 ? 'odd' : 'even'}">
						<td><input type="checkbox" name="opIds" value="${item.opId}"></td>
						<td><c:out value='${item.opName}' />&nbsp;</td>
						<td><c:out value='${item.opTypeVal}' />&nbsp;</td>
						<td><c:out value='${item.opSort}' />&nbsp;</td>
						<td><c:out value='${item.opScopeVal}' />&nbsp;</td>
						<!--<td><c:out value='${item.opClassPath}' />&nbsp;</td> -->
					</tr>
				</c:forEach>
			</tbody>
				</table>
			</div>
						<!-- /.table-responsive -->
					</div>
					<!-- /span -->
				</div>
			</div>
		</div>

	</div>
		
	</form>
</body>
</html>
<script>
		function removePower(myUrl){
			if (!hasOneChecked("opIds")) {
			    	alert('请选择要操作的对象!');
			        return;
			}
			jQuery.ajax({
				url: myUrl,
				data: $('#queryForm',document).serialize(),
				type: "POST",
				success: function(resp)
				{
					alert(resp);
					window.location.reload();
				}
			});
		}
</script>
