<%@ Page Language="C#" ValidateRequest="false" MasterPageFile="~/Admin/MasterPage.master" AutoEventWireup="true" Inherits="Kesion.NET.WebSite.Admin_TemplateSkin" Title="模板管理" Codebehind="KS.TemplateSkin.aspx.cs" %>

<%@ Import Namespace="Kesion.Publics" %>
<%@ Import Namespace="Kesion.Cache" %>
<%@ Import Namespace="Kesion.BLL" %>
<asp:Content ID="Content1" ContentPlaceHolderID="KSContent" runat="Server">
    <asp:Panel ID="mainlist" runat="server" Width="100%">
        <div style="display:none;">
		<%if (TemplateType == -1)
          { %>
         在线下载模板风格
        <%}
          else
        { %>
        </div>
        <div class="listedit">
            <ul>
                <a href="#" onclick="addtemplate(0);return false;" title="创建网站风格" class="button button_on mr20">新建<%=typeName %>模板风格</a>
                <a href="#" onclick="uptemplate();return false;" class="button mr20">导入ZIP模板风格</a>
                <%} %>
            </ul>
        </div>
        <div class="content-area mt20">
            
			<script>
                function uptemplate()
                {  
                    parent.openWin("上传模板风格ZIP包并导入", "<%=KSCMS.GetInstallDir()+MyCache.GetCacheConfig(4)%>/Label/KS.TemplateSkin.aspx?action=upload&showType=<%=TemplateType%>", true,820, 370);
                }
                function labelclone(templateid) {
                    parent.openWin("克隆<%=typeName%>模板风格", "<%=KSCMS.GetInstallDir()+MyCache.GetCacheConfig(4)%>/Label/KS.TemplateSkin.aspx?action=clone&showType=<%=TemplateType%>&templateid="+templateid, true, 620, 280);
                }
                function addtemplate(templateId)
                {
                    if (templateId == 0) {
                        parent.openWin("创建<%=typeName%>网站风格", "<%=KSCMS.GetInstallDir()+MyCache.GetCacheConfig(4)%>/Label/KS.TemplateSkin.aspx?action=add&showType=<%=TemplateType%>", true, 900, 650);
                    } else {
                        parent.openWin("编辑<%=typeName%>网站风格", "<%=KSCMS.GetInstallDir()+MyCache.GetCacheConfig(4)%>/Label/KS.TemplateSkin.aspx?action=add&showType=<%=TemplateType%>&templateId="+templateId, true, 900, 650);
                    }
                }

                function clonetemplate(file) {
                    parent.openWin("克隆<%=typeName%>网站风格", "<%=KSCMS.GetInstallDir()+MyCache.GetCacheConfig(4)%>/Label/KS.TemplateClone.aspx?file=" + file, true, 620, 220);
                }
                function YunDownLoad(templateId, page) {

                    location.href = "<%=KSCMS.GetInstallDir()+MyCache.GetCacheConfig(4)%>/Label/KS.TemplateSkin.aspx?action=yundown&showType=-1&tpType=<%=tpType%>&page=" + page + "&templateId=" + templateId;
                    return;
                   // parent.openWin("下载云端网站风格", "<%=KSCMS.GetInstallDir()+MyCache.GetCacheConfig(4)%>/Label/KS.TemplateSkin.aspx?action=yundown&showType=-1&page="+page+"&templateId=" + templateId, true, 820, 370);
                }
            </script>


            <div class="tabs_header">
                <ul class="tabs">
                    <li<%=KSCMS.S("showType")==""?" class='active'":string.Empty %>><a href="KS.TemplateSkin.aspx?<%=UtilsQueryParam.Get("showtype,agentType") %>"><span>PC模板风格</span></a></li>
                    <li<%=KSCMS.S("showType")=="1"?" class='active'":string.Empty %>><a href="KS.TemplateSkin.aspx?showType=1&<%=UtilsQueryParam.Get("showtype,agentType") %>"><span>手机模板风格</span></a></li>
                    <%
                    if (Kesion.Course.Course.IsMoreEdu() == true && System.IO.Directory.Exists(Utils.GetMapPath("/admin/enterprise/")) == true){%>
                    <li<%=KSCMS.S("showType") == "2" ? " class='active'" : string.Empty %>><a href="KS.TemplateSkin.aspx?showType=2&<%=UtilsQueryParam.Get("showtype,agentType") %>"><span>机构模板风格</span></a></li>
                    <%} %>
                    <% if (BaseFun.CheckModulePower("classroom")){%>
                    <li<%=KSCMS.S("showType") == "5" ? " class='active'" : string.Empty %>><a href="KS.TemplateSkin.aspx?showType=5&<%=UtilsQueryParam.Get("showtype,agentType") %>"><span>班级模板风格</span></a></li>
                    <%} %>
                    <li<%=KSCMS.S("showType")=="-1"?" class='active'":string.Empty %>><a href="KS.TemplateSkin.aspx?showType=-1&<%=UtilsQueryParam.Get("showtype,agentType") %>"><span>官方云端模板下载</span></a></li>
                </ul>
            </div>

            <asp:Repeater ID="TpList" runat="server">
                <HeaderTemplate>
                    <div class="stencil clearfix templateBox">
                        <ul class="clearfix">
                </HeaderTemplate>
                <ItemTemplate>
                    <li title="模板作者：<%# Eval("Author") %>" class="item<%# Convert.ToString(Eval("isdefault"))=="1"?" curr":"" %>">
                        <div class="border">
                            <div class="s_img"><i class="tag"></i>
                                <img onerror="this.src='/sysimg/nopic.gif'" src="<%# Eval("defaultpic") %>" /></div>
                            <div class="s_txt">
                                <div class="s_name" title="文件目录：<%# Eval("TemplateEname") %>">
                                    <%# Eval("templateName") %>
                                    <div class="Tid"><em>ID：<%# Eval("templateId") %></em><em>作者：<%# Eval("Author") %></em></div>
                                </div>
                                <a href="KS.Template.aspx?showType=<%=TemplateType %>&templateId=<%# Eval("TemplateID") %>&pageup=1"><i class="icon icon-Tfile"></i>模板文件</a>
                                <a href="KS.Label.aspx?showType=<%=TemplateType %>&LabelType=2&templateId=<%# Eval("TemplateID") %>"><i class="icon icon-Tlable"></i>标签管理</a>
                                <a href="KS.Label.aspx?showType=<%=TemplateType %>&LabelType=1&templateId=<%# Eval("TemplateID") %>&LabelFlag=5"><i class="icon icon-Tlable"></i>轮播图配置</a>
                                <a href="KS.JSLabel.aspx?LabelType=5&templateId=<%# Eval("TemplateID") %>"><i class="icon icon-Tlable-js"></i>JS标签</a>
                                <a href="KS.TemplateSkin.aspx?action=export&templateId=<%# Eval("TemplateID") %>"><i class="icon icon-Texported"></i>导出Zip</a>
                            </div>
                            <div class="s_rbox">
                                <%if (TemplateType == 0)
                                  {%>
                                <a href='../../index.aspx?f=pc&skinid=<%# Eval("TemplateId") %>' title="预览" target="_blank">预览</a>

                                <a <%# Eval("IsViewEdit").ToString()=="1"?"":" style='display:none'" %> href='../drag/index.aspx?f=pc&skinid=<%# Eval("TemplateId") %>&templatetype=<%# Eval("TemplateType") %>' title="可视化编辑" target="_blank">可视化编辑</a>
                                <%}
                                  else if (TemplateType == 1)
                                  { %>
                                <a href='../../index.aspx?f=m&skinid=<%# Eval("TemplateId") %>' title="预览" target="_blank">预览</a>
                                <% }
                                  else if (TemplateType == 2)
                                  { %>
                                <%}
                                  else if (TemplateType == 3)
                                  { %>
                                <%} %>
                                <a href="javascript:;" onclick="addtemplate(<%# Eval("TemplateID")%>);return false;" title="编辑">编辑</a>
                                <a href="KS.TemplateSkin.aspx?templateId=<%# Eval("TemplateID") %>&showtype=<%=TemplateType %>&action=setdefault">设为默认</a>
                                <a href="javascript:" onclick="labelclone(<%# Eval("TemplateID") %>)" title="克隆模板风格">克隆</a>
                                <a href="?Action=del&templateId=<%#Eval("TemplateID") %>&showType=<%=TemplateType%>" title="删除" onclick="return(confirm('此风格下的标签及模板文件也将相应删除，且此操作不可逆，确定删除操作吗?'))">删除</a>
                                <%# Utils.StrToInt(Eval("OriTemplateID"))<=0?"":@"<a href=""?Action=yunreset&dbTemplateID="+Eval("templateID")+"&templateId="+Eval("OriTemplateID")+"&showType="+TemplateType+@""" title=""云端还原"" onclick=""return(confirm('重新从云端下载将覆盖本风格的所有修改，且此操作不可逆，确定执行还原操作吗?'))"">云端还原</a>" %>
                            </div>
                        </div>

                    </li>
                </ItemTemplate>
                <FooterTemplate>
                    </ul>    
                </div>
               <div class="empty" style="display: <%# bool.Parse((TpList.Items.Count==0).ToString())?"":"none"%>">
                   没有模板可选，点此<a href="#" onclick="addtemplate(0);return false;" title="创建一个空模板">新建模板</a>
               </div>
                    </table>
                </FooterTemplate>
            </asp:Repeater>


            <script>
                function ViewPics(id){
                    top.initialPrettyPhotoPicStr($("#p"+id).html());
                }
            </script>

            <asp:Repeater ID="YunTemplateList" runat="server">
                <HeaderTemplate>

                <%if (TemplateType == -1)
                     { %>
                          <div style="font-size:16px">
                        <div class="quickSearch clearfix md20">
                            <div class="TabTitle fr">
                                <span<%=Utils.StrToInt(KSCMS.S("tpType"))==0?" class='active'":"" %>><a href="KS.TemplateSkin.aspx?showType=-1&tpType=0&<%=UtilsQueryParam.Get("showtype,tpType") %>">PC模板</a></span>
                                <span<%=KSCMS.S("tpType")=="1"?" class='active'":"" %>><a href="KS.TemplateSkin.aspx?showType=-1&tpType=1&<%=UtilsQueryParam.Get("showtype,tpType") %>">手机模板</a></span>
                                <%if (BaseFun.CheckModulePower("edu"))
                                    { %>
                                <span<%=KSCMS.S("tpType") == "2" ? " class='active'" : "" %>><a href="KS.TemplateSkin.aspx?showType=-1&tpType=2&<%=UtilsQueryParam.Get("showtype,tpType") %>">班级模板</a></span>
                                    <%if (BaseFun.CheckModulePower("school"))
    { %>
                                <span<%=KSCMS.S("tpType") == "3" ? " class='active'" : "" %>><a href="KS.TemplateSkin.aspx?showType=-1&tpType=3&<%=UtilsQueryParam.Get("showtype,tpType") %>">机构主页</a></span>
                                    <%}
    }
      %>

                            </div>
                        </div>
                    </div>
                     <%}%>

                    <div class="stencil clearfix templateBox">
                        <ul>
                </HeaderTemplate>
                <ItemTemplate>
                    <li title="应用产品：<%# Eval("classname") %> 作者：<%# Eval("Author") %> 上传时间：<%# Eval("adddate") %>">
                        <div class="border">
                            <div class="s_img">
                            <a href="<%#Eval("viewurl") %>" target="_blank"><img src="<%# GetYunTemplatePic(Convert.ToString(Eval("defaultPic"))) %>" onerror="this.src='/sysimg/nopic.gif';" /></a></div>
                            <div class="s_txt">
                                <div class="s_name">
                                   <%# Eval("templateName") %>
                                    <%# Eval("isvip").ToString()=="1"?"<i class='vip normal'><i class='iconfont guan'>&#xe604;</i></i>":string.Empty %>
                                    <div class="Tid break">
                                        <span>ID：<%# Eval("templateId") %></span>
                                        <span>应用产品：<%# Eval("classname") %> </span>
                                        <span>上传时间：<%# Eval("adddate") %></span>
                                        <span class="price"><i class="bt">价格：</i><em><%#Utils.StrToDecimal(Eval("prices"))>0?"￥"+Kesion.APPCode.Public.ReturnShopPrice(Utils.StrToDecimal(Eval("prices"))):"<font color='#30b96a'>免费</font>" %></em></span>

                                    </div>
                                </div>
                            </div>

                            <div class="s_rbox">
                                <span id="p<%#Eval("TemplateID") %>" style="display: none"><%# Eval("pics") %></span>
                                <a href='javascript:ViewPics("<%#Eval("TemplateID") %>")' title="预览">预览</a>

                                <%#ShowButton(Utils.StrToDecimal(Eval("prices")),Utils.StrToInt(Eval("TemplateID").ToString()))%>
                            </div>
                        </div>
                    </li>
                </ItemTemplate>
                <FooterTemplate>
                    </ul>    
                </div>
              </table>
                </FooterTemplate>
            </asp:Repeater>
            <div class="empty" style="text-align: center;" id="showEmpty" runat="server" visible="false">
                云端没有发现可供下载的模板!
            </div>
            <KS:Page ID="Page1" runat="server" />
    </asp:Panel>

    <asp:Panel ID="addlist" Visible="false" runat="server" Width="100%">
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable">
            <tr class="ctr">
                <td align="right" class="lefttd" style="width: 143px">
                    <strong>模板风格名称：</strong></td>
                <td>
                    <asp:TextBox ID="TxtTemplateName" CssClass="textbox" runat="server" Width="320px"></asp:TextBox>
                    <span class="tips">如：红色典风格。</span>
                </td>
            </tr>
            <tr>
                <td class="lefttd" height="30" align="right"><b>请选择模板目录：</b></td>
                <td class="righttd">
                    <asp:DropDownList runat="server" ID="dropTemplateDir">
                        <asp:ListItem Value="0" Text="-请选择存放目录-"></asp:ListItem>
                    </asp:DropDownList>
                    <span class="tips">Tips:创建模板风格前，请先将对应的模板目录上传至“template”下。</span>
                </td>
            </tr>
            <%if (Kesion.ODS.AgentClass.GetFXSVersion()==3) {  %>
            <tr style='display:none'>
                <td class="lefttd" height="30" align="right"><b>适用分销类型：</b></td>
                <td class="righttd">
                    <asp:RadioButtonList ID="AgentType" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                   <%--     <asp:ListItem Value="1" >课程分销</asp:ListItem>
                        <asp:ListItem Value="2">商品分销</asp:ListItem>--%>
                        <asp:ListItem Value="3" Selected="True">全站分销</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
                <%} %>
            <tr<%=TemplateType==0?string.Empty:" style='display:none'" %>>
                <td class="lefttd" height="30" align="right"><b>是否响应式：</b></td>
                <td class="righttd">
                    <asp:RadioButtonList ID="IsResponsive" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                        <asp:ListItem Value="1">是</asp:ListItem>
                        <asp:ListItem Value="0" Selected="True">否</asp:ListItem>
                    </asp:RadioButtonList>
                </td>
            </tr>
            <tr>
                <td class="lefttd" height="30" align="right"><b>模板预览图片：</b></td>
                <td class="righttd">
                    <table cellspacing="0" cellpadding="0" width="100%">
                        <tr>
                            <td width="220">
                                <asp:TextBox ID="TxtDefaultPic" runat="server" Text="" CssClass="textbox" Width="220px" /></td>
                            <%if (Kesion.BLL.KSSecurity.CheckCommonUploadPower())
                              { %>
                            <td style="padding-left: 4px; padding-top: 12px;"><%=Kesion.APPCode.UploadAPI.EchoUpload("classpic",this.TxtDefaultPic.ClientID,150) %></td>
                            <%} %>
                            <td>
                                <img id="show<%=TxtDefaultPic.ClientID %>" src="<%=TxtDefaultPic.Text%>" height="30" style="border: 1px solid #f1f1f1;" onerror="this.src='../../sysimg/nopic.gif'" /></td>
                        </tr>
                    </table>
                </td>
            </tr>
            <tr>
                <td class="lefttd" height="30" align="right"><b>模板作者：</b></td>
                <td class="righttd">
                    <asp:TextBox ID="TxtAuthor" runat="server" Text="" CssClass="textbox" Width="320px" />
                </td>
            </tr>
            <tr>
                <td class="lefttd" height="30" align="right"><b>模板简要介绍：</b></td>
                <td class="righttd">
                    <asp:TextBox ID="TxtIntro" runat="server" Text="" CssClass="textbox" TextMode="MultiLine" Height="80px" Width="320px" />
                </td>
            </tr>
            <tr<%=TemplateType==3?"":" style='display:none'" %>>
            <td class="lefttd" height="30" align="right"><b>允许使用本模板的用户组：</b></td>
            <td class="righttd">
                <div  runat="server" id="chkUserlevel"></div>
          </tr>
          <tr<%=TemplateType==2?"":" style='display:none'" %>>
            <td class="lefttd" height="30" align="right"><b>允许使用本模板的企业机构：</b></td>
            <td class="righttd">
                <asp:CheckBoxList ID="CheckBoxList1" RepeatDirection="Horizontal" runat="server">          
                    <asp:ListItem Value="0">免费机构</asp:ListItem>         
                </asp:CheckBoxList>            
            </td>
            </tr>
         <tr style="display:none">   <!--先屏掉-->
             <td class="lefttd" height="30" align="right"><b>是否支持可视化编辑：</b></td>
             <td class="righttd">
                 <asp:RadioButtonList ID="RdbIsViewEdit" runat="server" RepeatDirection="Horizontal" RepeatLayout="Flow">
                     <asp:ListItem Value="0" Selected="True">不支持</asp:ListItem>
                     <asp:ListItem Value="1">支持</asp:ListItem>
                 </asp:RadioButtonList>
             </td>
         </tr>
        </table>
        <br />
        <div class="pop-button" align="center">
            <asp:HiddenField ID="HidTemplateId" Value="0" runat="server" />
            <asp:HiddenField ID="HidTemplateType" Value="0" runat="server" />
            <asp:Button ID="Button1" runat="server" AccessKey="A" CssClass="button" OnClientClick="return(checkForm());" Text="确定创建(A)" OnClick="Button1_Click" />
            <input type="button" class="button" value="关闭取消(C)" accesskey="C" onclick="parent.isreload = false;parent.box.close();" />
        </div>
        <script>
            function checkForm() {
                if ($("#<%=TxtTemplateName.ClientID%>").val() == '') {
                  KesionJS.Alert('请输入模板风格名称！', '$("#<%=TxtTemplateName.ClientID%>").focus();');
                  return false;
              }
              if ($("#<%=dropTemplateDir.ClientID%> option:selected").val() == '0') {
                  KesionJS.Alert('请选择模板风格目录！', '$("#<%=dropTemplateDir.ClientID%>").focus();');
                  return false;
              }
          }
        </script>
    </asp:Panel>

    <asp:Panel ID="uploadPanel" Visible="false" runat="server" Width="95%">
        <div class="message" style="display: none;">ZIP模板包正在上传中，请稍候...</div>
        <div id="showUp">
            <br />
            <br />
            <table border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable">
                <tr>
                    <td align="right" class="lefttd" style="width: 250px">
                        <strong>请选择已下载的ZIP模板风格包：</strong></td>
                    <td class="righttd">
                        <div style="position:relative; width:100px;height: 34px; line-height:34px; border-radius:3px; text-align:center;border: 1px solid #e6e9ea;color: #62686a;font-size:14px;background: #f5f8f9; cursor:pointer;">上传文件<asp:FileUpload runat="server" ID="File1" CssClass="textbox" style="position: absolute;top:0;left: 0px;width: 100%;height: 34px; opacity:0;"/></div>
                    </td>
                </tr>
            </table>
        </div>
        <br />
        <div class="pop-button" align="center">
            <asp:Button ID="Button2" runat="server" AccessKey="A" OnClientClick="$('#showUp').hide();$('.message').show()" CssClass="button" Text="开始上传(A)" OnClick="Button2_Click" />
            <input type="button" class="button" value="关闭取消(C)" accesskey="C" onclick="parent.isreload = false;parent.box.close();" />
        </div>
        </div>
    </asp:Panel>

    <asp:Panel ID="uploadPanelStep2" runat="server" Visible="false" Width="95%">
        <script>
            function checkEname() {
                if ($("#<%=TxtName.ClientID%>").val() == '') {
                    alert('请输入模板名称!');
                    $("#<%=TxtName.ClientID%>").focus();
                    return false;
                }
                if ($("#<%=TxtEname.ClientID%>").val() == '') {
                    alert('请输入要导入的模板目录!');
                    $("#<%=TxtEname.ClientID%>").focus();
                    return false;
                }
                return true;
            }
        </script>
        <br />
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable">
            <tr<%=KSCMS.S("templateID")=="0"?" style='display:none'":string.Empty %>>
             <td align="right" class="lefttd" style="width: 250px">
               <strong>模板编号：</strong></td>
             <td class="righttd">
                 <%=KSCMS.S("templateID") %>
                 <asp:HiddenField ID="HidOriTemplateId" runat="server" Value="0" />
                </td>
            </tr>
           <tr>
               <td align="right" class="lefttd" style="width: 250px">
                   <strong>模板名称：</strong></td>
               <td class="righttd">
                   <asp:TextBox ID="TxtName" runat="server" CssClass="textbox" Width="200px" />
               </td>
           </tr>
            <tr>
                <td align="right" class="lefttd" style="width: 250px">
                    <strong>模板文件存放目录：</strong></td>
                <td class="righttd"><%=MyCache.GetCacheConfig(0) %><asp:Label ID="LabTemplateDir" runat="server"><%=TemplateDir %></asp:Label>/<asp:TextBox ID="TxtEname" runat="server" Width="60" CssClass="textbox" />/</td>
            </tr>
            <tr>
                <td align="right" class="lefttd" style="width: 250px">
                    <strong>模板介绍：</strong></td>
                <td class="righttd">
                    <asp:Label ID="LabIntro" runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td align="right" class="lefttd" style="width: 250px">
                    <strong>模板作者：</strong></td>
                <td class="righttd">
                    <asp:Label ID="LabAuthor" runat="server"></asp:Label></td>
            </tr>
            <tr>
                <td align="right" class="lefttd" style="width: 250px">
                    <strong>模板类型：</strong></td>
                <td class="righttd"><%=typeName %></td>
            </tr>
        </table>

        <br />
        <div class="pop-button" align="center">
            <asp:Button ID="Button3" runat="server" AccessKey="A" CssClass="button" Text="确认导入(A)" OnClientClick="return(checkEname())" OnClick="Button3_Click" />
            <input type="button" class="button" value="关闭取消(C)" accesskey="C" onclick="parent.isreload = false;parent.box.close();" />
        </div>

    </asp:Panel>

    <asp:Panel ID="clonePanel" Visible="false" runat="server" Width="100%">
        <script>
            function checkEname() {
                if ($("#<%=TxtCloneTemplateName.ClientID%>").val() == '') {
                    alert('请输入模板名称!');
                    $("#<%=TxtCloneTemplateName.ClientID%>").focus();
                    return false;
                }
                if ($("#<%=TxtCloneTemplateEName.ClientID%>").val() == '') {
                    alert('请输入要导入的模板目录!');
                    $("#<%=TxtCloneTemplateEName.ClientID%>").focus();
                    return false;
                }
                return true;
            }
        </script>
        <br />
        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="CTable no-borderTable">
            <tr class="ctr">
                <td align="right" class="lefttd" style="width: 143px">
                    <strong>模板风格名称：</strong></td>
                <td>
                    <asp:TextBox ID="TxtCloneTemplateName" CssClass="textbox" runat="server" Width="280px"></asp:TextBox>
                    <div class="tips">如：红色典风格。</div>
                </td>
            </tr>
            <tr>
                <td align="right" class="lefttd">
                    <strong>模板文件存放目录：</strong></td>
                <td class="righttd"><%=MyCache.GetCacheConfig(0) %><%=TemplateDir %>/<asp:TextBox ID="TxtCloneTemplateEName" runat="server" Width="200" CssClass="textbox" />/</td>
            </tr>
        </table>
        <br />
        <div class="pop-button" align="center">
            <asp:HiddenField ID="HiddenTemplateId" Value="0" runat="server" />
            <asp:Button ID="Button4" runat="server" AccessKey="A" CssClass="button" Text="确认克隆(A)" OnClientClick="return(checkEname())" OnClick="Button4_Click" />
            <input type="button" class="button" value="关闭取消(C)" accesskey="C" onclick="parent.isreload = false;parent.box.close();" />
        </div>
    </asp:Panel>


  <asp:Panel ID="YunDownPanel" Visible="false" runat="server" Width="100%">

   <div class="content-area mt20">  
        <div class="myTitle">
            <%if (Utils.StrToInt(KSCMS.S("dbTemplateID")) > 0)
                { %>
            从云端下载模板并还原
           <%}
    else
    { %>下载云端模板
            <%} %>
        </div>
        <div id="downstep1" style="min-height:180px;font-size: 20px; margin: 20px; text-align: center; padding-top: 60px; font-weight: bold; color: green;">
            <img src="../../sysimg/default/loading.gif" />
            <span id="processTips">正在尝试连接云端服务器并初始化下载数据，请稍候......</span>
        </div>
        <div id="downstep2" style="display: none; min-height:180px;margin: 40px; text-align: center;">
            <div style="font-size: 16px; height: 35px; line-height: 35px; font-weight: bold" id="per">下载进度：0%</div>
            <div style="margin: 0 auto; width: 600px; border: 1px dashed #ccc; background: #fff; height: 20px">
                <div id="bar" style="width: 0px; height: 20px; background: #0094ff"></div>
            </div>
            <div style="height: 40px; font-size: 16px; line-height: 40px">
                模板ZIP包大小：<span id="totalSize" style="color: brown; font-weight: bold">0</span> 当前已下载：<span id="currSize" style="color: brown; font-weight: bold">0</span>
            </div>
        </div>

        <div class="pop-button" style="text-align: center; display: none" id="downstep3">
            <input type='button' onclick="downbeginimport();" value=" 立即导入模板库 " class="button" />
            <input type="button" value=" 暂不导入 " class="button" onclick="location.href = '<%=KSCMS.GetInstallDir() + MyCache.GetCacheConfig(4)+"/Label/KS.TemplateSkin.aspx?showType="+TemplateType%>';" />
        </div>

        <script>
            function downbeginimport() {
               parent.openWin("导入网站风格", "<%=KSCMS.GetInstallDir()+MyCache.GetCacheConfig(4)%>/Label/KS.TemplateSkin.aspx?action=downbeginimport&showType=-1&templateId=<%=KSCMS.S("templateID")%>", false, 820, 580);
            }
             function Start() {
               $("#downstep2").show();
               $("#downstep1").hide();
            }
            function SetProcess(data) {
                $("#downstep2").show();
                $("#downstep1").hide();
                var arr = data.split('|');
                var total = "";
                var hasdown = "";
                if (arr[0] / 1024 > 1024) {
                    total = (arr[0] / 1024 / 1024).toFixed(2) + " M";
                } else {
                   total = (arr[0] / 1024).toFixed(0) + " KB";
                }
                if (arr[1] / 1024 > 1024) {
                    hasdown = (arr[1] / 1024 / 1024).toFixed(2) + " M";
                } else {
                    hasdown = (arr[1] / 1024).toFixed(0) + " KB";
                }
                $("#totalSize").html(total);
                $("#currSize").html(hasdown);
                var w = parseFloat(arr[1]) / parseFloat(arr[0]);
                if (w < 1) {
                    $("#per").html("下载进度：" + (w * 100).toFixed(2) + " %");
                } else {
                    $("#per").html("任务完成：100 %");
                }
                $("#bar").html('').width(w * 600);
            }
            function processTips(str) {
                $("#processTips").html(str);
            }
           function End() {
                $('#downstep3').show();
                $("#per").html("任务完成：100 %");
            }
        </script>
   </div>
        
    </asp:Panel>


        <%
            if (KSCMS.S("action").Equals("yundown") || KSCMS.S("action")=="yunreset")
            {
                initialYunDown();

            }
            %>
    </div>
</asp:Content>
