<%@ Page Language="c#" Inherits="Web.User.addPeople" CodeBehind="addPeople.aspx.cs" %>

<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8"><![endif]-->
<!--[if gt IE 8]><!-->
<html>
<!--<![endif]-->
<head>
    <title>人事物编辑</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--#include file = "../Css/head.htm" -->
    <!--#include file = "../Css/userCssEdit.htm" -->    
</head>
<body>
    <form id="addNews" method="post" runat="server">
    <div class="edit-func-box func-box">
        <div class="hd">
            编辑</div>
        <div class="bd">
            <table class="edit-table" id="Table1">
                <tr>
                    <th>
                        介绍类型：
                    </th>
                    <td>
                        <select id="introduceType" name="Select2" runat="server" onchange="selectChange();" class="input-md">
                            <option selected="selected" >人物介绍</option>
                            <option>事物介绍</option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <th>
                        照片预览区域：
                    </th>
                    <td>
                        <div id="pho" runat="server" class="pic-div  pull-left"></div>
                       <br /> 宽度：<asp:TextBox ID="width" runat="server" onchange="change();" notNull="true" dataType="integer" maxValue="9999" minValue="0" msgName="宽度" class="input-mini" >158</asp:TextBox>px
                        ，高度：<asp:TextBox ID="height" runat="server" onchange="change();" notNull="true" dataType="integer" maxValue="9999" minValue="0" msgName="高度" class="input-mini" >118</asp:TextBox>px
                        <br /><br /><a id="image1" href="#" class="blue">上传照片</a>
                    </td>
                </tr>
                <tr>
                    <th>
                        基本信息设置：
                    </th>
                    <td>
                        <asp:TextBox ID="name" notNull="true" msgName="姓名" class="input-md w3" MaxLength="50" runat="server">姓名：</asp:TextBox>
                        &emsp;性别：<asp:DropDownList ID="sex" runat="server" CssClass="input-md">
                            <asp:ListItem Value="男">男</asp:ListItem>
                            <asp:ListItem Value="女">女</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <th>
                    </th>
                    <td>
                        <asp:TextBox ID="department" runat="server" class="input-md w3" MaxLength="50" >部门：</asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <th>
                    </th>
                    <td>
                        <asp:TextBox ID="honorType" runat="server" class="input-md w3" MaxLength="50" >荣誉类型：</asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <th>
                    </th>
                    <td>
                        <asp:TextBox ID="honorGrade" runat="server" class="input-md w3" MaxLength="50" >荣誉等级：</asp:TextBox>
                    </td>
                </tr>
                <tr>
                    <th>
                        相关设置：
                    </th>
                    <td>
                        <asp:CheckBox ID="isTop" runat="server" Text="固顶"></asp:CheckBox>
                        &emsp;&emsp;浏览权限：
                        <asp:DropDownList ID="gate" runat="server" CssClass="input-md">
                        </asp:DropDownList>
                       &emsp;&emsp; 显示等级：
                        <asp:DropDownList ID="grade" runat="server"  CssClass="input-md">
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr>
                    <th>
                        简介：
                    </th>
                    <td>
                        <textarea name="content" style="width: 100%; height:260px; visibility: hidden;" ></textarea>
                    </td>
                </tr>
            </table>
        </div>
        <div class="ft">
            <div class="action-field text-center">
                <asp:Button ID="btn_ok" runat="server" Text="添 加" OnClientClick="return checkAll()" OnClick="btn_Click" class="btn btn-sm btn-primary" ></asp:Button>
                &emsp;
                <asp:Button ID="btn_cancel" runat="server" Text="取 消" CausesValidation="False" OnClick="btn_Click" class="btn btn-sm btn-primary" ></asp:Button>  &emsp;
                    <asp:Label ID="lbTip" runat="server" ForeColor="Red" Text=""></asp:Label>
            </div>
            <!--/action-field-->
        </div>
        <div>
            <input id="infoBody" type="hidden" name="infoBody" runat="server" />
            <input id="imageName" type="hidden" name="Hidden1" runat="server" value="../Images/uploadfiles/nopic.gif"/>
            <input id="content1" type="hidden" name="content1" runat="server" />
        </div>
    </div>
            <!--#include file = "../Css/foot.htm" -->
    <script type="text/javascript" >
        var WpEditor;   //声明编辑器
        
		KindEditor.ready(function(K) {
			WpEditor = K.create('textarea[name="content"]');

			K('#image1').click(function() {
				WpEditor.loadPlugin('zdyimage', function() {
					WpEditor.plugin.zdyimageDialog({
						zdyimageUrl : K('#imageName').val(),
						clickFn : function(url) {
							K('#imageName').val(K.formatUrl(url, 'domain'));
							K('#imageName').val();
							WpEditor.hideDialog();
							change();//加载预览图片
						}
					});
				});
			});			
			
            var initcontxt=document.getElementById("content1");
            WpEditor.insertHtml(initcontxt.value);  //加载初始内容

		});
			
		//加载预览图片  （201407 shijian 统一把document.formID.objectID.**写法替换为 $("ID").写法）
		function change() {
		    var arr = $("#imageName").val();
		    if (arr != "") {
		        //if (arr.indexOf("http://") > -1 )
		        //{
		        //    arr = "" + arr;
		        //}
		        var imgstr = "<img src=" + arr + " height=" + $("#height").val() + " width=" + $("#width").val() + " />";
		        $("#pho").html(imgstr);
		    }
		}

		//在保存之前,验证输入是否正确
		function checkAll() {
		    //验证
		    if (checkAllValidate()) {
		        //判断内容是否为空
		        var etxtisempty = WpEditor.isEmpty();
		        if (etxtisempty) {
		            alert("简介内容不能为空！");
		            return false;
		        } else {
		            //获取文章内容
		            var gettxttitle = WpEditor.html();
		            var contxt = document.getElementById("content1");
		            contxt.value = gettxttitle;
		        }
		        return true;
		    } else {
		        return false;
		    }
		}

    </script>
    
    </form>
</body>
</html>
