<%@ Page Language="C#" AutoEventWireup="true"  validateRequest="false"  CodeBehind="downModify.aspx.cs" Inherits="Czou2012.UI.Manager.Download.downModify" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>新增下载信息</title>
    <link type="text/css" rel="stylesheet" href="../Styles/style.css" />
    <link type="text/css" rel="stylesheet" href="../Styles/pagination.css" />
    <link type="text/css" rel="stylesheet" href="../Styles/table.css" />
    <link rel="stylesheet" type="text/css" href="../Scripts/themes/default/easyui.css" />
    <link rel="stylesheet" type="text/css" href="../Scripts/themes/icon.css" />
    <link type="text/css" rel="stylesheet" href="../Scripts/Tips/tip-yellowsimple/tip-yellowsimple.css" />
    <script type="text/javascript" src="../Scripts/jquery.min.js"></script>
    <script type="text/javascript" src="../Scripts/jquery.form.js"></script>
    <script type="text/javascript" src="../Scripts/jquery.easyui.min.js"></script>
    <script type="text/javascript" src="../Scripts/jquery.validate.field.js"></script>
    <link rel="stylesheet" href="../Kindeditor/themes/default/default.css" />
    <link rel="stylesheet" href="../Kindeditor/plugins/code/prettify.css" />
    <script type="text/javascript" charset="utf-8" src="../Kindeditor/kindeditor.js"></script>
    <script type="text/javascript" charset="utf-8" src="../Kindeditor/lang/zh_CN.js"></script>
    <script type="text/javascript" charset="utf-8" src="../Kindeditor/plugins/code/prettify.js"></script>
    <script type="text/javascript" src="../Scripts/DateTimePicker/WdatePicker.js"></script>
    <script type="text/javascript">
        KindEditor.ready(function (K) {
            var editor = K.create('#txtSummary', {
                uploadJson: '../KindEditor/DotnetUpload/upload_json.ashx?updir=/UploadFiles/News/',
                fileManagerJson: '../KindEditor/DotnetUpload/file_manager_json.ashx?updir=/UploadFiles/News/',
                pasteType : 1,
                allowFileManager: true,
                afterCreate: function () {
                    var self = this;
                    $('#btnModify').click(function () {
                        self.sync();
                    });
                    
                }
            });
            prettyPrint();


            K('#btnUploadImage').click(function () {
                editor.loadPlugin('insertfile', function () {
                    editor.plugin.fileDialog({
                        imageUrl: K('#txtPictureSavePath').val(),
                        clickFn: function (url, title, width, height, border, align) {
                            K('#txtPictureSavePath').val(url);
                            editor.hideDialog();
                        }
                    });
                });
            });
        });

        //修改按钮事件--------------------------------------------------------------/
        function btnModify() {
            var Title = $.trim($('#txtTitle').val());
            var msg = $.ValidateField.CommonValidata(Title, "下载信息标题", 1);

            if (msg != $.ValidateField.OK) {
                msg = "(" + msg + ")";
                $('#lblDown').html(msg);
                $('#txtTitle').focus();
                $('#txtTitle').select();
                return;
            } else { $('#lblDown').html(""); }

            var options = {
                //参数说明：
                //1.用此方式提交时，form不能为runat="server"；
                //2.必须在表单form中加method="post"，此参数中加的method:'post'不能提交含大量表单域的form；
                //3.必须在cs文件中用Request["名称"]获取表单域的值，否则RequestString获取字符串长度有限制.
                target: '#lblDown',
                method: 'post',
                url: 'downModify.aspx?type=modify',
                beforeSubmit: function () {                    
                    // $('#btnModify').linkbutton({disabled:true});    // disable the button  
                },
                success: function (msg) {
                    if (msg == "1") {
                        if (Title.length >15) {
                            $("#lblDown").text("修改成功！(" + Title.substring(1,15) + "...)");
                        }
                        else {
                            $("#lblDown").text("修改成功！(" + Title + ")");
                        }
                        //  $('#btnModify').linkbutton('enable');    // disable the button  

                    }
                    else if (msg == "2") {
                        $("#lblDown").text("不能重复提交下载信息！");
                    }
                    else
                        $("#lblDown").text("新增有误，请检查！");
                    $('#btnModify').linkbutton({ text: "修改确认" });
                    $('#btnModify').linkbutton('enable');    // disable the button  
                    return false;
                },
                error: function () { $.messager.alert("操作提示", "请求异常！", "warning"); }
            };

            $('#formmodify').ajaxSubmit(options);
        }


        //reset复原按钮---------------------------------------------------------------------/
        function btnReset() {
            $("form").each(function () {
                this.reset(); //有效，其他无效
            });
            $("#lblDown").text("");
            $('#btnResetHidden').click();
            $('#btnModify').linkbutton('<%=Czou2012.UI.Manager.CommonClass.OperatorRight.IsRightButton("enable","w")%>');    // enable the button  
          
        }

        //打开下载信息浏览Tab-----------------------------------------------------------/
        function btnBackList() {
            window.parent.tabSelect(0);
        }

        //页面属性 Start--------------------------------------------------------------/
        $(function () {
            $('#btnModify').linkbutton('<%=Czou2012.UI.Manager.CommonClass.OperatorRight.IsRightButton("enable","m")%>');    // disable the button  
//            $.mask.definitions['~'] = '[012]';
//            $.mask.definitions['-'] = '[0123]';
//            $("#txtPublishTime").mask("~999/~9/-9 ~9:99:99");

              })
    </script>
