Archive

Posts Tagged ‘fck’

fckeditor2.6rc精简探讨

March 30th, 2008 humker No comments

一,使用js脚本压缩类似与zend optimizer
fckeditor2.6rc核心JS代码的精简方法简述:
用EmEditor打开核心JS代码的两个文件:
fckeditor\editor\js\fckeditorcode_ie.js
fckeditor\editor\js\fckeditorcode_gecko.js
先将两个文件的前面的/* … */注释删除
然后打开“替换”对话框(或按Ctrl+H),打勾“正则表达式”,
在“查找”文本框中输入:
^(.)
在“替换”文本框中输入:
;\1
再按“全部替换”按钮,完成替换后。Ctrl+A全选,Ctrl+C复制,然后打开下面的链接
http://dean.edwards.name/packer/
粘贴到上面的 Paste 文本框中,并打勾 Base62 encode ,然后按“Pack”按钮,稍等片刻,将 Copy 文本框的文本全选并粘贴回刚才的JS文件中,然后Ctrl+S保存!
加密后代码执行速度有待考虑,自己本地感觉是慢了,是不是decode需要时间呢?

二,删除多余的table和if判断,去除不常用的功能,以减少代码体积。这是一个技术活,可以根本上减少核心代码

Categories: 整站程序 Tags:

ecms fck 半自动 实现图片上传插入

March 28th, 2008 humker No comments

fck用php整合

php整合方法:
1,下载官方的文件,
include("fckeditor/fckeditor.php");//fck类加载
$oFCKeditor = new FCKeditor('newstext') ;  // 创建FCKeditor实例
$oFCKeditor->BasePath = 'fckeditor/';        // 设置FCKeditor目录地址
$FCKeditor->Width='100%';                //设置显示宽度
$FCKeditor->Height='300px';               //设置显示高度的高度
$oFCKeditor->Create() ;                    // 创建编辑器
2,需要修改部分文件
fckeditor_php5.php文件中的
// Render the linked hidden field下面的input改为textarea
fckeditor_php4.php也做相应修改
3,利用sablog的启发,调用fck的api
在addnews.php中加入下面的东西
<script>
//sablog
function addhtml(newstext){
 var oEditor = FCKeditorAPI.GetInstance('newstext');
 if ( oEditor.EditMode == FCK_EDITMODE_WYSIWYG ) {
  oEditor.InsertHtml(newstext) ;
 } else {
  alert('请先转换到所见即所得模式') ;
 }
}
var smdirurl = 'http://localhost';
//插入表情
function insertsmiley(icon){
 addhtml('<img src="'+smdirurl+icon+'" border="0" alt="" />');
}
</script>
4,在html/1.php中的合适位置增加
<tr><td>图片插入工具:</td><td>
 
<img src="/images/smiles/angry.gif" alt="" onclick="javascript:insertsmiley(document.add.titlepic.value)" /></td></tr>
5,做合适的修改,这是使用缩略图的对话框实现的,就是有些笨,用着还可以。

Categories: 整站程序 Tags: ,

fck完美整合ecms改动最小

March 28th, 2008 humker 2 comments

4月1日,今天通过努力自己可以添加fck的按钮,当然是按钮直接连接到ecms的上传组件,经过了两三次js和php间的传值,特别麻烦,还是下面的外挂式整合来的轻松,这就是天使不在他的精简编辑器中不加入上传自己的原因,其中的漏洞也没有人知道。 

参考了
http://blog.csdn.net/flying_huang/archive/2007/03/23/1539206.aspx
http://www.javaeye.com/topic/150487

在/html/1.php合适位置加入
<a onclick="window.open('editor/file.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=1&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传图片"><img src="editor/images/img.gif" /></a><a onclick="window.open('editor/file.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=2&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传FLASH"><img src="editor/images/flash.gif" /></a><a onclick="window.open('editor/file.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=0&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传附件"><img src="editor/images/file.gif" /></a><a onclick="window.open('editor/file.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=3&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传多媒体文件"><img src="editor/images/rm.gif" /></a><a onclick="window.open('editor/TranMore.php?userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=1&classid=<?=$classid?>&filepass=<?=$filepass?>','','width=700,height=550,scrollbars=yes');" title="上传多图片"><img src="editor/images/tranmoreimg.gif" /></a>

