<%@ Page Title="网站首页" Language="C#" MasterPageFile="~/Masters/Sys.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="yueyaCMS.Admin.Site.Default" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
<style type="text/css">
#blocks{margin:0;padding:0}#blocks li{position:relative;display:inline-block;width:175px;margin:0 10px 10px 0;line-height:70px;text-align:center;vertical-align:middle;background-color:#F4F4F4;border:1px solid #E6E6E6}#blocks li sub,#blocks li b{display:none}#blocks li span a{display:block;height:50px;line-height:3;width:160px}#blocks li a:link,#blocks li a:visited,#blocks li a:hover{font-style:normal;color:#444}#blocks li span{display:inline-block;padding:0 7px;line-height:1.4;vertical-align:middle}#blocks li label{display:block;cursor:pointer}#blocks li label i{display:block;margin-top:5px;font-size:90%;color:#888}#blocks li:hover,#blocks li.checked{background-color:#f8e9d3;border-bottom-color:#eab567}#blocks li:hover,#blocks li:hover a{color:#f8530a}#blocks li div.source{background-color:#e1962d;bottom:-19px;color:#2B4001 !important;font-size:85%;left:0;line-height:19px;position:absolute;width:100%;z-index:10;overflow:hidden;display:none}#blocks li:hover div.source{bottom:-2px;background-color:#eab567;display:block}#blocks li div.source a,#blocks li:hover div.source a{color:#fff;margin:0px 4px}#blocks li:hover div.source a:hover{text-decoration:underline}#blocks li#AddNewPlatFormBtn{border-radius:5px;border:dashed 1px #999;font-size:70px;margin-left:8px;color:#b9b9b9;font-family:Arial;cursor:pointer;margin-left:0px}#blocks li#AddNewPlatFormBtn:hover{background:#fff}.barge{background:#94c2ec;border-radius:10px;color:white;padding:3px 5px;color:white;margin-left:-3px;margin-top:-5px}.danger{background:#E73C3C}.notify{height:20px;line-height:1;font-weight:bold;position:absolute;border-radius:10px;top:0px}.panel-body{border:1px solid #D2D3D6;padding:0px;height:auto}.pie{width:25%;float:left}.easypiechart{display:block;height:120px;line-height:120px;margin:0 auto;position:relative;text-align:center;width:120px}.easypiechart .percent{color:#808080;font-size:24px;font-weight:300;line-height:120px;position:absolute;width:120px}.table td label{display:block;margin-bottom:0;margin-top:5px;text-align:center}.panel-info{border-radius:2px;background-color:#FFFFFF;border-top:2px solid #2BBCE0;border-bottom:1px solid #D2D3D6;border-left:1px solid #D2D3D6;border-right:1px solid #D2D3D6;padding:20px;margin:0 0 20px}.btn-group>.btn-mini,.btn-mini{font-size:12px;letter-spacing:1px}.btn-mini .caret{border-top:4px solid #AEAEAE;margin-top:8px;margin-right:2px}.loadmodal{background:transparent url(/Images/loading.gif) center center no-repeat}.panel-info:hover{background:linear-gradient(#F6F6F6 0px,#FFFFFF 50px) repeat scroll 0 0 rgba(0,0,0,0);box-shadow:0 3px 10px rgba(0,0,0,0.15)}
</style>
<script src="/Scripts/easypiechart.js"></script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
<ul class="breadcrumb" style="margin-bottom: 10px;">
<li><i class="icon-tags"></i> 您当前的位置：<span>系统首页</span></li>
</ul>
    
    <div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">&times;</button>
            <h4>\(^o^)/~欢迎回来！<%=Session["User"]%>，现在是:<%=DateTime.Now.ToString("yyyy-MM-dd HH:mm") %> &nbsp;
            <a href="Setting.aspx" class="btn btn-warning">网站设置</a>&nbsp;&nbsp;
                
                  <div class="btn-group">
    <a class="btn dropdown-toggle  btn-success" data-toggle="dropdown">网站体检 <span class="icon-chevron-down icon-white"></span></a>
    <ul class="dropdown-menu">
    <li><a href="http://webscan.360.cn/index/checkwebsite?url=<%=yueyaCMS.Global.Settings["Biz_SiteAddress"] %>" target="_blank"><span class="label label-warning">360 卫士</span>&nbsp;网站检测</a></li>
    <li><a href="http://www.anquan.org/s/<%=yueyaCMS.Global.Settings["Biz_SiteAddress"] %>" target="_blank"><span class="label label-warning">安全联盟</span>&nbsp;网站检测</a></li>
    <li><a href="http://safeweb.norton.com/report/show?url=<%=yueyaCMS.Global.Settings["Biz_SiteAddress"] %>" target="_blank"><span class="label label-warning">诺顿在线</span>&nbsp;网站检测</a></li>
    <li><a href="http://www.siteadvisor.com/sites/<%=yueyaCMS.Global.Settings["Biz_SiteAddress"] %>" target="_blank"><span class="label label-warning">&nbsp;&nbsp;McAfee</span>&nbsp;网站检测</a></li>
    <li><a href="http://guanjia.qq.com/online_server/result.html?url=<%=yueyaCMS.Global.Settings["Biz_SiteAddress"] %>" target="_blank"><span class="label label-warning">腾迅软件</span>&nbsp;网站检测</a></li>
    </ul>
    </div>      

            </h4>
      <div>
        </div>
	</div>
      
    <div class="container-fluid" style="padding:0px;">
    <div class="row-fluid">
    <div class="span6 panel-info">
    <div class="clearfix">
    <h4 class="pull-left" style="margin: 0 0 20px;">热门新闻统计 
        <div class="btn-group">
                <a href="#" data-toggle="dropdown" class="btn-mini dropdown-toggle">(分辨率:今天&nbsp;<span class="caret"></span>)</a>
                <ul class="dropdown-menu">
                  <li><a href="#" onclick="setMode(this,1,1);">今天</a></li>
                  <li><a href="#" onclick="setMode(this,2,1);">7天内</a></li>
                  <li><a href="#" onclick="setMode(this,3,1);">月份</a></li>
                </ul>
        </div>
        </h4>
    <div class="btn-group pull-right" id="NewsStatisticsPager"></div>
    </div>
    <div id="NewsStatistics" class="loadmodal" style="height:250px;"></div>
    
    </div>
    
    <div class="span6 panel-info" style="margin-left:1.12766%;width:49.9362%;border-top:2px solid #4F5259">
    <div class="clearfix">
    <h4 class="pull-left" style="margin: 0 0 20px;">热门产品统计         <div class="btn-group">
                <a href="#" data-toggle="dropdown" class="btn-mini dropdown-toggle">(分辨率:今天&nbsp;<span class="caret"></span>)</a>
                <ul class="dropdown-menu">
                  <li><a href="#" onclick="setMode(this,1,2);">今天</a></li>
                  <li><a href="#" onclick="setMode(this,2,2);">7天内</a></li>
                  <li><a href="#" onclick="setMode(this,3,2);">月份</a></li>
                </ul>
        </div></h4>
    <div id="ProductStatisticsPager" class="btn-group pull-right"></div>
    </div>
    <div id="ProductStatistics" class="loadmodal" style="height:250px;"></div>
    </div>
    </div>
    </div>

    <table class="table table-bordered table-hover">
     <tr><th>&nbsp;<strong onclick="QQ_Init();">第三方平台&nbsp;<span id="platformsCount" class="barge"></span> </strong></th></tr>
