<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="addWebResearOption.aspx.cs" Inherits="Web.User.addWebResearOption" %>
<!DOCTYPE html>
<!--[if lt IE 9]><html class="lte-ie8"><![endif]-->
<!--[if gt IE 8]><!-->
<html>
<!--<![endif]-->
<head>
    <title>addWebResearOption</title>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <!--#include file="../Css/head.htm"-->
    <!--#include file = "../Css/userCssEdit.htm" -->
        <script type="text/javascript" lang="javascript">

            //关闭弹出层 刷新列表
            function divClose(questionId, menuid, researId, bigclassid, type, currentPage) {
                parent.$.fancybox.close();
                parent.location = "manageWebResearOptions.aspx?pkId=" + questionId + "&menuId=" + menuid + "&researId=" + researId + "&bigClassPkId=" + bigclassid + "&type=" + type + "&currentPageIndex=" + currentPage;
            }
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div class="edit-func-box func-box">
        <div class="hd b">编辑</div>
        <div class="bd">
            <table class="edit-table">
                <tr>
                <th>
                    选项名称：
                </th>
                <td style="width:68%;">
                    <asp:TextBox ID="txtName" runat="server" CssClass="input-md"></asp:TextBox>
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*" ControlToValidate="txtName"></asp:RequiredFieldValidator>
                </td>
                </tr>
                <tr id="trIsTexbox" runat="server">
                    <th>
                        允许用户填写信息：
                    </th>
                    <td>
                        <asp:DropDownList ID="ddlIsTextbox" AutoPostBack="True" runat="server" OnSelectedIndexChanged="ddlIsTextbox_SelectedIndexChanged">
                            <asp:ListItem Value="1">是</asp:ListItem>
                            <asp:ListItem Selected="True" Value="0">否</asp:ListItem>
                        </asp:DropDownList>
                    </td>
                </tr>
                <tr id="trIsPic" runat="server">
                <th>
                    是否为图片：
                </th>
                <td>
                    <asp:DropDownList ID="ddlIsPic" AutoPostBack="True" runat="server" OnSelectedIndexChanged="ddlIsPic_SelectedIndexChanged">
                        <asp:ListItem Value="1">是</asp:ListItem>
                        <asp:ListItem Selected="True" Value="0">否</asp:ListItem>
                    </asp:DropDownList>
                </td>
                </tr>
                <tr id="UploadImages" runat="server" visible="false">
                <th>
                    预览图：
                </th>
                <td>
                        <div id="pho" runat="server" style="width:100px; height:100px;"></div>
                        宽度：<asp:TextBox ID="width" runat="server" onchange="change();" CssClass="input-mini">100</asp:TextBox>PX
                        高度：<asp:TextBox ID="height" runat="server" onchange="change();" CssClass="input-mini">100</asp:TextBox>PX
                        &nbsp;&nbsp;<a href="#" id="uploadimg" class="blue">上传图片</a>
                    
                    <input id="imageName" type="hidden" name="imageName" runat="server" />
                </td>
                </tr>
                </table>
        </div>
        <div class="ft">
            <div class="action-field text-center">
                <asp:Button ID="update" class="btn btn-sm btn-primary" runat="server" Text="添 加" OnClick="update_Click"></asp:Button>
                &nbsp;
                <input type="button" class="btn btn-sm btn-primary" value="关 闭" onclick="parent.$.fancybox.close();" />
                &nbsp;&nbsp;<asp:Label ID="labMsg" runat="server" Text=""></asp:Label>
            </div>
        </div>
    
    </div>
    </form>
    
    <script type="text/javascript" language="javascript">
        //自定义上传图片控件加载，支持自定义上传图片功能需先引用三个文件，[themes/default/default.css] [kindeditor.js] [lang/zh_CN.js]
        KindEditor.ready(function (K) {
            var editor = K.editor({
                uploadJson: '../Wpedt/UserEditor/aspnet/upload_json.ashx',
                fileManagerJson: '../Wpedt/UserEditor/aspnet/file_manager_json.ashx',
                allowFileManager: true
            });
            K('#uploadimg').click(function () {
                editor.loadPlugin('zdyimage', function () {
                    editor.plugin.zdyimageDialog({
                        zdyimageUrl: K('#imageName').val(),
                        clickFn: function (url) {
                            K('#imageName').val(url);
                            editor.hideDialog();
                            change();//加载预览图片
                        }
                    });
                });
            });

        });

    </script>
    
    <script language="javaScript">
        function change() {
            if (document.form1.imageName.value != "") {
                var arr = document.form1.imageName.value;
                if (arr.indexOf("http://")) {
                    arr = "" + arr;
                }
                pho.innerHTML = "<img src=" + arr + " height=" + document.form1.height.value + " width=" + document.form1.width.value + " />";
            }
        }
    </script>
</body>
</html>
