<%@ Page Title="" Language="C#" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin.Yun.KS_Server" Async="true" Codebehind="KS.Server.aspx.cs" %>
<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.BLL" %>

<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" runat="server">
              
<style>
.scroll_Rcontent{padding-right:0}
.content-area{margin-right:20px}
.CT2 td{text-align:center}
.mr100{margin-right:100px}
.gry{color:#999}
.red{color:#fe5858}
.column{height: 40px;background: #f3f7ff;line-height: 38px;border: 1px solid #dce4e6;position: relative;border-left: 4px solid #35a7ba;display:block;padding-left:10px;font-size:14px;margin-top:10px;margin-bottom:-1px;}

.border1{border: 1px solid #dce4e6;}
.userimg{position: relative;padding: 0;width: 40px;height: 40px;border: 2px #E7F2FA solid;float: left;border-radius: 60px;overflow: hidden}
.userimg img{width:100%;height:100%}
.userinfo2{margin-top: 2px;word-wrap: break-word;padding:0 15px;font-size:14px;color:#999}
.userinfo3{color:#333}
</style>
<asp:Panel ID="Panel2" runat="server" Visible="true">

    <div class="content-area mt20" id="content-area">
        <!--<div class="myTitle noBorder-noP">
            在线服务中心
        </div>-->
        <div class="tabs_header">
            <ul class="tabs">
                <li class="<%=KSCMS.S("action")==""?"active":(KSCMS.S("action").ToLower()=="lookhelphome"?"active":"") %>">
                    <a href="?action=lookhelphome"  >
                       <span>帮助中心</span>
                    </a>
                </li>
                <li class="<%=KSCMS.S("action").ToLower()=="lookshareserver"?"active":"" %>">
                    <a href="?action=lookshareserver" >
                       <span>共享问题(<%=sharecount %>)</span>
                    </a>
                </li>
                <li class="<%=KSCMS.S("action").ToLower()=="addmyserver"?"active":(KSCMS.S("class").ToLower()=="addmyserver"?"active":"") %>">
                    <a href="?action=addmyserver" >
                       <span>创建工单</span>
                    </a>
                </li>
                <li class="<%= KSCMS.S("action").ToLower()=="myserveritem"?"active":(KSCMS.S("class").ToLower()=="myserveritem"?"active":"") %>">
                    <a href="?action=myserveritem" >
                       <span>我的工单(<%=myservercount %>)</span>
                    </a>
                </li>
            </ul>
		</div>
        <div class="quickSearch clearfix md20">
        	<div class="SearchBox fl">
                <asp:TextBox ID="SearchText" runat="server" class="text" style="margin-right:8px;"></asp:TextBox>
            	<asp:Button ID="SearchBtn" runat="server" Text="搜索" OnClick="SearchBtn_Click"  class="button" />
                <input type="hidden" value="1"> 
            </div>
        </div>
    <asp:Panel ID="PanelInfo" runat="server" style="clear:both;overflow:hidden;">
	 
    <asp:Panel ID="PublicPanel" runat="server" Visible="false">
        <div style="float:left">
            <span style="margin-bottom:10px;display:inline-block;color:#333;font-size:16px" >推荐教程</span>
            <asp:Repeater ID="RecommendRepeater" runat="server">
                <ItemTemplate>
                    <div style="margin-top:10px;color:#666;font-size:14px"><a href="<%#Eval("url") %>" target="_blank"><%#Eval("title") %></a></div>
                </ItemTemplate>
            </asp:Repeater>
        </div>
        <div style="float:left;margin-left:120px">
            <span style="margin-bottom:10px;display:inline-block;color:#333;font-size:16px;">常见问题</span>
            <asp:Repeater ID="UsualRepeater" runat="server">
                <ItemTemplate>
                    <div style="margin-top:10px;color:#666;font-size:14px"><a href="<%#Eval("url") %>" target="_blank"><%#Eval("title") %></a></div>
                </ItemTemplate>
            </asp:Repeater>
        </div>
    </asp:Panel>
    
    
    <asp:Panel ID="HelpHomePanel" runat="server" Visible="true">
	<div style="overflow:hidden;padding:0 1%;">
	   <div class="help_list1" style="float:left">
              <div id="help"> 
		</div>
           </div>
           <div style="float:right;width:25%" class="help_list2 help_list" >
              <span class="title_blue">推荐教程</span>
              <ul>
                <%=GetSomeInfo(1) %>
              </ul>
              <span class="title_blue">常见问题</span>
              <ul>
                <%=GetSomeInfo() %>
              </ul>
            </div>
	</div>
         
        <script>
            $(function () {
                $.ajax({//初始化
                    type: 'get',
                    url: "KS.Server.aspx?action=gethelpclass&key=<%=this.SearchText.Text %>",
                    dateType: 'json',
                    success: function (obj) {
                        var info = JSON.parse(obj);
                        var datalength = info.data.length;
                        for (var i = 0; i < datalength; i++)
                        {
                            var title = info.data[i].module1;
                            $('#help').append("<h3>" + title + "</h3>");//大标题
                            var contentlength = info.data[i].content.length;
                            $('#help').append("<ul id='u"+i+"' class='wrap-ul' ></ul>");
                            for (var c = 0; c < contentlength; c++) {
                                var threelength = info.data[i].content[c].content.length;

                                var threetitle = info.data[i].content[c].module2;
                                
                                if (threelength > 0) {
                                    $('#u' + i).append("<li><h4>" + threetitle + "</h4><ul id='t" + i + c + "' class='inner-ul'></ul></li>");
                                    for (var t = 0; t < threelength; t++) {
                                        $('#t' + i + c).append("<li><a target='_blank' href='" + info.data[i].content[c].content[t].url + "'>" + info.data[i].content[c].content[t].title + "</a></li>");//大标题下的内容信息
                                    }
                                } else {
                                    //$('#t'  +i+ c ).append("<p class='data-null'>数据都跑啦~~~~程序员已经在去追的路上了</p>");
                                }
                            }
                        }
                    }
                })

            })
            
        </script>
        </asp:Panel>
        
    <asp:Panel ID="ShareServerPanel" runat="server" Visible="false">
        <table class="CTable CTable2">
            <tr class="CTitle">
               <td width="20%">提问者</td>
               <td class="a-left">提问内容</td>
               <td>提问时间</td>
               <td class="a-left">解决方案</td>
            </tr>
        <asp:Repeater ID="ShareServerRepeater" runat="server">
            <ItemTemplate>
            <tr>
               <td align="center"><%# Utils.FormatName(Eval("customer").ToString()) %></td>
               <td align="left"><%#Eval("title").ToString().Replace("<img","<img style='display:none;'") %></td>
               <td style="width:250px" align="center"><%#Eval("adddate") %></td>
               <td style="width:400px" ><%#( Eval("answer").ToString().Length>50? (Eval("answer").ToString().Substring(0,50)+"<br />"):Eval("answer") )%>
                   <div id="s<%#Container.ItemIndex  %>" style="display:none;"><%#Eval("answer").ToString().Length>50?Eval("answer").ToString().Substring(50):Eval("answer") %></div>
                   <%#Eval("answer").ToString().Length>50?("<a href='javascript:;' onclick=ShowInfo("+Container.ItemIndex+") style='color:blue;' >查看</a>"):"" %>
               </td>
            </tr>
            </ItemTemplate>
            <FooterTemplate>
                <tr <%#this.ShareServerRepeater.Items.Count>0?"style='display:none'":"" %>>
                    <td colspan="4"><div class="empty">暂无共享数据信息</div></td>
                </tr>
            </FooterTemplate>
        </asp:Repeater>
          </table>
         <KS:Page ID="Page4" runat="server" />
         <script>
             function ShowInfo(id)
             {
                 if ($("#s" + id).is(':hidden')) {
                     $("#s" + id).show();
                 } else {
                     $("#s" + id).hide();
                 }
             }
         </script>
    </asp:Panel>

    </asp:Panel>


    <asp:Panel ID="ServerPanel" runat="server" Visible="false">

        <asp:Panel ID="ServerItemPanel" runat="server">
            <table  class="CTable CTable2">
                <tr class="CTitle">
                    <td>编号</td>
                    <td>问题内容</td>
                    <td>提交时间</td>
                    <td>状态</td>
                    <td>操作</td>
                </tr>
            <asp:Repeater ID="ServerItemRepeater" runat="server" OnItemCommand="ServerItemRepeater_ItemCommand">
                <ItemTemplate>
                 <tr >
                    <td align="center"><%#Eval("sequence") %></td>
                    <td align="left"><%#Eval("title").ToString().Replace("<img","<img style='display:none;'") %></td>
                    <td align="center"><%#Eval("adddate") %></td>
                    <td align="center"><%#GetStatus(Eval("status").ToString()) %></td>
                    <td align="center">
                        <asp:LinkButton ID="Searchlbtn" runat="server" title="查看" CommandName="look"   CommandArgument=<%# Eval("sequence") %>  >查看</asp:LinkButton> 
                    </td>
                </tr>
                </ItemTemplate>
                <FooterTemplate>
                  <tr <%#this.ServerItemRepeater.Items.Count>0?"style='display:none'":"" %>>
                     <td colspan="5"><div class="empty">暂无工单信息</div></td>
                  </tr>
                </FooterTemplate>
            </asp:Repeater>
            </table>
            
         <KS:Page ID="Page2" runat="server" />
        </asp:Panel>

        <asp:Panel ID="ServerWorkAdd" runat="server" Visible="false">
            <table  class="CTable">
                <tr >
                    <td class="lefttd">问题描述：</td>                  
                    <td class="righttd"> 
                        <textarea    name="problemcontent" id="problemcontent" style="width:80%;height:250px;"></textarea>
                        <script>jQuery(document).ready(function () { editor = UE.getEditor('problemcontent', { toolbars: [[  'undo', 'redo', '|', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat']], wordCount: false, autoHeightEnabled: false, scaleEnabled: false, elementPathEnabled: false }); });</script>
                          <div style="float:left;">
                         <iframe style="border:none; height:60px;width:400px;" src="?action=upload"></iframe>
                     </div>
                        <input style="margin-top:15px;border:none; width:50%;height:20px"  id="fileurlss" value="" type="text" />
                    </td> 
                      </tr> 
                <tr >
                    <td class="lefttd">网站信息（必填  网站后台链接   后台账户和密码）：</td>
                    <td class="righttd"><asp:TextBox ID="CustomerInfo" runat="server" TextMode="MultiLine" Width="70%" Height="150px"></asp:TextBox> 
                    </td> 
                </tr>
                <tr >
                    <td class="lefttd">机密信息（非必填项 服务器相关信息）：</td>
                    <td class="righttd"><asp:TextBox ID="ServerInfo" runat="server" TextMode="MultiLine"  Width="70%" Height="150px"></asp:TextBox></td> 
                </tr>
                <tr >
                    <td class="lefttd">联系手机号（二选一）：</td>
                    <td class="righttd"><asp:TextBox ID="Mobil" runat="server"></asp:TextBox></td> 
                </tr>
                <tr>
                    <td class="lefttd">联系邮箱号（二选一）：</td>
                    <td class="righttd"><asp:TextBox ID="Email" runat="server"></asp:TextBox></td> 
                </tr> 
                <tr>
                    <td class="lefttd">
                    </td>
                </tr>
                <tr>
                    <td colspan="2" align="center">
                        <span><input type="checkbox" name="pulibc" value="1" checked />共享</span>
                        <asp:Button ID="SaveServer" runat="server" Text="提交工单" OnClick="SaveServer_Click" class="button" OnClientClick="return(CheckSubmit())"  />
                        <span>(友情提示：如有附件请先上传文件,共享是判断您的问题能否被其他人浏览PS：只共享题目描述)</span>
                    </td> 
                </tr>
             </table> 
            <script>
                //校验提交数据
                function CheckSubmit()
                {
                    if (editor.getContent() == "") {
                        alert("问题描述不能为空！");
                        return false;
                    }else  if ($("#<%=this.CustomerInfo.ClientID %>").val() == "") {
                        alert("网站信息不能为空！");
                        return false;
                    } else if ($("#<%=this.Mobil.ClientID %>").val() == "" && $("#<%=this.Email.ClientID %>").val() == "") {
                        alert("请留下至少一个联系方式！");
                        return false;
                    } else {
                        return true;
                    }
                }
            </script>
        </asp:Panel>

        <asp:Panel ID="ServerWork" runat="server" Visible="false">
            <asp:Repeater ID="ServerWorkRepeater" runat="server">
                <ItemTemplate>
                    <div class="message">
                        <div class="mb"><span class="gry">问题标题:</span><%#Eval("title").ToString().Replace("<img","<br /><img onerror=this.src='/sysimg/nopic.gif' ") %></div>
                        <div ><span class="mr100"><span class="gry">工单编号:</span><%#Eval("sequence") %><input type="hidden" name="askid" id="askid" value="<%#Eval("sequence") %>" /></span><span class="mr100"><span class="gry">提交时间:</span><%#Eval("adddate") %></span><span class="mr100 red"><span class="gry">状态：</span><%#GetWorkStatus(Eval("status").ToString())  %> <input type="hidden" name="status"  /></span></div>
                    </div>
		            <hr style="height:2px;border:none;border-top:1px solid #eee;display:none">
                </ItemTemplate>
            </asp:Repeater>
            <div>
              <span class="column">沟通记录</span>
 <div style="padding:20px;border:1px solid #dce4e6;box-sizing:border-box;" class="Communicate">
             <asp:Repeater ID="ServerChatRepeater" runat="server">
               
                <ItemTemplate>
                    <div style="overflow:hidden;margin:10px auto">
                        <div class="fl userimg"><img src='<%#Eval("status").ToString()=="0"?"/sysimg/avatar.jpg":"/sysimg/server.png" %>' /></div> 
                        <div class="fl userinfo2 <%#Eval("status").ToString()=="0"?"userinfo2":"userinfo3" %>"  >
                        <div class="mb"><%#Eval("status").ToString()=="0"?"客户":"技术" %> : <%#Eval("title").ToString().Replace("<img","<img onerror=this.src='/sysimg/nopic.gif' ") %></div>
			<div class="mb"><%#Eval("url") %></div>
                        </div>
                    </div>
		    <hr style="height:2px;border:none;border-top:1px solid #eee">
                </ItemTemplate>
                 <FooterTemplate> 
                     <div <%#this.ServerChatRepeater.Items.Count<=0?"":"style='display:none'" %>>
                         <div class="empty">
                             暂无回复记录！
                         </div>
                     </div>
                 </FooterTemplate>
            </asp:Repeater>
     </div>
            </div>

            <div>
                <%if (status==0  || status == 3||status==4)       //未解决
                   { %>
                <div>
                        <span class="column">我要反馈</span>
                        <div style="padding:20px;border:1px solid #dce4e6;">
                            <div>
                                <p style="font-size:14px" class="Lheight36">留言：</p> 
                                <textarea name="problemcontent" id="problemcontent" style="width:80%;height:250px;"></textarea>
                                <script>jQuery(document).ready(function () { editor = UE.getEditor('problemcontent', { toolbars: [['undo', 'redo', '|', 'bold', 'italic', 'underline', 'fontborder', 'strikethrough', 'superscript', 'subscript', 'removeformat']], wordCount: false, autoHeightEnabled: false, scaleEnabled: false, elementPathEnabled: false }); });</script>
                            </div> 
                            <div style="<%=serverstatus==1?"display:none;":"" %>;margin-top:15px"><p style="font-size:14px">机密信息：</p><asp:TextBox ID="TxtJiMiXX" Width="800px" Height="150px" runat="server" TextMode="MultiLine" placeholder="请在此填写相关远程信息，提交后机密信息将进行加密处理" ></asp:TextBox></div>
                                <div style="clear:both;overflow:hidden; height:36px;" class="md20 mt20">
                                    <iframe style="border:none; height:60px;width:400px;" src="?action=upload"></iframe>
                                    <input style="margin-top:15px;border:none; width:50%;height:20px" name="fileurlss" id="fileurlss" value="" type="text" />
                                </div>
                                <div>  
                                    <asp:Button ID="ServerChat" runat="server" Text="提交"  OnClick="ServerChat_Click" class="button button_on" OnClientClick="return(CheckReplay())" />
                                    <span class="tips">(友情提示：如有附件请先上传文件)</span>
                                </div>
                            </div>
                        </div>
                    <%}
                       else if (status == 1) //已解决
                    { %>
                    <div>
                        <div>满意度调查：<asp:RadioButtonList ID="ServerRBtn" runat="server">
                            <asp:ListItem Value="0">差</asp:ListItem>
                            <asp:ListItem Value="1" Selected="True">一般</asp:ListItem>
                            <asp:ListItem Value="2">满意</asp:ListItem>
                            <asp:ListItem Value="3">非常满意</asp:ListItem>
                                  </asp:RadioButtonList></div>
                        <div>服务评价：<asp:TextBox ID="Remarks" runat="server" TextMode="MultiLine"></asp:TextBox></div>
                        <div><asp:Button ID="AssessBtn" runat="server" Text="提交评价" OnClick="AssessBtn_Click" /></div>
                    </div>
                    <%} %>
                </div>
         		<KS:Page ID="Page3" runat="server" />
				<script> 
                    //校验回复信息
                    function CheckReplay()
                    {
                        if (editor.getContent() == "") {
                            alert("请输入回复信息！");
                            return false;
                        } else {
                            return true;
                        }
                    }
                </script>
        </asp:Panel>
         
    </asp:Panel>
        </div>
    <script>
        function insertHTMLToEditor(codeStr) {
            var ue = UE.getEditor('problemcontent');
            codeStr = "<img src='" + codeStr + "' style='width:300px'>";
            ue.execCommand('insertHtml', codeStr);
        }
    </script>
    </asp:Panel>
<asp:Panel ID="Panel1" runat="server"  Visible="true">
            <asp:FileUpload ID="FileUpload2" runat="server"/>
            <asp:Button ID="Button1" runat="server" Text="确定上传" OnClick="ServerUploadButton_Click" class="button" /> 
</asp:Panel> 
</asp:Content>
