<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="MyMeetingSpeakerEdit.ascx.cs" Inherits="AVA.ResourcesPlatform.WebUI.Control.My.MyMeetingSpeakerEdit" %>
<div class="well">
    <div class="p_title">
        <span class="title">我的教研:</span>教研主讲人编辑 <span class="f_r">
            <%= new HtmlAnchor("教研信息") { Href= WebUrl.MyMeetingEdit(this.Meeting.Guid) }%>
            |
            <%= new HtmlAnchor("教研人员") { Href= WebUrl.MyMeetingUserList(this.Meeting.Guid) }%>
            |
            <%= new HtmlAnchor("教研申请人") { Href= WebUrl.MyMeetingUserApplyList(this.Meeting.Guid) }%>
            |
            <%= new HtmlAnchor("教研附件") { Href= WebUrl.MyMeetingAttachmentList(this.Meeting.Guid) }%>
            |
            <%= new HtmlAnchor("教研视频") { Href= WebUrl.MyMeetingVideoList(this.Meeting.Guid) }%>
        </span>
    </div>
    <hr />
    <div class="userInput pwd">
        <form id="frmMeetingSpeakerEdit" action="" method="post" onsubmit="return false;">
        <table border="0px" cellpadding="2px" cellspacing="2px" class="myTab">
            <tr>
                <td style="text-align: right; width: 150px;"><span class="label"><span class="required">*</span>姓名:</span></td>
                <td>
                    <%= new HtmlText("Name", this.ViewData["_MeetingSpeaker.Name"],32)%>
                    <%= new HtmlYKTip("Name")%>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;"><span class="label"><span class="required">*</span>职务:</span></td>
                <td>
                    <%= new HtmlText("Headship", this.ViewData["_MeetingSpeaker.Headship"],32)%>
                    <%= new HtmlYKTip("Headship")%>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;"><span class="label"><span class="required">*</span>照片:</span></td>
                <td>
                    <table border="0px">
                        <tr>
                            <td>
                                <%= new HtmlHidden("Photo", this.ViewData["_MeetingSpeaker.Photo"]) { Class = "ipt-t ipt-t-dft " }%>
                                <%= new HtmlImg(SettingGroup.MeetingSpeakerPhoto(this.ViewData["_MeetingSpeaker"]), "") { ID = "imgPhoto", Width=120, Height=120, OnErrorImg=SettingGroup.DefaultImg }%>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <input type="button" value="上传照片" onclick="UploadMeetingSpeakerPhoto();" style="width: auto;" />
                                <%= new HtmlYKTip("Photo")%>
                            </td>
                        </tr>
                        <tr>
                            <td>支持.jpg、gif、png格式的图片 </td>
                        </tr>
                    </table>
                    <script type="text/javascript">
                        function UploadMeetingSpeakerPhoto() {
                            UploadFile('#frmMeetingSpeakerEdit [name=Photo]', '主讲人头像上传', '0', '<%= SettingGroup.MeetingSpeakerUploadPath %>', '', '240', '240');
                        }
                    </script>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;"><span class="label">描述:</span></td>
                <td>
                    <%= new HtmlTextArea("Description", this.ViewData["_MeetingSpeaker.Description"], 2000)%>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;"><span class="label"><span class="required">*</span>排序号:</span></td>
                <td>
                    <%= new HtmlText("SortNumber", this.ViewData["_MeetingSpeaker.SortNumber"], 4) { DefaultValue = 0 }%>
                    <%= new HtmlYKTip("SortNumber") %>
                </td>
            </tr>
            <tr>
                <td style="text-align: right;"></td>
                <td></td>
            </tr>
            <tr>
                <td style="text-align: right;"></td>
                <td>
                    <%= new HtmlHidden("Key",this.KEY)%>
                    <%= new HtmlHidden("ParentMeeting", this.Meeting.Guid)%>
                    <%= new HtmlSubmit(IN(this.ViewData["_MeetingSpeaker"], "修改主讲人", "添加主讲人"), "MeetingSpeakerEdit", "MeetingSpeakerEditClient(this);").Style(new { Width = "100px" })%>
                </td>
            </tr>
        </table>
        </form>
    </div>
    <script type="text/javascript">

        //验证控件
        $.validator.initConfig({ validatorGroup: "MeetingSpeakerEdit", form: "#frmMeetingSpeakerEdit", alertMessage: true, showMessage: false });

        //姓名
        $("#frmMeetingSpeakerEdit [name=Name]").formValidator({
            validatorGroup: "MeetingSpeakerEdit",
            rules:
        {
            required: null
        },
            message:
        {
            required: "请输入主讲人姓名"
        }
        });
        //照片
        $("#frmMeetingSpeakerEdit [name=Photo]").formValidator({
            validatorGroup: "MeetingSpeakerEdit",
            rules:
        {
            required: null
        },
            message:
        {
            required: "请上传主讲人照片"
        }
        });
        //职务
        $("#frmMeetingSpeakerEdit [name=Headship]").formValidator({
            validatorGroup: "MeetingSpeakerEdit",
            rules:
        {
            required: null
        },
            message:
        {
            required: "请输入主讲人职务"
        }
        });
        //排序号
        $("#frmMeetingSpeakerEdit [name=SortNumber]").formValidator({
            validatorGroup: "MeetingSpeakerEdit",
            rules:
        {
            required: null,
            regex: "num1"
        },
            message:
        {
            required: "排序号不能为空",
            regex: "排序号应为数字"
        }
        });
    </script>
    <script type="text/javascript">
        function MeetingSpeakerEditClient(send) {
            $.ajax(
        {
            cache: false,
            type: "POST",
            url: Global.Site + "/Ajax.aspx?AVA.ResourcesPlatform.Ajax.ClientAjax.MeetingSpeakerEdit",
            data: Global.GetFormValue($("#frmMeetingSpeakerEdit")),
            async: true,
            dataType: 'json',
            success: function (result) {
                $(send).val('<%= IN(this.ViewData["_MeetingSpeaker"],"修改主讲人", "添加主讲人") %>');
                alert('<%= IN(this.ViewData["_MeetingSpeaker"],"教研主讲人修改成功", "教研主讲人添加成功") %>');
                Global.Disabled(send, false);
                window.location.href = result;
            },
            beforeSend: function () {
                $(send).val('<%= IN(this.ViewData["_MeetingSpeaker"],"正在修改主讲人...", "正在添加主讲人...") %>');
                Global.Disabled(send, true);
            },
            complete: function () {
            },
            error: function (XMLHttpRequest, textStatus, errorThrown) {
                $(send).val('<%= IN(this.ViewData["_MeetingSpeaker"],"修改主讲人", "添加主讲人") %>');
                Global.Disabled(send, false);
                var message = XMLHttpRequest.responseText;
                Global.Error(message);
            }
        });
        }
    </script>
</div>