📄 editfile_adv.asp
字号:
<!--#include file="CONST.ASP"-->
<!-- #include file="inc/chkuser.asp" -->
<%closedatabase%>
<!-- #include file="inc/htmlhead.asp" -->
<!-- #include file="inc/char.asp" -->
<!--#include FILE="inc/Syschar.asp"-->
<%helpID=5
'iF not isMaster or SetPower(2,5)=false then
'iF SetPower(2,5)=false then
' Response.write "<Script Language='JavaScript'>{window.open('login.asp','_top');}</Script>"
'End if
iF SetPower(2,5)=false then
Response.write("<SCRIPT LANGUAGE=""JavaScript"">"&vbcrlf)
Response.write("<!--"&vbcrlf)
Response.write("window.parent.location.href='inc/error.html';")
Response.write("//-->"&vbcrlf)
Response.write("</SCRIPT>")
Response.end
eND iF
Response.expires=0 '不在客户段缓存编辑页面
DIM GetContent
DIM GetStr
DIM numstr
DIM refreshframe
DIM getEndline,im
getEndline=1
numstr=""
Select CASE GetAction
CASE "OpenIt" call OpenFile()
CASE "SaveIt" call SaveFile()
CASE "SaveItAs" call SaveFile()
CASE "MkCodeFile" call MakeCodeFile()
End Select
for im=1 to getEndline
numstr=numstr+cstr(im)+"<br>"
next
if GetValue(request.QueryString("Option"),"int",-1)=5 then
refreshframe="onload={refreshframe(0);popupwin();}"
else
refreshframe="{popupwin();}"
end if
'============读行号===========
Function readline(fileName)
Const ForReading = 1
dim theFile, retstring
Set theFile = fso.OpenTextFile(fileName, ForReading, False)
Do While theFile.AtEndOfStream <> True
retstring = theFile.ReadLine
Loop
readline = retstring '读最后一行
readline=theFile.line '读当前行号
theFile.Close
End Function
'============读入文件==========
Sub OpenFile()
dim i1,i2,OF
dim fsize,f,Path
if GetPath="" then exit sub
GetStr=CheckFile(GetPath,1,"03")
if GetStr<>"True" then call EndProc(GetStr,1,"")
Path=server.mappath(GetPath)
Set f = fso.GetFile(Path)
if f.size>EditSize*1024 then call EndProc("<br><li>最大允许编辑尺寸为"&EditSize&"KB!",1,"")
if f.size>0 then
set f=nothing
set OF=Fso.OpenTextFile(Path)
GetContent=OF.readall
getEndline=OF.line
OF.Close
set OF=nothing
else '处理零字节文件
set f=nothing
set OF=Fso.OpenTextFile(Path)
GetContent=""
getEndline=1
OF.Close
set OF=nothing
end if
End Sub
'============存文件=============
Sub SaveFile()
dim CF,chk
if Request.form("filepath")="" then call EndProc("请输入路径和文件名!",1,"")
chk=CheckFile(GetPath,2,"03")
if chk<>"True" then call EndProc(chk,1,"")
GetContent=Request.form("content")
GetStr=GetContent
set CF=Fso.CreateTextFile(Server.mappath(GetPath),true)
CF.write GetStr
CF.Close
set CF=nothing
call OpenFile
set Fso=nothing
End Sub
'=============建新文件==========
Function MakeCodeFile()
if SetPower(1,3)=false then EndProc "<br><li>没文件操作权限,创建文本文件失败!",1,""
dim sTo,sStr
dim CF,Path,OF
dim starStr,endStr,titlestr,CreatName,HTML_str
sTo=GetValue(request.QueryString("to"),"str","")
sStr=CheckFile(sTo,0,"04")
if sStr<>"True" then EndProc sStr,1,""
Path=Server.mappath(GetPathDir&sTo)
if Fso.FileExists(Path) then EndProc "<br><li>文件已经存在!",1,""
Set CF = Fso.CreateTextFile(Path, True)
CreatName="Create by "&membername&" / "&formatDateTime(now(),1)&" / "&formatDateTime(now(),4)
starStr="<HTML>"&vbcrlf&_
"<HEAD>"&vbcrlf
endStr="<META http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">"&vbcrlf&_
"<META NAME=""Generator"" CONTENT=""CoolSel1.0"">"&vbcrlf&_
"<META NAME=""Author"" CONTENT="""&membername&""">"&vbcrlf&_
"<META NAME=""Keywords"" CONTENT="""">"&vbcrlf&_
"<META NAME=""Description"" CONTENT="""&CreatName&""">"&vbcrlf&_
"</HEAD>"&vbcrlf&vbcrlf&_
"<BODY>"&vbcrlf&vbcrlf&_
"</BODY>"&vbcrlf&_
"</HTML>"
Select CASE GetOption
CASE 10
HTML_str="<!DOCTYPE HTML PUBLIC ""-//W3C//DTD HTML 4.0 Transitional//EN"">"&vbcrlf
titlestr="<TITLE>My New HTML Document</TITLE>"&vbcrlf
CASE 11
HTML_str="<"+"% "+"@"+"LANGUAGE=""VBSCRIPT"" CODEPAGE=""936"" %"+">"&vbcrlf&_
"<"+"% "+"Option Explicit "&vbcrlf&_
"Response.Buffer = True"+" %"+">"&vbcrlf
titlestr="<TITLE>My New ASP VBScript Document</TITLE>"&vbcrlf
CASE 12
HTML_str="<"+"% "+"@"+"LANGUAGE=""JAVASCRIPT"" CODEPAGE=""936"" %"+">"&vbcrlf&_
"<"+"% "+" "&vbcrlf&_
"Response.Buffer = true;"+" %"+">"&vbcrlf
titlestr="<TITLE>My New ASP JavaScript Document</TITLE>"&vbcrlf
CASE 13
HTML_str="<"+"%"+"@"+" Page Language=""C#"" ContentType=""text/html"" ResponseEncoding=""gb2312"""+" %"+">"&vbcrlf
titlestr="<title>My New ASP.NET C# Document</title>"&vbcrlf
CASE 14
HTML_str="<"+"%"+"@"+" Page Language=""VB"" ContentType=""text/html"" ResponseEncoding=""gb2312"""+" %"+">"&vbcrlf
titlestr="<title>My New ASP.NET VB Document</title>"&vbcrlf
CASE 15
HTML_str="<"+"?"+"xml"+" version=""1.0"" encoding=""gb2312"""+"?"+">"&vbcrlf
CASE 18
HTML_str="<!--"+"Text document"+"//-->"&vbcrlf&CreatName&vbcrlf
CASE else HTML_str=CreatName
End Select
if GetOption<15 then HTML_str=HTML_str&starStr&titlestr&endStr
CF.WriteLine(HTML_str)
CF.Close
set CF=nothing
response.redirect("EditFile_Adv.asp?action=OpenIt&Option=5&path="&GetPathDir&sTo)
End Function
%>
<head>
<style type="text/css">
<!--
A:LINK {Text-Decoration: none; color:#ffffff;}
A:VISITED {Text-Decoration: none; color:#ffffff;}
A:Active {Text-Decoration: none; color:#ffffff;}
A:HOVER {Text-Decoration: none; color:#000000;}
.txt0 {
border: 0px groove;
background-color: #eeeeee;
FONT-FAMILY: "Tahoma","MS Shell Dlg";
font-size: 12px;
letter-spacing: 1px;
word-spacing: 2px;
line-height: 130%;
padding-left: 10px;
}
.txt1 {
border: 0px groove;
background-color: #eeeeee;
font-family: "Courier New", "Courier", "mono";
font-size: 12px;
letter-spacing: 1px;
word-spacing: 2px;
line-height: 130%;
padding-left: 10px;
}
.txt2 {
border: 0px groove;
background-color: #eeeeee;
FONT-FAMILY: "Georgia", "Times New Roman", "Times", "serif";
font-size: 12px;
letter-spacing: 1px;
word-spacing: 2px;
line-height: 130%;
padding-left: 10px;
}
.txt3 {
border: 0px groove;
background-color: #eeeeee;
FONT-FAMILY: "mono","宋体", "Tahoma";
font-size: 12px;
letter-spacing: 1px;
word-spacing: 2px;
line-height: 130%;
padding-left: 10px;
}
.txt4 {
border: 0px groove;
background-color: #eeeeee;
FONT-FAMILY: "Arial","Helvetica", "san-serif","Geneva", "宋体_GB2312";
font-size: 12px;
letter-spacing: 1px;
word-spacing: 2px;
line-height: 130%;
padding-left: 10px;
}
-->
</style>
<Script Language="JavaScript">
<!--
// 行号部分
var rows=<%=getEndline%>;
function addrows()
{
var keys=event.keyCode;
if(keys==13)
{rows++;
rowsnum.innerHTML+=rows+'<br>';
}
}
//-->
</Script>
<SCRIPT LANGUAGE="JavaScript">
<!--
function popupwin()
{
//if (document.form2.content=="")
//{window.parent.close();}
//else
{window.parent.focus();}
}
function Rep() //打开文本替换操作窗口
{var openmenum=window.openmenu.value
if (openmenum!="1")
{var info = "<table width='100%' height='100%' border='1' align='center' cellpadding='0' cellspacing='0' bordercolorlight='#666666' bordercolordark='#eeeeee' bgcolor='#D4D0c8'>" +"\n"+
" <tr> " +"\n"+
" <td height='20' class=''> Find what :</td>" +"\n"+
" </tr>" +"\n"+
" <tr align='left' valign='middle'> " +"\n"+
" <td align='center' valign='middle' class=''><textarea name='repLeft' class='tx' id='textarea4' style='width:95%;height:40'></textarea></td>" +"\n"+
" </tr>" +"\n"+
" <tr align='left' valign='middle'> " +"\n"+
" <td height='20' align='left' valign='middle' class=''> Replace with: </td>" +"\n"+
" </tr>" +"\n"+
" <tr align='left' valign='middle'> " +"\n"+
" <td align='center' valign='middle' class=''><textarea name='repMid' class='tx' id='textarea5' style='width:95%;height:40'></textarea></td>" +"\n"+
" </tr>" +"\n"+
" <tr align='left' valign='middle'> " +"\n"+
" <td height='25' valign='top' class=''> last words: " +"\n"+
" <input type='text' name='repRight' id='repRight2' style='width:70' class='tx'> " +"\n"+
" <input type='checkbox' name='isRemove' id='isRemove' value='y' checked>Replace splitted words " +"\n"+
" <img src='pic/1rep.gif' width=22 height=22 onmouseover=\"this.src='pic/1rep_h.gif';\" onmouseout=\"this.src='pic/1rep.gif';\" onmousedown=\"this.src='pic/1rep_d.gif';\" name='repss' align=absmiddle alt='执行替换' onClick='ReplaceTEXT();'>" +"\n"+
" <img src='pic/1undo.gif' width=22 height=22 onmouseover=\"this.src='pic/1undo_h.gif';\" onmouseout=\"this.src='pic/1undo.gif';\" onmousedown=\"this.src='pic/1undo_d.gif';\" name='undos' align=absmiddle alt='撤消替换' onClick='Undo();'> " +"\n"+
"<img src='pic/1exit.gif' width=22 height=22 onmouseover=\"this.src='pic/1exit_h.gif';\" onmouseout=\"this.src='pic/1exit.gif';\" onmousedown=\"this.src='pic/1exit_d.gif';\" name='exitss' align=absmiddle alt='关闭替换' onclick='closethis();'></td>" +"\n"+
" </tr>" +"\n"+
" </table>";
window.replaceTEXT.innerHTML=info;
window.openmenu.value="1";}
else
{
closethis();
}
}
function selectcodepage() //选择创建代码文件类型
{
var openmenum=window.openmenu.value
if (openmenum!="2")
{var info = " <table width='100%' height='100%' border='1' align='center' cellpadding='0' cellspacing='0' bordercolorlight='#666666' bordercolordark='#eeeeee' bgcolor='#D4D0c8'>" +"\n"+
" <tr> " +"\n"+
" <td height='20' align='left' valign='middle' class=''> 选择代码类型:(<img src=\"pic/refreshiron.gif\" onmouseover=\"this.src='pic/refreshiron_h.gif';\" onMouseout=\"this.src='pic/refreshiron.gif';\" alt=\"刷新当前目录\" style=\"cursor: hand;\" onClick='refreshframe(0);' align='absmiddle'> <span title=\"刷新当前目录\" onclick='refreshframe(0);' style='cursor:hand;' ><font color=#0000ff>刷新当前路径:<%=GetPathDir%></font></span>)</td>" +"\n"+
" </tr>" +"\n"+
" <tr align='left' valign='middle'> " +"\n"+
" <td align='left' valign='middle' class=''>" +"\n"+
" <input type='radio' name='radiocode' value='10' onclick=\"MkCodeFile('newtxtHTML.html','10');\">HTML Page<br>" +"\n"+
" <input type='radio' name='radiocode' value='11' onclick=\"MkCodeFile('newtxtASPv.asp','11');\">ASP /Vbscript<br>" +"\n"+
" <input type='radio' name='radiocode' value='12' onclick=\"MkCodeFile('newtxtASPj.asp','12');\">ASP /JavaScript<br>" +"\n"+
" <input type='radio' name='radiocode' value='13' onclick=\"MkCodeFile('newtxtC.aspx','13');\">ASP.NET /C#<br>" +"\n"+
" <input type='radio' name='radiocode' value='14' onclick=\"MkCodeFile('newtxtVB.aspx','14');\">ASP.NET /VB<br>" +"\n"+
" <input type='radio' name='radiocode' value='15' onclick=\"MkCodeFile('newtxtXML.xml','15');\">XML Page<br>" +"\n"+
" <input type='radio' name='radiocode' value='18' onclick=\"MkCodeFile('newtxt.txt','18');\">TXT document" +"\n"+
" <img src='pic/1exit.gif' width=22 height=22 onmouseover=\"this.src='pic/1exit_h.gif';\" onmouseout=\"this.src='pic/1exit.gif';\" onmousedown=\"this.src='pic/1exit_d.gif';\" name='exitss' align=absmiddle alt='关闭选择' onclick='closethis();'></td>" +"\n"+
" </tr>" +"\n"+
" </table>"
window.replaceTEXT.innerHTML=info;
window.openmenu.value="2";}
else
{
closethis();
}
}
function HtmltoJS()
{var openmenum=window.openmenu.value
if (openmenum!="3")
{var info = "<table align=center width='100%' height='100%' border='1' align='center' cellpadding='0' cellspacing='0' bordercolorlight='#666666' bordercolordark='#eeeeee' bgcolor='#D4D0c8'>"+"\n"+
"<TR><TD align=center><textarea name=code id=code rows=10 style='width:90%;' class=tx>" +"\n"+
" </textarea>" +"\n"+
"</td></tr><tr><td height=26 align=center>"+"\n"+
"<img src=\"pic/1tojs.gif\" width=22 height=22 onmouseover=\"this.src='pic/1tojs_h.gif';\" onmouseout=\"this.src='pic/1tojs.gif';\" onmousedown=\"this.src='pic/1tojs_d.gif';\" name=\"rereloadfile\" align=absmiddle alt=\"执行转换\" onclick=toScript(document.all['code'])> "+"\n"+
" <img src='pic/1HtmPre.gif' width=22 height=22 onmouseover=\"this.src='pic/1HtmPre_h.gif';\" onmouseout=\"this.src='pic/1HtmPre.gif';\" onmousedown=\"this.src='pic/1HtmPre_d.gif';\" name='Previews' align=absmiddle alt='运行该代码' onclick=runCode(1)> " +"\n"+
" <img src='pic/1exit.gif' width=22 height=22 onmouseover=\"this.src='pic/1exit_h.gif';\" onmouseout=\"this.src='pic/1exit.gif';\" onmousedown=\"this.src='pic/1exit_d.gif';\" name='exitss' align=absmiddle onclick=closethis() alt='关闭转换'>" +"\n"+
"</TD></TR></TABLE>";
window.replaceTEXT.innerHTML=info;
window.openmenu.value="3";}
else
{
closethis();
}
}
function closethis() //关闭选择菜单
{
window.replaceTEXT.innerHTML="";
window.openmenu.value="off";
}
//-->
</SCRIPT>
<SCRIPT LANGUAGE="JavaScript">
<!--
function toScript(val)
{
var value = val.value;
var A="\\"+"\"";
var B="\\"+"\'";
value = value.replace(/"/gi,A).replace(/'/gi,B);
valArr = value.split("\r\n");
value="<span id=innerCode1> </span>\n"
value+="<"+"SCRIPT LANGUAGE=\"JavaScript\">\n"+"<!--"+"\n";
for (i=0; i<valArr.length; i++)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -