<!--#include file="conn.asp"-->
<!--#include file="inc/cookies_check.asp"-->
<!--#include file="admin_skin_style_dat.asp"-->
<!--#include file="../include/config.inc"-->
<!--#include file="../include/Lebi_XML_Cls.asp"-->
<%
'*****************************************
'* 软件名称 乐彼网上开店软件(56770 EShop)
'* 软件开发 http://www.56770.com
'* 版权所有 http://www.56770.com
'* 文件名称 Admin_skin_style.asp
'* 最后更新 2012-06-29 by 56770.kingdge
'*****************************************
Set LB_XML = new ASPXML
Dim admin_flag, i
admin_flag=",9.1,"
include "lang/"& LangFilePath &"/lang_sys.inc"
include "lang/"& LangFilePath &"/lang_menu.inc"
include "lang/"& LangFilePath &"/lang_skin.inc"
CurrentId = 6
CurrentUrl = "admin_skin.asp"
LB_Head()
LB_Menu()
action = request("action")
%>
<div class="tabmenu mainwidth">
      <ul>
        <li><a href="admin_skin.asp"><span><%=Lang_Menu(58)%></span></a></li>
		<li class="current"><a href="admin_skin.asp?action=s_list&template=<%=request("template")%>&s_name=<%=server.urlencode(request("s_name"))%>"><span><%=request("s_name")%></span></a></li>
        <li><a href="admin_skin_load.asp"><span><%=Lang_Menu(156)%></span></a></li>
      </ul>
</div>
<%
Response.Write("<div class=""tab-mainbody"">")
Response.Write("<div class=""tab-mainbody2"">")
If Eshop_Lebi_name="" Or instr(","&Eshop_Lebi_flag&",",admin_flag)=0 Then
	    adminflag()
	    response.End
End If
template = safereplace(request("template"))
LB_XML.Path = server.MapPath("../skins/"& template &"/data.xml")
LB_XML.Data = "data"
LB_XML.open
LB_XML.SelectTable("config")
name = LB_XML.read("name")
stylefolder = LB_XML.read("stylefolder")
LB_XML.close
If IsObjInstalled("Scripting.FileSystemObject") Then
        allowfso = 1
Else
	    allowfso = 0
End If
Function Checkfile(filename)
		set fso=Server.CreateObject ("Scripting.FileSystemObject")
		If fso.FileExists(server.mappath("../"& filename)) = True Then
				Checkfile = 1
		Else
				Checkfile = 0
		End If
		set fso = nothing
End Function
Function GetDateCreate(filename)
		If Checkfile(filename) = 0 Then Exit Function
		filename = server.mappath("../"& filename)
		Set fso = CreateObject("Scripting.FileSystemObject")
		Set f = fso.GetFile(filename)
		s = f.DateCreated
		set f = nothing
		set fso = nothing
		GetDateCreate = s
End Function
Function GetDateModify(filename)
		If Checkfile(filename) = 0 Then Exit Function
		filename = server.mappath("../"& filename)
		Set fso = CreateObject("Scripting.FileSystemObject")
		Set f = fso.GetFile(filename)
		s = f.DateLastModified
		set f = nothing
		set fso = nothing
		GetDateModify = s
End Function
Function TplShowReplace(str)
		TplShowReplace = str
		'TplShowReplace = Replace(str,"[[","'")
End Function
Function LoveHtml(str)
		LoveHtml = Replace(str,chr(10),vbcrlf)
		LoveHtml = str
End Function
Function CheckTplDir(PathValue)
		On Error Resume Next
		Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
		If objFSO.FolderExists(Server.MapPath("../"&PathValue))=False Then
				objFSO.CreateFolder Server.MapPath("../"&PathValue)
		End If
		If Err.Number = 0 Then
				CheckTplDir = PathValue
		End If
		Set objFSO = Nothing
End Function

rem  样式管理类 by 56770.icystar
Class Cls_sysTag
		Dim idx,file,name,info,fmat,desc,expl,tagname
		Private Sub Class_Initialize
				idx = 0
				file = ""
				name = ""
				info = ""
				fmat = ""
				desc = Array()
				expl = ""
				tagname = ""
		End Sub
		Private Sub Class_Terminate()
				'Class_Terminate
		End Sub
End Class
Class Cls_sysStyle
		Private sidx
		Private tags(100)
		Private Sub Class_Initialize
				sidx = 0
		End Sub
		Private Sub Class_Terminate()
				'Class_Terminate
		End Sub
		Public Property Get lens()
				lens = sidx - 1
		End Property
		Public Property Get gets(idx)
				Set gets = tags(idx)
		End Property
		Public Property Get getx(idx)
				Dim i, sid
				sid = -1
				For i = 0 To sidx - 1
						If tags(i).idx = Clng(idx) Then
								sid = i
								Exit For
						End If
				Next
				If sid <> -1 Then Set getx = tags(sid)
		End Property
		Public Sub push(file,name,info,fmat,desc,expl,tagname)
				Dim stag
				Set stag = new Cls_sysTag
				stag.idx = sidx
				stag.file = file
				stag.name = name
				stag.info = info
				stag.fmat = fmat
				stag.desc = desc
				stag.expl = expl
				stag.tagname = tagname
				Set tags(sidx) = stag
				sidx = sidx + 1
		End Sub
