<%@ Page Language="C#" AutoEventWireup="true" CodeFile="UserSelectN.aspx.cs" Inherits="eFrameWork.Plugins.UserSelectN" %><!DOCTYPE html>
<html>
<head>
    <title>用户选择</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0,user-scalable=0,uc-fitscreen=yes" />
    <link href="../Plugins/eControls/default/<%=(mobile ? "mobile/" : "") %>style.css?ver=<%=Common.Version %>" rel="stylesheet" type="text/css" />   
    <link href="../Plugins/Theme/default/style.css?ver=<%=Common.Version %>" rel="stylesheet" type="text/css" />
    <script src="../Scripts/init.js"></script><%if(mobile){ %>
    <script src="../Plugins/Theme/default/mobile/layout.js?ver=<%=Common.Version %>"></script><%} %>
<style>
html, body {width:100%;height:100%;margin:0px;padding:0px;font-size:13px;}
body {overflow:auto;-webkit-user-select: none;-khtml-user-select: none;-moz-user-select: none;-ms-user-select: none;user-select: none;background-color: #fafbfe;
      -webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
    
}
.ui-aside-mask{position:fixed;left:0;top:0;bottom:0;right:0;z-index:98;background:rgba(0,0,0,.3);opacity:0;}
</style>
<script>

var objid = "<%=obj%>";
var multi = <%=multi%>;
var ipt,txt,body,value,names;
$(document).ready(function () {
    <%if(mobile){%>
    var asidetree = $(".treeaside").asideUi({
        hasmask: true,
        size: "250px",
        position: "left",
        sidertime: 300
    });
    $(".treemenu").on("click", function () {       
        asidetree.toggle();
    });
    <%}%>
    if(parent.UserSelectParent)
    {
        ipt = $(parent.UserSelectParent).find("[postname='" + objid + "']");
        txt = $(parent.UserSelectParent).find("[postname='" + objid + "_text']");
        body = $(parent.UserSelectParent).find(".body");
        value = ipt.val();
        names = body.text();
        if(value.length>0)
        {
            var arr=value.split(",");
            for(var i=0;i<arr.length;i++)
            {
                var userid=arr[i];
                var classname= multi ? "item multi selected" : "item single selected";
                $(".users").find("[userid='" + userid + "']").attr("class",classname);
            }
        }
    }
	var tree = new eTree("etree");	
});

function setUser(obj,id, name) 
{
    if(!parent.UserSelectParent){return;}
    if (multi)
    {
        value = ipt.val();
        names = body.text();
        if (value.indexOf(id) == -1)//添加
        {
            value += (value.length > 0 ? "," : "") + id;
            names += (names.length > 0 ? "," : "") + name;
            $(obj).attr("class","item multi selected");
        }
        else
        {
            $(obj).attr("class","item multi");
            value = value.replace("," + id,"");
            value = value.replace(id + ",","");
            value = value.replace(id,"");

            names = names.replace("," + name,"");
            names = names.replace(name + ",","");
            names = names.replace(name,"");           
        }
        ipt.val(value);
        txt.val(names);
        body.html(names);
        body.attr("title",names);
    }
    else
    {
        
        ipt.val(id);
        txt.val(name);
        body.html(name);
        body.attr("title",name);
        $(".users .selected").attr("class","item single");
        $(obj).attr("class","item single selected");
        parent.layer.close(parent.arrLayerIndex.pop());
    }
    cancelEvent(getEvent());
};
</script>
</head>
<body>
<style>
.wrapper {overflow:hidden;padding:10px;}
.side, .content {margin-bottom:-10000px;
 padding-bottom:10000px;}
.side{ float:left; width:200px;  }
.content { margin-left:220px;  }

.sidemenu {background: #fff;
border-radius: 5px;
-webkit-transition: all .2s ease-out;
transition: all .2s ease-out;
-webkit-box-shadow: 0 0 35px 0 rgba(154,161,171,.15);
box-shadow: 0 0 35px 0 rgba(154,161,171,.15);padding:10px;margin-bottom:30px;
 }
.treeaside {width:250px;height:100%;
position:fixed;left:-250px;top:0;padding:10px;}
.sidemenu:hover{box-shadow: 0 0 35px 0 rgba(154,161,171,.4);}
.users {
    <%=(mobile ? "padding-left:50px;" : "")%>
    }
.treemenu{left:10px;}
</style>

<div class="wrapper">
<%if(!mobile){ %>
<div class="side"><%}%>
    <div class="<%=(mobile ? "treeaside" : "sidemenu") %>"><asp:Literal id="LitMenu" runat="server" /></div>
<%if(!mobile){ %>
</div>
<div class="content">
<%}%>
<%if(mobile){ %><span class="treemenu"></span><%} %>
<dl id="eSearchBox" class="ePanel" style="display:none;">
<dt><h1 onclick="showPanel(this);" class="search"><a href="javascript:;" class="cur" onfocus="this.blur();"></a>搜索</h1></dt>
<dd style="display:none;">
<asp:PlaceHolder ID="eSearchControlGroup" runat="server">
<form id="frmsearch" name="frmsearch" method="post" onsubmit="return goSearch(this);" action="">

<ev:eSearchControl ID="s2" Name="s2" ControlType="quick" Field="XMEng" Operator="like" DataType="string" runat="server" />
<table width="100%" border="0" cellpadding="0" cellspacing="0" class="eDataView">
<colgroup>
<col width="120" />
<col />
</colgroup>
<tr>
<td class="title">姓名：</td>
<td class="content"><span class="eform"><ev:eSearchControl ID="s1" Name="s1" ControlType="text" Field="MC" Operator="like" DataType="string" Width="300px" runat="server" /></span></td>
</tr>
<tr>
<td colspan="2" class="title" style="text-align:left;padding-left:125px;"><a class="button" href="javascript:;" onclick="if(frmsearch.onsubmit()!=false){frmsearch.submit();}"><span><i class="search">搜索</i></span></a></td>
</tr>
</table>
</form>
</asp:PlaceHolder>
</dd>
</dl>
<asp:Literal id="litBody" runat="server" />
<%if(!mobile){ %></div><%} %>
</div>


</body>
</html>