充分利用帝国自身的文件

在file.php加入
function DoFile(html1)
{ var oEditor = opener.FCKeditorAPI.GetInstance('newstext') ;
 
 
 
  oEditor.InsertHtml(html1);

 
}
function InsertFile(filename,fname,fileid,filesize,filetype,fileno,dotype){
 var vstr="";
 if(dotype!=undefined)
 {
  vstr=showModalDialog("popups/insertfile.php?ecms="+dotype+"&fname="+fname+"&fileid="+fileid+"&filesize="+filesize+"&filetype="+filetype+"&filename="+filename, "", "dialogWidth:45.5em; dialogHeight:27.5em; status:0");
  if(vstr==undefined)
  {
   return false;
  }
  
 
 }
 DoFile(vstr);

 window.close();
}

其他的参看其他帖子

Categories: 整站程序 Tags: ,

fck完美整合ecms

March 27th, 2008 humker No comments

突然想了一个问题,在fckeditor.html那动手加几个按钮,还真不如在1.html那里加,修改的文件最少,自己绕了一个大圈子。

呵呵。 

还是有些问题,上传多图插不进去,涉及到帝国的核心库,发出来,WM肯定不让。
其他的基本ok了,有问题跟帖
使用的是ecms的上传组件,代码插入到fck编辑器中,有不符合xhtml标准的,涉及到帝国的核心库,没办法改。ecms开源后就可以改改了,那样就更个性化了。
一,准备工作
1,fck官方下载fckeditor
2,删除fck一些没有用的文件,_samples,_source,filemanager(使用帝国的上传,故删除)文件夹
3,将fck放在ecms的e/admin目录下
二,修改必要的文件
1,addnews.php头部“//html编辑器”至“//强制签发权限”之间注释或删除;
页面开始位置加入include("fckeditor/fckeditor.php");
2,修改e/data/html/1.php
自己找到那个textarea修改为下面的东西
<textarea id="newstext" name="newstext" style="height: 30em; width: 100%;display:none;"><?=$ecmsfirstpost==1?"":stripSlashes($newstext)?></textarea>
<iframe id="newstext___Frame" 
src="fckeditor/editor/fckeditor.php?InstanceName=newstext&Toolbar=Default&userid=<?=$logininid?>&username=<?=$loginin?>&rnd=<?=$loginrnd?>&type=1&classid=<?=$classid?>&filepass=<?=$filepass?>"
        width="100%" height="600" frameborder="0" scrolling="no">
</iframe>
3,将fckeditor/editor/fckeditor.html后缀改为php,进行变量传递。
4,修改fckeditor/editor/fckeditor.php,加按钮
5,还有一些慢慢加,先放出来了
三,第二步,你可以不用做,直接上传,覆盖文件。注意!!!如果你以前改过文件还是先备份。

 帝国的坛子传不上去,现在这里放着,两天后删除。希望版主上传至帝国的坛子,自己这里是虚拟主机,带宽受不了。

下载:

http://www.humker.com/file_download/1/fck%E6%95%B4%E5%90%88%E5%B8%9D%E5%9B%BD.rar

Categories: 整站程序 Tags: ,

FCKeditor的工具栏调用

March 7th, 2008 humker No comments

是用FCKeditor后可以发现实际上是产生了一个iframe
而这个iframe指向一个FCK组件的html地址
如果不使用对象方式来产生fck编辑器,而是仿造iframe及上面的写法也是可以产生FCK编辑器的
但是这样一来,对用户设置的限制工具栏的作用就没有了
按照下面的方式调用
<iframe id="FCKeditor1___Frame"
        src="/fckeditor/editor/fckeditor.html?InstanceName=FCKeditor1&Toolbar=Default"
        width="100%" height="200" frameborder="0" scrolling="no">
</iframe>
可以获得所有的工具栏

Categories: 整站程序 Tags: