📄 filesys_editor.asp
字号:
<%
Option Explicit
'----------------------------------------------------------------------------------
'本页:
' 文件系统编辑器页面
'说明:
'
'----------------------------------------------------------------------------------
%>
<!--#include file="inc/Config.class.asp"-->
<!--#include file="inc/DBControl.class.asp"-->
<!--#include file="inc/FunctionLib.class.asp"-->
<!--#include file="inc/Manager.class.asp"-->
<!--#include file="inc/FileSys.class.asp"-->
<%
Dim Cfg, Db, FLib, Admin, Tfs
Set Cfg = New Config
Set Db = New DBControl
Set FLib = New FunctionLib
Set Admin = New Manager
Set Tfs = New TFileSys
If Not Admin.Logined Then
FLib.Alert "对不起,你已经超时或未登录","./",1
Response.End
End If
If Not Admin.CheckPopedom("TSYS_GROUP4_FILESYS") Then
FLib.Alert "权限不足", "BACK", 0
Response.End
ENd If
Dim Tfs_CreateResult, FileName, FilePath
Tfs.CurrIndex = Request("CurrIndex")
Tfs.CurrPath = Request("CurrPath")
Tfs_CreateResult = Tfs.Init()
If Tfs.CurrIndex <> -1 AND Not Tfs.IsAvailable Then
Set Tfs = Nothing
FLib.Alert "目录已不存在", "BACK", 0
Response.End
End If
If Not Tfs.EnableEdit Then
FLib.Alert "此目录下不允许编辑","CLOSE",1
Response.End
End If
FileName = Request("FileName")
FilePath = Tfs.RealPath & Tfs.FormatPath(FileName)
If Instr("|" & UCase(Tfs.EditFext) & "|", "|" & Ucase(Tfs.GetFileEx(FileName)) & "|") = 0 Then
FLib.Alert "此类型的文件不允许被编辑","CLOSE",1
Response.End
End If
Dim Fso, Fl, Fl_Size
Set Fso = Server.CreateObject(Cfg.FileSystemObject_Name)
If Not Fso.FileExists(FilePath) Then
Set Fso = Nothing
FLib.Alert "对不起,文件不存在","CLOSE",1
Response.End
End If
If Request("Work") = "SaveFileChange" Then
SaveFileChange()
End If
'文件以写方式打开
Set Fl = Fso.GetFile(FilePath)
Fl_Size = Fl.Size
If Fl_Size > Cfg.FileSYS_Editor_MaxSize Then
Set Fl = Nothing
FLib.Alert "对不起,文件过大,无法打开\n当前大小:" & Fl_Size &"/b","CLOSE",1
Response.End
End If
Set Fl = Nothing
Set Fl = Fso.OpenTextFile(FilePath, 1, False)
Dim Content
If Fl_Size = 0 Then
Content = ""
Else
Content = Fl.ReadAll()
End If
Fl.Close()
Set Fl = Nothing
%>
<html>
<head>
<title><%=FileName%> - TSYS Editor</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="inc/style.css" rel="stylesheet" type="text/css">
<style>
body {
margin: 0px;
padding: 0px;
text-align: center;
border: none;
background-color:buttonface;
}
.fileNameLabel{
color:#000000;
}
</style>
<SCRIPT LANGUAGE="JavaScript">
<!--
function chkForm(obj)
{
if(confirm("确定要保存修改吗?"))
{
return true;
}else{
return false
}
}
//-->
</SCRIPT>
</head>
<body bgcolor="#666666" text="#000000" leftmargin="1" topmargin="1">
<table border="0" cellspacing="0" cellpadding="1" width="100%" height="100%">
<form name="form1" method="post" action="" onsubmit="return chkForm(this)">
<tr>
<td>
<textarea name="content" cols="90" rows="20" class="input_button" style="width:100%;height:100%"><%=Server.HtmlEncode(Content)%></textarea>
</td>
</tr>
<tr>
<td height="19" align="right">
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="63%"><a class="fileNameLabel" href="<%=Tfs.VisitUrl & FileName%>" target="_blank"><%=FileName%></a></td>
<td align="right" width="37%">
<input type="hidden" name="Work" value="SaveFileChange">
<input type="hidden" name="CurrIndex" value="<%=Tfs.CurrIndex%>">
<input type="hidden" name="CurrPath" value="<%=Tfs.CurrPath%>">
<input type="hidden" name="FileName" value="<%=FileName%>">
<input name="Submit" type="submit" class="input_button" value="保 存">
<input name="Submit2" type="button" class="input_button" value="关闭" onclick="window.close();opener.focus();">
</td>
</tr>
</table>
</td>
</tr>
</form>
</table>
<%
Set Fl = Nothing
%>
</body>
</html>
<%
'函数:保存文件编辑
Function SaveFileChange()
Dim Content
Content = Request("Content")
Dim Fso, Fl, Fl_Size
Set Fso = Server.CreateObject(Cfg.FileSystemObject_Name)
Set Fl = Fso.OpenTextFile(FilePath, 2, False)
Fl.Write(Content)
Fl.Close
Set Fl = Nothing
Set Fso = NOthing
FLib.Alert "保存完毕!","CLOSE",1
Response.End
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -