<%@ Page Language="C#" AutoEventWireup="true"%>
<%@ Import Namespace="System.Xml" %>
CodeBehind="install.aspx.cs" Inherits="WebApplication1.fckeditor.install"
<script type="text/C#" runat="server">
public string basePath = string.Empty;
protected void Page_Load(object sender, EventArgs e)
{
basePath = Request.PhysicalApplicationPath.ToString();
}
public bool SettingConfig(string uploadfile)
{
bool state = false;
try
{
//创建文件夹
if (!System.IO.Directory.Exists(basePath + uploadfile))
System.IO.Directory.CreateDirectory(basePath + uploadfile);
string basePathConfig = basePath + "Web.config";
XmlDocument xmlDoc = new XmlDocument();
xmlDoc.Load(basePathConfig); //加载你的XML文件
XmlNode appSettings = xmlDoc.SelectSingleNode("/configuration/appSettings");//查找bookstore
string[,] strs = new string[2, 2] { { "FCKeditor:BasePath", "/fckeditor/" }, { "FCKeditor:UserFilesPath", "/" + uploadfile + "/" } };
for (int i = 0; i < 2; i++)
{
XmlElement adds = xmlDoc.CreateElement("add");//创建book节点
adds.SetAttribute("key", strs[i, 0]);
adds.SetAttribute("value", strs[i, 1]);
appSettings.AppendChild(adds);
}
xmlDoc.Save(basePathConfig);
state = true;
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
return state;
}
public bool SetingJavaScript()
{
bool state = false;
string tempContent = string.Empty;
try
{
using (System.IO.StreamReader sr = new System.IO.StreamReader(basePath + "fckeditor\\fckconfig.js", System.Text.Encoding.UTF8))
{
tempContent = sr.ReadToEnd();
sr.Close();
}
tempContent = tempContent.Replace("FCKConfig.DefaultLanguage = 'en' ;", "FCKConfig.DefaultLanguage = 'zh-cn' ;").Replace("var _FileBrowserLanguage = 'asp' ;", "var _FileBrowserLanguage = 'aspx' ;").Replace("var _QuickUploadLanguage = 'asp' ;", "var _QuickUploadLanguage = 'aspx' ;");
using (System.IO.StreamWriter sw = new System.IO.StreamWriter(basePath + "fckeditor\\fckconfig.js", false, System.Text.Encoding.UTF8))
{
sw.Write(tempContent);
sw.Flush();
}
state = true;
}
catch (Exception ex)
{
Response.Write(ex.Message);
}
return state;
}
public bool CopyFile()
{
try
{
if (System.IO.File.Exists(basePath + "bin\\FredCK.FCKeditorV2.dll"))
System.IO.File.Delete(this.basePath + "fckeditor\\bin\\FredCK.FCKeditorV2.dll");
else
System.IO.File.Copy(this.basePath + "fckeditor\\bin\\FredCK.FCKeditorV2.dll", basePath + "bin\\FredCK.FCKeditorV2.dll");
}
catch (Exception ex)
{
Response.Write(ex.Message);
return false;
}
return true;
}
protected void BtSave_Click(object sender, EventArgs e)
{
SettingConfig(this.TbUploadPath.Text);
SetingJavaScript();
CopyFile();
Response.Write("success");
}
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
</head>
<body>
<form id="form1" runat="server">
<div>
上传文件夹路径: <asp:TextBox ID="TbUploadPath" runat="server"></asp:TextBox>
<br />
<asp:Button ID="BtSave" runat="server" Text="保存" style="border:1px solid"
onclick="BtSave_Click" />
</div>
</form>
</body>
</html>
分享到:
相关推荐
首先请下载谷歌地图插件文件包,解压后整个目录上传到FCK编辑器目录下的editor\plugins目录下 然后,打开FCK编辑器目录下的fckconfig.js文件,找到如下一句代码 FCKConfig.PluginsPath = FCKConfig.BasePath '...
<FCK:editor basePath="/TestFCKeditor/FCKeditor/" width="700" height="500" skinPath="/TestFCKeditor/FCKeditor/editor/skins/silver/" toolbarSet = "Default" > input </FCK:editor> --%> //JS...
4.将以下代码添加到web.xml配置文件中: <servlet-name>Connector com.FCKeditor.connector.ConnectorServlet <param-name>baseDir <param-value>/upload/ <param-name>debug <param-value>true ...
[#2412] FCK.InsertHtml() is now properly removing selected contents after content insertion in Firefox. [#2420] Spelling mistake corrections made by the spell checking dialog are now undoable. [#...
修改压缩包内的fckeditor\editor\dialog\fck_image.html 查找 <input name="thumbWidth" id="thumbWidth" type="text" value="450" size="5" /> 修改value值为自己想要的默认宽度 自定义原图HTML边框: ...
开启方法:打开fckeditor\editor\filemanager\connectors\asp\config.asp在其中找到代码:Dim ConfigIsEnabled ConfigIsEnabled = false将false改为true 上传文件目录的修改方法是在此文件中找到代码:Dim ...
3、为什么上传程序后页面无法正常显示,提示错误代码 请执行生clearache.asp重建缓存,如果执行一还不能正常显示,请多执行几次,直到能正常显示为止 PJBLOG3海神扩展增强包扩展功能介绍: 一、pjblog3最终版补丁...
首先需要说明的是,与通常意义上的编辑器不同,FCKeditor并不是一个需要安装的程序,或许说它是一个网页源代码更为贴切,所以,取而代之安装过程的是与网页源代码相集成的调用过程。 FCKeditor运行的环境是网页...
FCKEditorSample FCK编辑器的使用示例 FreeTextBoxSample FreeText编辑器的使用示例 SimpleEditor 自定义的简单在线编辑器模块 <br>第7章(\C07) 示例描述:本章示例展现了C#中的字符串操作。...
FCKEditorSample FCK编辑器的使用示例 FreeTextBoxSample FreeText编辑器的使用示例 SimpleEditor 自定义的简单在线编辑器模块 <br>第7章(\C07) 示例描述:本章示例展现了C#中的字符串操作。...