<%@ Page Language="C#" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Plus.Content.PostInfo" CodeBehind="PostInfo.aspx.cs" %>

<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.BLL" %>
<%@ Import Namespace="Kesion.Config" %>
<%@ Import Namespace="Kesion.Components" %>
<%@ Import Namespace="Kesion.HtmlTags" %>
<%@ Import Namespace="Kesion.XML" %>
<%@ Import Namespace="System.Data" %>
<%@ Import Namespace="System.Xml" %>
<%@ Import Namespace="Kesion.Controls" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title></title>
    <link href="/SysImg/person/person.css" rel="stylesheet" />     
    <script src="/ks_inc/jquery.js"></script>
    <script src="/KS_Inc/Kesion.Common.js"></script>  </head>

<body>
    <div class="r_tybox nomar">
        <%if (ClassID == 0)
            { %>
        <input type="hidden" id="classid" name="classid" value="0" />
        <div class="r_title r_title_color">选择发布栏目</div>
        <table class="border" cellspacing="2" cellpadding="1" width="96%" align="center" border="0">

            <tr>
                <td style="padding-left: 5px; height: 320px; border-bottom: 0px;">
                    <style>
                        #loadclass li.select_list {
                            width: 190px;
                            background: #fff;
                            text-align: left;
                            margin-left: 20px;
                            float: left;
                            height: 300px;
                            overflow-x: hidden;
                            overflow-y: auto;
                            border: 1px solid #d0d6dc
                        }

                            #loadclass li.select_list li {
                                cursor: pointer;
                                padding-left: 20px;
                                height: 30px;
                                line-height: 30px;
                            }

                                #loadclass li.select_list li.curr {
                                    background: #E6F2FB
                                }

                                #loadclass li.select_list li:hover {
                                    background: #f4f7f9;
                                }

                        .hover_tips_cont {
                            padding-left: 10px;
                        }
                    </style>
                    <div>
                        <ul id="loadclass"></ul>
                    </div>
                </td>
            </tr>
            <tr>
                <td style="padding-left: 15px;">
                    <div style="margin-top: 10px; display: block; clear: both;" class="tips_choice">
                        <span class="tips_zt"></span>
                        <dl class="hover_tips_cont">
                            <dt id="commodityspan">
                                <span style="color: #F00;">请选择栏目</span>
                            </dt>
                            <dt class="current_sort" style="font-weight: bold; display: none;" id="commoditydt">您当前选择的栏目是：</dt>
                            <dd id="commoditydd"></dd>
                        </dl>
                    </div>
                </td>
            </tr>

            <tr>
                <td style="height: 50px; padding-left: 25px; border-bottom: 0">
                    <input style="float: left" type="button" onClick="return (checknext())" class="button" value=" 下一步 " />
                    <input style="float: left;margin-left: 20px;" type="button" onClick="top.location.href='<%=GetUrl%>',top.location.reload()" class="button" value=" 返回 " />
                </td>
           
            </tr>
        </table>



        <script>
            $(document).ready(function () {
                loadClass(0, 1);
            });

            function loadClass(id, depth) {
                jQuery.get("/plus/ajaxs.ashx", {
                    a: "getinputclass",
                    rnd: Math.random(),
                    classid: id
                },
                    function (data) {
                        $("#loadclass").find("li").each(function () {
                            if ($(this).attr("depth") > depth) {
                                $(this).remove();
                            }
                        });
                        if (data != '') {
                            $("#loadclass").append(data);
                            //  autoIframeHeight();
                        }
                    });
            }

            function changeclass(id, parentid, depth) {
                $("#commodityspan").hide();
                $("#commoditydt").show();
                $("#commoditydd").show();

                $("#classid").val(id);
                $("#loadclass").find("li[depth=" + depth + "]").removeClass("curr");
                $("#loadclass").find("li[value=" + id + "]").addClass("curr");
                loadClass(id, depth);
                var tips = '';
                $("#loadclass").find("li.curr").each(function () {
                    if (tips == '') {
                        tips = $(this).html();
                    } else {
                        tips += " -> " + $(this).html();
                    }
                });
                $("#commoditydd").html(tips);
            }

            function checknext() {
                var classid = $("#classid").val();
                if ($("#m" + classid)[0] != undefined) {
                    KesionJS.Alert("请选择您好要发布分类！");
                    return false;
                }
                var postUrl = '/plus/content/postinfo.aspx';
                postUrl += "?classId-" + classid;
                location.href = postUrl;
            }
        </script>
        <%}
            else
            {

                Kesion.APPCode.EditorAPI.EchoHead();
        %>
        <script type="text/javascript" src="/ks_inc/DatePicker/WdatePicker.js"></script>
        <script>
            function GetKeyTags() {
                var text = escape(jQuery('#Title').val());
                if (text != '') {
                    jQuery('#KeyTags').val('请稍等,系统正在自动获取tags...').attr("disabled", true);
                    jQuery.get("/plus/ajaxs.ashx", {
                        a: "GetTags",
                        text: text
                    },
                        function (data) {
                            jQuery('#KeyTags').val(unescape(data)).attr("disabled", false);
                        });
                } else {
                    KesionJS.Alert('对不起,请先输入标题!', "jQuery('#Title').focus();");
                }
            }
            //加载文档
            function LoadItemInfo(objId, classID, channelId, infoId) {
                $.ajax({
                    type: "POST",
                    url: "/plus/Ajaxs.ashx",
                    data: "classid=" + classID + "&a=LoadItemInfo&channelid=" + channelId + "&infoid=" + infoId,
                    success: function (data) {
                        $("#" + objId).empty().append(unescape(data));
                    }
                });
            }
        </script>
        <KS:ModelJS ID="ModelJS1" runat="server" />
        <%if (ChannelID >= 2)
            {%>
        <script>
            var post_params = {
                "username": "<%=new TemporaryVar().UserName%>","password": "<%=new TemporaryVar().PassWord%>",
                "CreateThumbs": 1,
                "ChannelID": 2,
                "AutoRename": 4,
                "addwatermark": "1",
                "fieldid": "-1",
                "upbyswf": 1
            };
        </script>
        <%}%>
        <%=JSStr %>
        <iframe src="about:blank" name="hidframe" style="display: none; width: 0px; height: 0px"></iframe>
        <form name="myform" action="/plus/content/postinfo.aspx" method="post" id="myform" target="hidframe" onSubmit="return(CheckForm())">
            <input type="hidden" name="action" value="dosave" />
            <input type="hidden" name="classId" value="<%=ClassID %>" />
             <input type="hidden" name="infoID" value="<%=infoID %>" />
            <%
                using (DataTable dt = MyCache.GetCacheFieldGroupTable())
                {
                    DataView dv = dt.DefaultView;
                    dv.RowFilter = "channelid =" + ChannelID;
                    DataTable newDt = dv.ToTable();
                    if (newDt.Rows.Count <= 0)
                    {
                        Msg.Alert("加载出错啦！请联系管理员！");
                        return;
                    }
                    else
                    {
                        foreach (DataRow dr in newDt.Rows)
                        {
            %>
            <table class="border" width="98%" align="center" border="0">
                <tr class="title">
                    <td align="left " colspan="2">
                        <%=dr["GroupName"].ToString() %>
                    </td>
                </tr>

                <%
                                string GroupId = Convert.ToString(dr["ID"].ToString());


                                DataSet ds = XmlObject.StringToDataSet(fieldsxml);

                                DataTable dtf = ds.Tables[0];
                                DataView dvf = dtf.DefaultView;
                                dvf.RowFilter = "groupid=" + GroupId;
                                DataTable dtt = dvf.ToTable();
                                foreach (DataRow drr in dtt.Rows)
                                {
                                    MyUserFields field = new MyUserFields();
                                    field.ModelID = ChannelID.ToString();
                                    field.ClassID = ClassID.ToString();
                                    field.FieldID = drr["name"].ToString();
                                    field.ParentFieldID = drr["ParentFieldID"].ToString();
                                    field.FieldAlias = drr["FieldAlias"].ToString();
                                    field.FieldType = drr["FieldType"].ToString();
                                    field.Disabled = drr["Disabled"].ToString();
                                    field.FieldWidth = drr["FieldWidth"].ToString();
                                    field.FieldHeight = drr["FieldHeight"].ToString();
                                    field.Options = drr["Options"].ToString();
                                    field.Tips = drr["Tips"].ToString();
                                    field.DefaultValue = drr["DefaultValue"].ToString();
                                    field.ToolBar = drr["ToolBar"].ToString();
                                    field.ContributionItem = drr["ContributionItem"].ToString();
                                    field.MustFillItem = drr["MustFillItem"].ToString();
                                    KSCMS.W(field.Render());
                                }

                            }

                        }
                    }


                %>

                <tr class="tdbg">
                    <td class="lefttd" style="text-align: right;">售 价：</td>
                    <td class="list_right_box">
                        <input type="text" name="ReadPoint" class="textbox" value="<%=ReadPoint %>" style="text-align: center; width: 50px;" />
                        <%=Kesion.Cache.MyCache.GetCacheConfig(50) %> <span class="tips">免费阅读请设为 "<span style="color: red">0</span>"。</span>
                    </td>
                </tr>

                <tr class="tdbg">
                    <td class="lefttd" style="text-align: right;">状 态：</td>
                    <td class="list_right_box">
                        <input type="radio" value="0" name="Verify" <%=Verify==0? " checked":string.Empty %> />投搞
                                                                                                <input type="radio" value="2" name="Verify" <%=Verify==1? " checked":string.Empty %> />草稿

                    </td>
                </tr>
            </table>
            <div class="cz_btn t-a-center" align="center" style="padding-bottom: 20px;">
                <input type="submit" id="BtPostInfo" class="green-bt d-inline-block" value="确定发布"  />

            </div>

            <style>
                table.border td[width="11%"] {
                    white-space: nowrap
                }

                table.border .lefttd {
                    width: 18% !important;
                }

                .thumbshow {
                    float: left
                }

                    .thumbshow img {
                        width: 250px;
                        height: 360px;
                        overflow: hidden
                    }
            </style>
        </form>

        <%} %>
    </div>
    <script>
        var box1 = '';
    </script>
   
</body>

</html>
