<!DOCTYPE html>
<html lang="en">
    <head>
        <meta http-equiv="content-type" content="text/html;charset=utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=Edge,chrome=1">
		<title>岗位选择</title>
		<link rel="stylesheet" type="text/css" href="<?php echo style2015;?>content/css/style.css">
        <link rel="stylesheet" type="text/css" href="<?php echo style2015;?>content/css/bootstrap.min.css" />
		<link rel="stylesheet" type="text/css" href="<?php echo style2015;?>content/css/bootstrap.css"> 
		<script type="text/javascript" src="<?php echo style2015;?>content/js/jquery.min.js"></script>
		
   </head>
	<body >
	<div class="search_area">
    <form method="get" action="admin.php" name="savess" >
		<input type="hidden" name="ac" value="<?php echo $ac?>" />
		<input type="hidden" name="fileurl" value="<?php echo $fileurl?>" />
		<input type="hidden" name="inputname" value="<?php echo $_GET[inputname]?>" />
      <div class="form-search form-search-top" style="text-align:left;padding-left:10px;">
                            
			            
	        <div class="adv-select-label">名称：</div>
       		<input type="text"  value="<?php echo urldecode($keyword)?>" name="keyword" class="span3" style="width:100px;">  
          <button id="do_search" type="button" onClick="javascript:savess.submit();" class="btn btn-primary">查 询</button>
           <a class="btn btn-danger" onClick="javascript:actForm.submit();" style=" float:right;margin-right:25px;">确 认</a>  
        </div>
     
    </form>
</div>
<link rel="stylesheet" href="template/style2015/zTree/css/demo.css" type="text/css">
	<link rel="stylesheet" href="template/style2015/zTree/css/zTreeStyle/zTreeStyle.css" type="text/css">
	<script type="text/javascript" src="template/style2015/zTree/js/jquery-1.4.4.min.js"></script>
	<script type="text/javascript" src="template/style2015/zTree/js/jquery.ztree.core-3.5.js"></script>
	<SCRIPT type="text/javascript">
		<!--
		var curMenu = null, zTree_Menu = null;
		var setting = {
			view: {
				showLine: false,
				showIcon: false,
				selectedMulti: false,
				dblClickExpand: false,
				addDiyDom: addDiyDom
			},
			data: {
				simpleData: {
					enable: true
				}
			},
			callback: {
				beforeClick: beforeClick
			}
		};

		var zNodes =[
			{ id:9999, pId:0, name:"<?php echo $_CONFIG->config_data('name');?>"}<?php
			$rsfno = $db->fetch_one_array("SELECT id FROM ".DB_TABLEPRE."position
						 where father='0' and jituanid='0' 
						 ORDER BY id asc limit 0,1");
			if($rsfno['id']!=''){
				_dep_user(0,0,9999);
			}
			$query = $db->query("SELECT name,id FROM ".DB_TABLEPRE."union ORDER BY id Asc");
			while ($row = $db->fetch_array($query)) {
				echo ','.chr(13).chr(10).'{id:'.$row[id].', pId:0, name:"'.$row[name].'"}';
				$rsfno = $db->fetch_one_array("SELECT id FROM ".DB_TABLEPRE."position
						 where father='0' and jituanid='".$row[id]."' 
						 ORDER BY id asc limit 0,1");
				if($rsfno['id']!=''){
					_dep_user(0,$row['id'],$row['id']);
				}
			}
			?>
			/*{ id:1, pId:0, name:"文件夹"},
			{ id:11, pId:1, name:"收件箱"},
			{ id:111, pId:11, name:"收件箱1"},
			{ id:112, pId:111, name:"收件箱2"},
			{ id:113, pId:112, name:"收件箱3"},
			{ id:114, pId:113, name:"收件箱4"},
			{ id:12, pId:1, name:"垃圾邮件"},
			{ id:13, pId:1, name:"草稿"},
			{ id:14, pId:1, name:"已发送邮件"},
			{ id:15, pId:1, name:"已删除邮件"},
			{ id:3, pId:0, name:"快速视图"},
			{ id:31, pId:3, name:"文档"},
			{ id:32, pId:3, name:"照片"}*/
		];

		function addDiyDom(treeId, treeNode) {
			var spaceWidth = 12;
			var switchObj = $("#" + treeNode.tId + "_switch"),
			icoObj = $("#" + treeNode.tId + "_ico");
			switchObj.remove();
			icoObj.before(switchObj);
			if (treeNode.level > 1) {
				var spaceStr = "<span style='display: inline-block;width:" + (spaceWidth * treeNode.level)+ "px'></span>";
				switchObj.before(spaceStr);
			}
		}

		function beforeClick(treeId, treeNode) {
				var zTree = $.fn.zTree.getZTreeObj("treeDemo");
				zTree.expandNode(treeNode);
				var deps=$("#ajaxdep").html();
				if (deps.indexOf('value="'+treeNode.id+'"')==-1) {
					$("#ajaxdep").html(deps+ajaxdep(treeNode.id,treeNode.name));
				}
				return false;
		}
		function ajaxdep(depid,depname){
			var html='';
			html+='<tr class="odd"><td class="notopen" style="width:10px"><input name="id[]" type="checkbox" checked="" value="'+depid+'" /><td class="ellipsis" style="width:100%;">'+depname+'</td></tr>';
			return html;
		}
		$(document).ready(function(){
			var treeObj = $("#treeDemo");
			$.fn.zTree.init(treeObj, setting, zNodes);
			zTree_Menu = $.fn.zTree.getZTreeObj("treeDemo");
			curMenu = zTree_Menu.getNodes()[0].children[0].children[0];
			zTree_Menu.selectNode(curMenu);

			treeObj.hover(function () {
				if (!treeObj.hasClass("showIcon")) {
					treeObj.addClass("showIcon");
				}
			}, function() {
				treeObj.removeClass("showIcon");
			});
		});
		//-->
	</SCRIPT>
	<style type="text/css">
.ztree * {font-size: 10pt;font-family:"Microsoft Yahei",Verdana,Simsun,"Segoe UI Web Light","Segoe UI Light","Segoe UI Web Regular","Segoe UI","Segoe UI Symbol","Helvetica Neue",Arial}
.ztree li ul{ margin:0; padding:0}
.ztree li {line-height:30px;}
.ztree li a {width:300px;height:30px;padding-top: 0px;}
.ztree li a:hover {text-decoration:none; background-color: #E7E7E7;}
.ztree li a span.button.switch {visibility:hidden}
.ztree.showIcon li a span.button.switch {visibility:visible}
.ztree li a.curSelectedNode {background-color:#D4D4D4;border:0;height:30px;}
.ztree li span {line-height:30px;}
.ztree li span.button {margin-top: -7px;}
.ztree li span.button.switch {width: 16px;height: 16px;}
.ztree li a.level0 span {font-size: 16px;font-weight: bold;}
.ztree li span.button {background-image:url("template/style2015/zTree/css/zTreeStyle/img/left_menuForOutLook.png"); *background-image:url("template/style2015/zTree/css/zTreeStyle/img/left_menuForOutLook.gif")}
.ztree li span.button.switch.level0 {width: 20px; height:20px}
.ztree li span.button.switch.level1 {width: 20px; height:20px}
.ztree li span.button.noline_open {background-position: 0 0;}
.ztree li span.button.noline_close {background-position: -18px 0;}
.ztree li span.button.noline_open.level0 {background-position: 0 -18px;}
.ztree li span.button.noline_close.level0 {background-position: -18px -18px;}
	</style>

<div class="content_wrap">
<table width="590" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td><div class="zTreeDemoBackground">
		<ul id="treeDemo" class="ztree"></ul>
	</div></td>
    <td valign="top" style="padding-top:2px;"><table class="items table table-striped" style="margin-bottom:0px;width:250px;">
					<thead>
						<tr>
							<th style="width:100%;" id="folder-grid_c1">己选择部门</th>
						</tr>
					</thead>
					</table>
					<div style="position:absolute; height:395px; width:250px;overflow:auto; ">
					<form method="post" name="actForm" action="admin.php?ac=<?php echo $ac?>&fileurl=<?php echo $fileurl?>&do=add">
  <input type="hidden" name="inputname" value="<?php echo $_GET[inputname]?>">
					<table class="items table table-striped" style="margin-top:0px;">
						
				    <tbody id="ajaxdep">
						<?php
						foreach ($result as $row) {
						?>
						<tr class="odd">
						<td class="notopen" style="width:10px">
		<input name="id[]" type="checkbox" value="<?php echo $row['id'];?>" checked /></td>
						<td class="ellipsis" style="width:100%;"><?php echo $row['name']?></td>
						</tr>
						<?php }?>
						
					</tbody>
				</table>
				</form>
				</div>
				
	  </td>
  </tr>
</table>



	
</div>	
	
		
	
			

	</body>
</html>