End Class

Function LoadStyle(strFile)
		Dim strTempPath,objFSO,objStm
		strTempPath = Server.MapPath("../" & stylefolder & strFile)
		Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
		Set objStm = Server.CreateObject("ADODB.Stream")
		If objFso.FileExists(strTempPath) Then
				objStm.charset = "UTF-8"
				objStm.open
				objStm.LoadFromFile strTempPath
				LoadStyle = objStm.ReadText
		End If
		Set objStm = Nothing
		Set objFSO = Nothing
End Function
Select Case request("action")
	   Case"style" style()
	   case"modis" modis()
	   Case Else main()
End Select
Function Stylereplace(Str)
	    If Isnull(Str) Then
	    	    StyleSafereplace = ""
	    	    Exit Function
	    End If
		If InStr(str,"<%")>0 Or InStr(str,"%\>")>0 Then
		        response.write("<script>alert('"& Lang_Skin(156) &"');javascript:history.back()</script>")
				response.End
		End If
		If InStr(LCase(str),"execute")>0 Or InStr(LCase(str),"eval")>0 Or InStr(LCase(str),"session")>0 Or InStr(LCase(str),"request")>0 Then
		        response.write("<script>alert('"& Lang_Skin(156) &"');javascript:history.back()</script>")
				response.End
		End If
	    Stylereplace = Str
End Function
sub modis()
		Dim s_tag,main_s,main_i,i
		Set s_tag=sStyle.getx(request("tag_id"))
		stylefolder = Safereplace(Trim(request("stylefolder")))
		s_info = Safereplace(Trim(request("s_info")))
		If template = "" Then
				response.write Lang_Skin(43)
				response.End
		Else
				For i = 0 To Ubound(s_tag.desc)
						main_i = Stylereplace(trim(request("main_"&i)))
						main_i = Replace(main_i,"@@@","")
						Savehtml "../"& CheckTplDir(stylefolder) &"Lebi."&s_tag.file&"."&i&".style",LoveHtml(main_i)
						If Config_Lebi_Eshop(17)="1" Then
								Application.Contents.RemoveAll
						End If
				Next
				ManageLog Replace(Lang_Skin(157),"[name]",s_tag.file) &" ["&request("s_name")&"]"
				m_u="?template="& template &"&s_name="& server.urlencode(request("s_name"))
				Call Up_mes(Lang_sys(69),"·"& Lang_sys(68),0,m_u,0,0,2,1)
		End if
End Sub

Sub main()
%>
<script language="JavaScript">
function doZoom(size){
document.getElementById('zoom').style.fontSize=size+'px'
}
var DOM = (document.getElementById) ? 1 : 0;
var NS4 = (document.layers) ? 1 : 0;
var IE4 = 0;
if (document.all)
{
IE4 = 1;
DOM = 0;
}
var win = window;
var n = 0;
function findIt() {
if (document.getElementById("searchstr").value != "")
findInPage(document.getElementById("searchstr").value);
}
function findInPage(str) {
var txt, i, found;
if (str == "")
return false;
if (DOM)
{
win.find(str, false, true);
return true;
}
if (NS4) {
if (!win.find(str))
while(win.find(str, false, true))
n++;
else
n++;
if (n == 0)
alert("<%=Lang_Skin(175)%>");
}
if (IE4) {
txt = win.document.body.createTextRange();
for (i = 0; i <= n && (found = txt.findText(str)) != false; i++) {
txt.moveStart("character", 1);
txt.moveEnd("textedit");
}
if (found) {
txt.moveStart("character", -1);
txt.findText(str);
txt.select();
txt.scrollIntoView();
n++;
}
else {
if (n > 0) {
n = 0;
findInPage(str);
}
else
alert("<%=Lang_Skin(175)%>");
}
}
return false;
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="list" class="classtable">
<tbody>
  <tr>
<td height="30" colspan="2" align="left" class="classhead">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td>
<input id="searchstr" name="searchstr" type="text" class="form_query" size="20"><input name="query" type="button" value="" title="<%=Lang_sys(25)%>" align="absmiddle" class="btn_query" onclick="javascript:findIt();">
</td>
</tr>
</table>
</td>
<td class="classhead">
<a href=#B><span style="font-sie:18px;font-weight:bold;">B</span></a>&nbsp;|&nbsp;
<a href=#G><span style="font-sie:18px;font-weight:bold;">G</span></a>&nbsp;|&nbsp;
<a href=#H><span style="font-sie:18px;font-weight:bold;">H</span></a>&nbsp;|&nbsp;
<a href=#N><span style="font-sie:18px;font-weight:bold;">N</span></a>&nbsp;|&nbsp;
<a href=#P><span style="font-sie:18px;font-weight:bold;">P</span></a>&nbsp;|&nbsp;
<a href=#R><span style="font-sie:18px;font-weight:bold;">R</span></a>&nbsp;|&nbsp;
<a href=#S><span style="font-sie:18px;font-weight:bold;">S</span></a>&nbsp;|&nbsp;
<a href=#U><span style="font-sie:18px;font-weight:bold;">U</span></a>&nbsp;&nbsp;
</td>
 <td height="30" class="classhead" align="right" colspan="2">
 <select onChange="var jmpURL=this.options[this.selectedIndex].value ;if(jmpURL!='') {window.location=jmpURL; }else{ this.selectedIndex=0; }">
<option selected>┌ <%=Lang_Skin(5)%></option>
<%
Set rs = conn.execute("select s_id,s_name,s_check from [Lebi_skins] order by s_check desc")
Do While Not rs.eof
%>
<option value="?s_id=<%= rs(0) %>&s_name=<%=server.urlencode(rs(1))%>"<%=judge2(rs(0),skin_id)%>>├ <%=rs(1)%><%If rs(2) = 1 Then response.write("["& Lang_Skin(34) &"]") End If%></option>
<%
rs.movenext
Loop
rs.close : Set rs = Nothing
%>
</select>
</td>
</tr>
<tr>
 <td height="30" class="classtop" width="5%"><%=Lang_Skin(87)%></td>
 <td class="classtop" width="20%"><%=Lang_Skin(88)%></td>
 <td class="classtop" width="25%"><%=Lang_Skin(158)%></td>
 <td class="classtop" width="45%"><%=Lang_Skin(159)%></td>
 <td class="classtop" width="5%"><%=Lang_Skin(90)%></td>
</tr>
<% for i = 0 to sStyle.lens %>
<tr class="classrow">
  <td height="30" class="classrow"><%=i%>.</td>
  <td height="30" class="classrow"><a name="<%=sStyle.gets(i).tagname%>"></a><a href="?action=style&tag_id=<%=sStyle.gets(i).idx%>&template=<%= template %>&s_name=<%=server.urlencode(name)%>&stylefolder=<%=stylefolder%>&s_info=<%=sStyle.gets(i).name%>"><%=sStyle.gets(i).name%></a></td>
  <td height="30" class="classrow"><a href="?action=style&tag_id=<%=sStyle.gets(i).idx%>&template=<%= template %>&s_name=<%=server.urlencode(name)%>&stylefolder=<%=stylefolder%>&s_info=<%=sStyle.gets(i).name%>"><%=sStyle.gets(i).info%></a></td>
  <td height="30" class="classrow"><%=sStyle.gets(i).fmat%></td>
  <td height="30" class="classrow"><a href="?action=style&tag_id=<%=sStyle.gets(i).idx%>&template=<%= template %>&s_name=<%=server.urlencode(name)%>&stylefolder=<%=stylefolder%>&s_info=<%=sStyle.gets(i).name%>"><img src="images/icon_edit.gif" border="0" align="absmiddle" title="<%=Lang_sys(51)%>" width="16" height="16"></a></td>
  <!--<td height="30" class="classrow"><a href="http://www.56770.com/faq/query/?search_type=0&search_name=<%=sStyle.gets(i).file%>" target="_blank"><img src="images/icon_link.gif" width="16" height="16" border="0"></a></td>-->
</tr>
<% next %>
<tr>
<td class="classfooter" colspan="6" align="right" height="30">
<input type="image" name="button" title=" <%=Lang_sys(3)%> " onclick="javascript:history.back();" src="lang/<%=LangFilePath%>/images/bt_bak.gif">
</td>
</tr>
</table>
<script>tdshow("list");</script>
<%
End Sub

sub style()
%>
<style type="text/css">
table.collapse tfoot td img{border:none;vertical-align:bottom;padding-left:10px;float:right;}
</style>
<script language="javascript">
function tablecollapse()
{
var collapseClass='collapse';
var collapsePic='lang/<%=LangFilePath%>/images/bt_close.gif';
var expandPic='lang/<%=LangFilePath%>/images/bt_open.gif';
var initialCollapse=true;
var t=document.getElementsByTagName('table');
var checktest= new RegExp("(^|\\s)" + collapseClass + "(\\s|$)");
for (var i=0;i<t.length;i++)
{
if(!checktest.test(t[i].className)){continue;}
t[i].getElementsByTagName('tfoot')[0].onclick=function()
{
var tb=this.parentNode.getElementsByTagName('tbody');
for(var i=0;i<tb.length;i++)
{
tb[i].style.display=tb[i].style.display=='none'?'':'none';
}
var li=this.getElementsByTagName('img')[0];
li.src=li.src.indexOf(collapsePic)==-1?collapsePic:expandPic;
}
if(initialCollapse)
{
var tb=t[i].getElementsByTagName('tbody');
for(var j=0;j<tb.length;j++)
{
tb[j].style.display='';
}
}
var newa=document.createElement('a');
newa.href='#';
newa.onclick=function(){return false;}
var newimg=document.createElement('img');
newimg.src=initialCollapse?collapsePic:expandPic;
var tf=t[i].getElementsByTagName('tfoot')[0];
var lt=tf.getElementsByTagName('td')[tf.getElementsByTagName('td').length-1];
newa.appendChild(newimg);
lt.insertBefore(newa,lt.firstChild);
}
}
window.onload=tablecollapse;
function runscript(n){
	txtRun=n;window.open("../templates_view.asp","templates_view")
}
</script>
<table width="100%" border="0" cellspacing="0" cellpadding="0" id="edit" class="classtable">
	      <form method="post" action="?action=modis">
			<tr>
			 <td height="30" class="classhead" align="left">
				<input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> " align="absmiddle">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="this.form.reset();return false;" align="absmiddle">
				<input type="hidden" name="tag_id" value="<%=request("tag_id")%>">
				<input type="hidden" name="template" value="<%=template%>">
				<input type="hidden" name="s_name" value="<%=request("s_name")%>">
				<input type="hidden" name="stylefolder" value="<%=request("stylefolder")%>">
			 </td>
			 <td align="right" class="classhead"><%=QuickMenu("","")%></td>
		    </tr>
            <tr>
              <td colspan="2" class="classtop" height="30"><a href="?action=s_list&s_id=<%=request("s_id")%>&s_name=<%= server.urlencode(request("s_name")) %>"><%= request("s_name") %></a> > <%= request("s_info") %>
			</td>
           </tr>
<%
  Dim s_tag,main_s,main_i,u_i,rowsnum
  Set s_tag=sStyle.getx(request("tag_id"))
  u_i = UBound(s_tag.desc)
  rowsnum = 8
  If u_i = 0 Then rowsnum = 16
  For i=0 to u_i
		s_style=LoadStyle("Lebi."&s_tag.file&"."&i&".style")
		If s_style="" Then s_style=" "

%>
<tr class="classrow">
 <td height="30" class="classrow" align="left"><%=i%>.&nbsp;<%= request("s_info") %>&nbsp;&nbsp;<%=s_tag.desc(i)%></td>
 <td class="classrow" align="right"><a href="javascript:u_Size(-10,'main_<%=i%>')"><img src="lang/<%=LangFilePath%>/images/bt_close.gif" border='0'></a>
     <a href="javascript:u_Size(10,'main_<%=i%>')"><img src="lang/<%=LangFilePath%>/images/bt_open.gif" border='0'></a>
     <img src="lang/<%=LangFilePath%>/images/bt_view.gif" onclick="runscript(main_<%=i%>)" style="cursor:pointer;"></td>
</tr>
 <tr class="classrow">
 <td class="classrow" colspan="2" align="center">
	<textarea cols="102" rows="<%=rowsnum%>" name="main_<%=i%>" id="main_<%=i%>" class="html"><%=Trim(server.htmlencode(TplShowReplace(s_style)))%></textarea>
 </td>
</tr>
<%Next%>
<tr>
<td colspan="2" class="classfaq">
<div class="faq_main">
<p class="faq_title"><%=Lang_Skin(160)%></p>
<table width="100%" class="collapse">
<thead>
<tr>
<td colspan="2" align="right"></td>
</tr>
</thead>
<tfoot>
<tr>
<td colspan="2" align="right"></td>
</tr>
</tfoot>
<tbody>
<tr>
<td colspan="2"><%=s_tag.expl%></td>
</tr>
</tbody>
</table>
</div>
</td>
</tr>
  <tr>
     <td colspan="2" align="left" height="30" class="classfooter">
		<input name="submit" type="image" src="lang/<%=LangFilePath%>/images/bt_app.gif" value=" <%=Lang_sys(1)%> " title=" <%=Lang_sys(1)%> ">&nbsp;<input type="image" src="lang/<%=LangFilePath%>/images/bt_res.gif" border="0" title=" <%=Lang_sys(2)%> " onclick="this.form.reset();return false;">
	 </td>
  </tr>
</form>
</table>
<script>tdshow("edit");</script>
<%
End Sub
Response.Write("</div>")
Response.Write("</div>")
LB_Footer()
%>