<tr><td style="padding-bottom:0px;">
        <ul id="blocks"></ul>
    </td>
    </tr>
    </table>

    <table class="table table-bordered">
        <tr><th>网站负载图</th></tr>
        <tr>
            <td>
                <%
                    Int64 MaxMemory = 0, MaxDataBase = 0, MaxSite = 0;
                    double currentMemory = 0;
                    try { MaxMemory = Int64.Parse(yueyaCMS.Global.Settings["MaxMemory"]); } catch { MaxMemory = 0; }
                    try { currentMemory = ((Double)System.Diagnostics.Process.GetCurrentProcess().WorkingSet64 / 1048576); }
                    catch { currentMemory = 0; }
                    try { MaxDataBase = Int64.Parse(yueyaCMS.Global.Settings["MaxDataBase"]); } catch { MaxDataBase = 0; }
                    try { MaxSite = Int64.Parse(yueyaCMS.Global.Settings["MaxSite"]); } catch { MaxSite = 0; }
                     %>
                                <div class="pie" id="MaxMemory" title="最大内存上限<%=currentMemory.ToString("f2") %>MB/<%=MaxMemory.ToString("f0") %>MB">
                                    <div class="easypiechart" id="MemoryUsedChart" data-percent="<%=((Double)currentMemory/MaxMemory*100.00).ToString("f2")%>">
                                        <span class="percent"></span>
                                    </div>
                                    <label for="MemoryUsedChart">内存使用量</label>
                                </div>

                                <div class="pie" id="MaxDataBase" title="数据库最大上限<%=currentDataSize %>MB/<%=MaxDataBase %>MB">
                                    <span class="easypiechart" id="bouncerate" data-percent="<%=((Double)(currentDataSize/MaxDataBase*100.00)).ToString("f0") %>">
                                        <span class="percent"></span>
                                    </span>
                                    <label for="bouncerate">数据使用量</label>
                                </div>

                                <div class="pie" id="MaxSite" title="网站空间最大上限<%=currentSiteSize %>MB/<%=MaxSite %>MB">
                                    <span class="easypiechart" id="clickrate" data-percent="<%=((double)currentSiteSize/MaxSite*100.00).ToString("f2") %>">
                                        <span class="percent"></span>
                                    </span>
                                    <label for="clickrate">空间使用量</label>
                                </div>

                                <div class="pie" id="TaskProgress" title="<b>最后生成时间：<%=LastBuildTime %></b>，任务<%=currentTaskCount %>/<%=TotalTaskCount %>">
                                    <span class="easypiechart" id="covertionrate" data-percent="<%=((double)currentTaskCount/TotalTaskCount*100.00).ToString("f2") %>">
                                        <span class="percent"></span>
                                    </span>
                                    <label for="covertionrate">网站生成进度</label>
                                </div></td></tr>
             </table>

    <table class="table table-bordered table-hover">
     <tr><th colspan="2">服务器信息</th></tr>
     <tr>
     <td>服务器域名：http://<%=yueyaCMS.Global.Settings["Biz_SiteAddress"] %></td>
     <td>服务器IIS版本：<%=Request.ServerVariables["Server_SoftWare"] %></td>
     </tr>
     
     <tr>
     <td>系统用户名：<%=Environment.UserName%></td>
     <td>服务器端口：<%=Request.ServerVariables["Server_Port"]%></td>
     </tr>
     
     <tr>
     <td>已运行时间：<%= ((Environment.TickCount / 0x3e8) / 60)%>分钟</td>
     <td>Asp.net所占内存：<%=currentMemory.ToString("N2") + "M"%></td>
     </tr>
     
     <tr>
     <td>服务器时间：<%= DateTime.Now.ToString("yyyy-MM-dd")%></td>
     <td width="54%">当前会话数：<%=Session.Contents.Count%></td>
     </tr>
     
     <tr>
     <td>服务器系统：<%= Environment.OSVersion%></td>
     <td>服务器语言：<%=System.Globalization.CultureInfo.InstalledUICulture.EnglishName%></td>
     </tr>
     </table>
     
    <div id="myModal" class="modal hide fade" style="width:350px;left:60%;">
    <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>添加合作平台</h3>
    </div>
    <div class="modal-body" style="padding:0px 15px;">
        <p>
        <div class="input-prepend">
                        <span class="add-on"><i class="icon-home"></i> 平台名称</span>
            <input type="text" id="platformName" maxlength="100" />
            </div>
            </p>

        <p style="display:none;">