</head>
<body>
    <div class="tableHeader">
        <span class="navImage">&nbsp;</span><asp:Label ID="lblNavigator"  class="lblNavigator" runat="server"></asp:Label>
        <span class="lblNavigator"> > 修改下载信息</span>
    </div>
    <form id="formmodify" name="formmodify" method="post">
    <div>
        <table class="pureTable" id="frmBottom">
            <tr style="height:35px">
                <td style="text-align: right; padding-right:5px; width:80px;">
                    <input type="hidden" name="txtInfoID" id="txtInfoID"  runat="server"/>
                    <input type="hidden" name="txtColumnCode" id="txtColumnCode"  runat="server"/>
                    <input type="hidden" name="txtInfoRndCode" id="txtInfoRndCode" runat="server" />
                    下载信息标题:
                </td>
                <td>
                    <input type="text" name="txtTitle" id="txtTitle" class="inputAdd" style="width: 360px;"
                        maxlength="50"  runat="server" />
                    &nbsp;&nbsp;&nbsp;副 标 题:
                    <input type="text" name="txtSubTitle" id="txtSubTitle" class="inputAdd" style="width: 322px;"
                        maxlength="50"  runat="server" />
                </td>
            </tr>
            <tr style="height:35px">
                <td style="text-align: right; padding-right:5px;">
                    关键词组:
                </td>
                <td>
                    <input type="text" name="txtKeywords" id="txtKeywords" class="inputAdd" style="width: 150px;"
                        maxlength="24"  runat="server" />","分隔&nbsp;&nbsp;&nbsp;&nbsp;日期:
                    <input type="text" name="txtPublishTime" id="txtPublishTime" class="inputAdd" style="width: 122px;"
                        maxlength="24" onfocus="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss'})" runat="server" />
                    &nbsp;&nbsp;标题颜色:
                    <select name="txtTitleColor" id="txtTitleColor" class="inputAdd" style="width: 60px;"  runat="server" >
                        <option value="">默认</option>
                        <option value="red" style="background: red">红色</option>
                        <option value="blue" style="background: blue">蓝色</option>
                        <option value="green" style="background: green">绿色</option>
                    </select>
                    &nbsp;来源:
                    <input type="text" name="txtSource" id="txtSource" class="inputAdd" style="width: 222px;"
                        maxlength="24"  runat="server" />
                </td>
            </tr>
            <tr style="height:35px">
                <td style="text-align: right; padding-right:5px;">
                    下载文件上传:
                </td>
                <td style="vertical-align: middle;">
                    <input type="text" name="txtPictureSavePath" id="txtPictureSavePath" class="inputAdd" style="width:670px;"
                        readonly="readonly"  runat="server"/>
                    <a id="btnUploadImage" class="easyui-linkbutton" href="#" tabindex="5">上传文件</a>
                &nbsp;&nbsp;</td>
            </tr>
            <tr style="height:35px">
                <td style="text-align: right; padding-right:5px;" valign="middle">
                    下载说明:
                </td>
                <td>
                    <textarea name="txtSummary" id="txtSummary" cols="100" rows="8" style="width: 755px;
                        height: 300px; visibility: hidden;"  runat="server"></textarea>
                </td>
            </tr>
            <tr>
                <td colspan="2">
                    <table style="width: 100%; border: 0px; height: 30px;">
                        <tr>
                            <td style="width: 280px; border: 0px;">
                                <span id="lblDown" style="line-height: 25px; color: #ff0000; width:280px;"></span>
                            </td>
                            <td style="border: 0px;">
                                <div class="divCenter divMiddle" style="width: 450px; float: left;">
                                    <a id="btnModify" class="easyui-linkbutton" icon="icon-ok" href="javascript:btnModify();"
                                        tabindex="5" style="margin-right: 50px;">修改确认</a> <a id="btnReset" class="easyui-linkbutton"
                                            icon="icon-undo" href="javascript:btnReset();" tabindex="6"  style="margin-right: 50px;">复原</a><a id="btnQuery" class="easyui-linkbutton" icon="icon-back"  href="javascript:btnBackList();" tabindex="13">返回</a><input type="reset" id="btnResetHidden" style="display:none" />
                                </div>
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>
    </form>
</body>
</html>
