博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
FreeTextBox3.3.0使用总结
阅读量:7121 次
发布时间:2019-06-28

本文共 4188 字,大约阅读时间需要 13 分钟。

他妈的!

为了使用这个FreeTextBox,着实折腾了不少时间。

其实我们一直都有用这个东西,不过版本很低,并且是其他同事的代码,我自己不怎么接触,不熟;现在跑到源站点上下载了一个3.3.0。

总结有几大问题:

0、参数配置问题

其中

language=“zh-CN”,中文

SupportFolder,对应JavaScriptLocation,是存放JS所在的路径。

ImageGalleryUrl,上传图片页面地址,注意它是这样写的:"./ftb/ftb.imagegallery.aspx?rif={0}&cif={0}"

这个{0}系统会自动置换为ImageGalleryPath的值。

ImageGalleryPath,存放上传图片的路径。我在后台,从配置文件里读出设置赋值给它:

txtContent.ImageGalleryPath = System.Configuration.ConfigurationManager.AppSettings["ImgUpload"];

1、汉化问题

1)首先,引用  FreeTextBox   的时候,应当将属性language=“zh-CN”

2)有些提示,包括插入图片窗口的文字,可以直接修改js文件

这里有一些问题要注意:

引用FreeTextBox的时候,要将

JavaScriptLocation="ExternalFile"
其中,
SupportFolder="~/news/ftb/"
就是JS存放的位置

汉化JS以后,要注意文件的编码问题。我编辑的时候,源文件是GB2312的,要另存为UTF-8编码的。

3)上传图片(image gallery)这个的汉化,要重载控件<FTB:ImageGallery> 的Render事件

public partial class ftb_imagegallery : System.Web.UI.Page{    protected override void Render(HtmlTextWriter writer)    {        writer.Write(this.ChineseGallery());    }    ///     /// 获取控件,汉化之    ///     /// 
private string ChineseGallery() { StringWriter writer = new StringWriter(); //提供一个可以写的文本区域 HtmlTextWriter buffer = new HtmlTextWriter(writer); //让htmlWriter操作这个区域,我们就可以获得这个区域里的内容 base.Render(buffer); //先让页面画一遍,让我们得到初始的页面html代码 string html = writer.ToString(); //找到这段代码,我们来处理它,把英文变成汉字 // html = html.Replace("There are no images:", "现在还没有图片"); html = html.Replace("Upload File", "上传图片"); html = html.Replace("Status", "状态"); html = html.Replace("Selected Image", "选中的图片"); html = html.Replace("Create Folder", "创建目录"); html = html.Replace("Delete Image", "删除该图片"); html = html.Replace("\"Upload\"", "\"上传\""); html = html.Replace("Preview", "预览图片"); html = html.Replace("Dimensions", "设置显示尺寸"); html = html.Replace("Original Size", "原图大小"); html = html.Replace("Custom Size", "设置为"); html = html.Replace("Lock image ratio", "锁定尺寸比例"); html = html.Replace("Percentage", "百分比"); html = html.Replace("Image Gallery", "我的像册"); html = html.Replace("Properties", "图片属性"); html = html.Replace("Align", "横向排列"); html = html.Replace("Border", "边框"); html = html.Replace("VSpace", "左边距"); html = html.Replace("HSpace", "上边距"); html = html.Replace("Alt", "转换文字"); html = html.Replace("Title", "图片标题"); html = html.Replace("value=\"Insert\"", "value=\"插入到编辑器中\""); // return html; }}
这样就可以得到一个汉化的图片上传界面

2、license(许可证)问题

FreeTextBox有一些功能需要许可证。比如插入图片,如果没有许可证,它只弹出一个JS的对话框,让你简单地写个地址,而不是功能比较强的设置界面。我在本地测试时,因为会自动有个许可证,没发现这个问题,等上传到服务器后,才发现这个功能不能使用,大惑不解,搞了好一阵子,超级恶心。

网上有个神人传授了生成许可证的方法,又是DES加密,又是多少空格,我一看头都大了。时间耗不起。

幸好FreeTextBox的作者比较厚道,是否有许可证,目前看,只区别于是否会输出这么一句:

本地有许可证

服务器上没有许可证

结果我手动将这句加在控件后面,就可以用插入图片功能了。

注意要加在后面。放控件前面不行。不知道为什么。

3、IE及IE内核浏览器兼容问题

体现在上传图片这里。

用FF、Chrome浏览器都没问题,但IE6\7以及基于这些内核的酷狗也,360也,一打开图片上传,就死机。这个跟是否有许可证没有关系,估计是跟JS有关系。因为在官方DEMO上,我用同样的浏览器去试,一点问题没有。看页面源代码,它没有直接引用JS,应该是靠控件自己输出JS模式的。

后来,将FTB-ImageGallery.js里的2句代码注释了就好了。

function FTB_ResizeGalleryArea() {	gallery = document.getElementById('Gallery');	galleryTop = document.getElementById('GalleryTop');	galleryBottom = document.getElementById('GalleryBottom');	sideBar = document.getElementById('GallerySideBar');		if (FTB_Browser.isIE) {	    // check window height		if (document.body.offsetHeight < (galleryTop.offsetHeight + galleryBottom.offsetHeight + sideBar.offsetHeight) ) {			window.resizeTo(750, galleryTop.offsetHeight + galleryBottom.offsetHeight + sideBar.offsetHeight+100);		}        //这段代码会死机						//gallery.style.height = document.body.offsetHeight - (galleryTop.offsetHeight + galleryBottom.offsetHeight);		//gallery.style.width = document.body.offsetWidth - sideBar.offsetWidth;		} else {		if (window.innerHeight < (galleryTop.offsetHeight + galleryBottom.offsetHeight + sideBar.offsetHeight) ) {			window.resizeTo(750, galleryTop.offsetHeight + galleryBottom.offsetHeight + sideBar.offsetHeight+100);		}		gallery.style.height =  window.innerHeight - (galleryTop.offsetHeight + galleryBottom.offsetHeight);		gallery.style.width = window.innerWidth - sideBar.offsetWidth;					}	};

转载于:https://www.cnblogs.com/leftfist/archive/2011/12/26/4258086.html

你可能感兴趣的文章
调查显示,大多数 Java 开发人员不希望学习新语言
查看>>
华为诉美国政府案新进展,法院已发传票
查看>>
小米成立AIoT战略委员会,加速落地All in AIoT战略 ...
查看>>
全栈必备 JavaScript基础
查看>>
soamanager将RFC类型的FM发布成web service
查看>>
兰晟生物医药完成数千万元A轮融资,引领神经精神疾病创新药物的快速发展 ...
查看>>
中国 HBase 技术社区 2019 年全国 meetup 计划
查看>>
书籍:Learn Web Development with Python - 2018.pdf
查看>>
C++雾中风景13:volatile解惑
查看>>
使用Ceph集群作为Kubernetes的动态分配持久化存储
查看>>
SAP权限对象的校验
查看>>
# 关于“态势感知”产品活动体验
查看>>
《语义Web编程》一导读
查看>>
Django 模板
查看>>
elasticsearch-head插件安装
查看>>
2018-10-05学习笔记
查看>>
Python进阶目录
查看>>
node+express上传图片到七牛
查看>>
Mac 中下载阅读 Android 源码
查看>>
使用ApiPost模拟发送get、post、delete、put等http请求
查看>>