平台图标<a href="#" onclick="AddPicEx();" class="btn btn-success">选择图片</a>&nbsp;&nbsp;<img id="SelectedImgPath" width="50px" height="50px" /><input type="hidden" id="platformImg" />
    </p>
        
        <p>
            <div class="input-prepend">
                        <span class="add-on"><i class="icon-globe"></i> 连接网址</span>
                <input type="text" id="platformUrl" maxlength="500" />
                </div>
        </p>
        <p>
        <div class="input-prepend">
                        <span class="add-on"><i class="icon-edit"></i> 平台备注</span>
<input type="text" id="platformRemark" maxlength="500" /></div>
            </p>

                <p>
        <div class="input-prepend">
        <span class="add-on"><i class="icon-edit"></i> JSSDK：当前合作平台提供的JS-SKD。</span>
        </div>
        </p>

        <textarea id="JSSDK" rows="2" cols="10" style="width:96%;"></textarea>

    </div>
    <div class="modal-footer">
    <a href="#" class="btn" onclick="showModal(0);">取消</a>
    <a href="#" class="btn btn-primary" onclick="Platform_Add();">确认添加</a>
    </div>
    </div>

    <div id="myModal2" class="modal hide fade" style="width:350px;left:60%;">
    <div class="modal-header">
    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
    <h3>修改合作平台信息</h3>
    </div>
    <div class="modal-body">
        <p>
        <div class="input-prepend">
        <span class="add-on"><i class="icon-home"></i> 平台名称</span>
        <input type="text" id="platformName2" maxlength="100" />
        </div>
        </p>

        <p>
        <div class="input-prepend">
        <span class="add-on"><i class="icon-globe"></i> 连接网址</span>
        <input type="text" id="platformUrl2" maxlength="500" />
        </div>
        </p>

        <p>
        <div class="input-prepend">
        <span class="add-on"><i class="icon-edit"></i> 平台备注</span>
        <input type="text" id="platformRemark2" maxlength="500" /></div>
        </p>

        <p>
        <div class="input-prepend">
        <span class="add-on"><i class="icon-edit"></i> JSSDK：当前合作平台提供的JS-SKD。</span>
        </div>
        </p>

        <textarea id="JSSDK2" rows="2" cols="10" style="width:96%;"></textarea>

    </div>
    <div class="modal-footer">
    <a href="#" class="btn" onclick="showModal2(0);">取消</a>
    <a href="#" class="btn btn-primary" onclick="Platform_Edit();">提交更新</a>
    </div>
    </div>

<script src="/Plugins/ueditor/ueditor.config.js"></script>
<script src="/Plugins/ueditor/ueditor.all.min.js"></script>
<script src="/Scripts/yycms_upload.js"></script>
<script src="/Plugins/Plot/jquery.flot.min.js"></script>
<script src="/Plugins/Plot/jquery.flot.resize.min.js"></script>
<script type="text/javascript">
    var /*新闻默认分辨率*/NewsStatistics = [[1, "0~2:59"], [2, "3~5:59"], [3, "6~8:59"], [4, "9~11:59"], [5, "12~14:59"], [6, "15~17:59"], [7, "18~20:59"], [8, "21~23:59"]],
        /*商品默认分辨率*/ProductStatistics = NewsStatistics,
        /*新闻默认分辨率标识*/NewsStatisticsResolution = 1,
        /*商品默认分辨率标识*/ProductStatisticsResolution = 1,
        /*统计条数*/PlotShowLength = 5;
    /*生成统计图表分页*/
    function PlotPageBuilder(_pageCount, _pageindex, _renderTo, _callName) {
        _pageCount = parseInt(_pageCount);
        if (_pageCount == 0) { $(_renderTo).empty(); return; }
        var showLinkCount = 3;
        var PageStr = new Array();
        if (_pageindex == 0) { PageStr.push('<a href="javascript:void(0)" class="btn btn-mini disabled">首页</a>'); }
        else { PageStr.push("<a href='javascript:void(0)' onclick=\"" + _callName + "(0);\" class=\"btn btn-mini\">首页</a>"); }
        for (var i = 0; i < _pageCount; i++) {
            if (i == _pageindex) { PageStr.push('<a href="javascript:void(0)" class="btn btn-mini active">' + (i + 1) + '</a>'); }
            else if ((i >= _pageindex && i <= _pageindex + showLinkCount) || (i <= _pageindex && i >= _pageindex - showLinkCount)) {
                PageStr.push("<a href='javascript:void(0)' onclick=\"" + _callName + "(" + i + ");\"  class=\"btn btn-mini\">" + (i + 1) + "</a>");
            }
        }
        if (_pageindex == (_pageCount - 1)) { PageStr.push('<a href="javascript:void(0)" class="btn btn-mini disabled">尾页</a>'); }
        else { PageStr.push("<a href='javascript:void(0)' onclick=\"" + _callName + "(" + (_pageCount - 1) + ");\" class=\"btn btn-mini disabled\">尾页</a>"); }
        $(_renderTo).html(PageStr.join(""));
    };
    /*全局变量，用于判断指标值对象*/
    var previousPoint = null;
    /*设置统计图表提示效果*/
    function showTooltip(x, y, contents) {
        $('<div id="tooltip" class="qtip qtip-default qtip-plain qtip-pos-bc" style="z-index: 15001;"><div class="qtip-content">' + contents + '</div></div>').css({
            display: 'none',
            top: y - 40,
            left: x - 55,
        }).appendTo("body").fadeIn(200);
    }
    /*绑定鼠标移入指定指标值时的事件 */
    $("#NewsStatistics,#ProductStatistics").bind("plothover", function (event, pos, item) {
        $("#x").text(pos.x.toFixed(2));
        $("#y").text(pos.y.toFixed(2));
        if (item) {
            if (previousPoint != item.dataIndex) {
                previousPoint = item.dataIndex;
                $("#tooltip").remove();
                var x = item.datapoint[0].toFixed(2),
                    y = item.datapoint[1].toFixed(2),
                title = item.series.label;

                showTooltip(item.pageX, item.pageY, title + ": <font color='blue'>[<b style='color:red;font-size:12px;'>" + Math.round(y) + "</b>人访问]</font>");
            }
        } else {
            $("#tooltip").remove();
            previousPoint = null;
        }
    });
    /*根据数据渲染统计图表至指定元素*/
    function RenderPlot(DataObject, eleID, _ticks) {
        var plot_statistics = $.plot($(eleID),
             DataObject,
              {
                  series: {
                      lines: {
                          show: true,
                          lineWidth: 1.5,
                          fill: false /*是否填充*/
                      },
                      points: {
                          show: true
                      },
                      shadowSize: 0
                  },
                  grid: {
                      hoverable: true,
                      clickable: true,
                      borderWidth: 0
                  },
                  //colors: ["#2bbce0", "#458adf", "#8e44ad"],
                  xaxis: {
                      tickColor: "transparent",
                      ticks: _ticks,
                      tickDecimals: 0,
                      autoscaleMargin: 0,
                      font: {
                          family: "'Source Sans Pro',Arial",
                          color: '#8c8c8c',
                          size: 12
                      }
                  },
                  yaxis: {
                      ticks: 4,
                      tickDecimals: 0,
                      tickColor: "#e3e4e6",
                      font: {
                          color: '#8c8c8c',
                          size: 12
                      },
                      tickFormatter: function (val, axis) {
                          if (val > 999) { return (val / 1000) + "K"; } else { return val; }
                      }
                  },
                  legend: {
                      labelBoxBorderColor: 'transparent',
                      backgroundColor: 'transparent'
                  }
              });
    }
    /*获取新闻统计*/
    function Statistics_News_Get(_pageIndex)
    {
        $("#NewsStatistics").addClass("loadmodal");
        API.Statistics_News(function (r)
        {
            $("#NewsStatistics").removeClass("loadmodal");

            PlotPageBuilder((r.DataCount % PlotShowLength == 0 ? r.DataCount / PlotShowLength : r.DataCount / PlotShowLength + 1), 0, "#NewsStatisticsPager", "Statistics_News_Get");

            var DataObject = new Array();
            for (var v in r.Data) {
                DataObject.push({ data: r.Data[v], label: v });
            }
            RenderPlot(DataObject, "#NewsStatistics", NewsStatistics);

        }, '{"Resolution":' + NewsStatisticsResolution + ',"PageIndex":' + _pageIndex + ',"ShowLength":' + PlotShowLength + '}');
    }
    /*获取商品统计*/
    function Statistics_Product_Get(_pageIndex) {
        $("#ProductStatistics").addClass("loadmodal");
        API.Statistics_Product(function (r) {
            $("#ProductStatistics").removeClass("loadmodal");
            PlotPageBuilder((r.DataCount % PlotShowLength == 0 ? r.DataCount / PlotShowLength : r.DataCount / PlotShowLength + 1), 0, "#ProductStatisticsPager", "Statistics_Product_Get");
            var DataObject = new Array();
            for (var v in r.Data) {
                DataObject.push({ data: r.Data[v], label: v });
            }
            RenderPlot(DataObject, "#ProductStatistics", ProductStatistics);

        }, '{"Resolution":' + ProductStatisticsResolution + ',"PageIndex":' + _pageIndex + ',"ShowLength":' + PlotShowLength + '}');
    }
    /*设置统计分辨率*/
    function setMode(_ele,_resolution,_type){
        $(_ele).parent().parent().prev().html('(分辨率:' + $(_ele).text() + '&nbsp;<span class="caret"></span>)');
        var ShowType = "";
        if (_resolution == 1){
            ShowType = [[1, "0~2:59"], [2, "3~5:59"], [3, "6~8:59"], [4, "9~11:59"], [5, "12~14:59"], [6, "15~17:59"], [7, "18~20:59"], [8, "21~23:59"]];
        }
        else if (_resolution == 2){
            ShowType = [[1, "<%=DateTime.Now.AddDays(-6).ToString("MM-dd")%>"], [2, "<%=DateTime.Now.AddDays(-5).ToString("MM-dd")%>"], [3, "<%=DateTime.Now.AddDays(-4).ToString("MM-dd")%>"], [4, "<%=DateTime.Now.AddDays(-3).ToString("MM-dd")%>"], [5, "<%=DateTime.Now.AddDays(-2).ToString("MM-dd")%>"], [6, "<%=DateTime.Now.AddDays(-1).ToString("MM-dd")%>"], [7, "<%=DateTime.Now.ToString("MM-dd")%>"]];
        }
        else if (_resolution == 3){
            ShowType = [[1, "1"], [2, "2"], [3, "3"], [4, "4"], [5, "5"], [6, "6"], [7, "7"], [8, "8"], [9, "9"], [10, "10"], [11, "11"], [12, "12"]];
        }
        if (_type == 1) { NewsStatistics = ShowType; NewsStatisticsResolution = _resolution; Statistics_News_Get(0); }
        else if (_type == 2) { ProductStatistics = ShowType; ProductStatisticsResolution = _resolution; Statistics_Product_Get(0); }
    }

        /*合作平台管理 -开始*/
        var uptpltid = 0;
        function AddPicEx()
          {
              GlobalImgList = new Array();
              AddPic();
          }
        function Platform_Get()
        {
            API.Platform_Get(function (result) {
                var Platform_Temp = '{@each dbList as d,index}<li id="platform_${d.ID}"><span><a href="${d.Link}" target="_blank">${d.Name}</a></span><div class="source"><a href="javascript:void(0)" onclick="showModal2(1,${d.ID},this)">编辑</a> <a href="javascript:void(0)" onclick="Platform_Delete(${d.ID})">删除</a></div><sub>${d.Remark}</sub><b>${d.JSSDK}</b></li>{@/each}';
                var _listHtml = juicer(Platform_Temp, { dbList: result.dbList }) + '<li id="AddNewPlatFormBtn" onclick="showModal(1);">+</li>';
                $("#blocks").html(_listHtml);
                $("#platformsCount").text(result.dbList.length + "个");
                
                $.each($("#blocks li"), function (a, b)
                {
                    var _l = $(b);
                    var _title = _l.find("span a").text();
                    var _rmk = _l.find("sub").html();
                    $(b).qtip({
                        title: _title,
                        content: _rmk,
                        position: { my: 'bottom left', at: 'top left' },
                        style: { classes: 'qtip-plain' }
                    });
                    
                    var obj = _l.find("b").text();
                    
                    if (obj != "")
                    {
                        _l.find("span:eq(0)").before('<span class="notify"><img src="/Images/s1.gif" /></span>');
                        var scriptKey = "Script_" + _l.attr("id");
                        $("#" + scriptKey).remove();
                        var head = document.getElementsByTagName('head')[0];
                        var script = document.createElement('script');
                        script.type = 'text/javascript';
                        script.id = scriptKey;
                        head.appendChild(script);
                        $("#" + scriptKey).text(obj);
                    }
                });
              }, "{pageIndex:0,showLength:999}");
          }
        function Platform_Add()
          {
            var _Name = encodeURI($("#platformName").val()),
              _Link =encodeURI($("#platformUrl").val()),
              _JSSDK = encodeURI($("#JSSDK").val()),
              _Remark = encodeURI($("#platformRemark").val());

              var _Image = "";
              //for (var i = 0; i < GlobalImgList.length; i++)
              //{
              //    if (GlobalImgList[i].isdefault == true) { _Image = GlobalImgList[i].src; $("#platformImg").val(_Image); break; }
              //}
              
              if (_Name.length < 1 || _Name.length > 100) { alert("请输入合作平台的名称。"); $("#platformName").focus(); return; }
              //if (_Image == "" || _Image.length > 200) { alert("请设置合作平台的图标"); AddPicEx(); return; }
              if (_Link.length < 1 || _Link.length > 500) { alert("请填写合作平台的连接网址"); $("#platformUrl").focus(); return; }

              var Entity = "{\"Name\":\"" + _Name + "\",\"Image\":\"" + _Image + "\",\"Link\":\"" + _Link + "\",\"Remark\":\"" + _Remark + "\",\"JSSDK\":\"" + _JSSDK + "\"}";
              var EntityString = '{entity:' + Entity + '}';
              API.Platform_Add(function (r) {
                  if (r == "1") { showModal(0); ShowTip("添加成功。"); Platform_Get(); }
                  else { alert(r);}
              }, EntityString);
        }
        function Platform_Edit() {
            var _Name = encodeURIComponent($("#platformName2").val()),
            _Link = encodeURIComponent($("#platformUrl2").val()),
            _Remark = encodeURIComponent($("#platformRemark2").val()),
            _JSSDK = encodeURIComponent($("#JSSDK2").val()),
            _Image = "";
            if (_Name.length < 1 || _Name.length > 100) { alert("请输入合作平台的名称。"); $("#platformName").focus(); return; }
            if (_Link.length < 1 || _Link.length > 500) { alert("请填写合作平台的连接网址"); $("#platformUrl").focus(); return; }
            var Entity = "{\"ID\":" + uptpltid + ",\"Name\":\"" + _Name + "\",\"Image\":\"" + _Image + "\",\"Link\":\"" + _Link + "\",\"Remark\":\"" + _Remark + "\",\"JSSDK\":\"" + _JSSDK + "\"}";
            var EntityString = '{entity:' + Entity + '}';
            API.Platform_Update(function (r) {
                if (r == "1") { showModal2(0); ShowTip("更新成功。"); Platform_Get(); }
                else { alert(r); }
            }, EntityString);
        }
        function Platform_Delete(_ID)
        {
            if (!confirm("是否确认删除当前合作平台？")) { return; }
            API.Platform_Delete(function (r) { if (r == "1") { Platform_Get(); } else { ShowTip("删除失败，" + r); } }, "{ID:" + _ID + "}");
        }
        function showModal(_s) {
            if (_s == 0) { $("#myModal").modal("hide"); }
            else {
                $("#myModal").modal({ show: true, backdrop: true });
                $("#platformName,#platformImg,#platformUrl,#platformRemark,#JSSDK").val("");
                $("#SelectedImgPath").attr("src", "").hide();
            }
        }
        function showModal2(_s,_id,_ele) {
            if (_s == 0) { $("#myModal2").modal("hide"); }
            else {
                uptpltid = _id;
                var _li = $(_ele).parent().parent();
                $("#platformName2").val(_li.find("span a").text());
                $("#platformUrl2").val(_li.find("span a").attr("href"));
                $("#platformRemark2").val(_li.find("sub").text());
                $("#JSSDK2").val(_li.find("b").text());
                $("#myModal2").modal({ show: true, backdrop: true });
            }
        }
        /*合作平台管理 -结束*/
        $(function () {
            Platform_Get(); Statistics_News_Get(0); Statistics_Product_Get(0);
            yycms_upload_Init(function (_img) { $("#SelectedImgPath").attr("src", _img).show(); });
            var BuildPieConfig = function (_color)
            {
                return {
                    barColor: _color,
                    trackColor: '#edeef0',
                    scaleColor: 'transparent',
                    scaleLength: 5,
                    lineCap: 'square',
                    lineWidth: 12,
                    size: 120,
                    onStep: function (from, to, percent) {
                        $(this.el).find('.percent').text(Math.round(percent) + "%");
                    }
                };
            }

            $("#MaxMemory,#MaxDataBase,#MaxSite,#TaskProgress").qtip({
                position: { my: 'bottom center', at: 'top center' },
                style: { classes: 'qtip-plain' }
            });

            $('#MemoryUsedChart').easyPieChart(BuildPieConfig("#87ceeb"));
            $('#bouncerate').easyPieChart(BuildPieConfig("#7ccc2e"));
            $('#clickrate').easyPieChart(BuildPieConfig("#ffa200"));
            $('#covertionrate').easyPieChart(BuildPieConfig("#8e44ad"));
        });
</script>
</asp:Content>