<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    老妖的博客
    現(xiàn)實(shí)的中沒有幾個(gè)人能夠真為對(duì)方去死,甚至山盟海誓很快就會(huì)在金錢面前變的微不足道,這才是生活。沒有永遠(yuǎn)的愛,除了你的父母對(duì)你,當(dāng)然也就沒有永遠(yuǎn)的恨,更沒有永遠(yuǎn)的痛,時(shí)間是最好的治療大師,它會(huì)很快撫平你心靈上累累的傷痕。很多年以后你想起來時(shí),那些在你生命中洶涌來往的人群至多是個(gè)模糊的影子或者毫無意義的名字
    posts - 105,  comments - 171,  trackbacks - 0
    1.下載fckeditor_plugin-0.3.2.zip,目前版本為0.3.2
    2.解壓到vendor\plugins目錄下,并且重新命名為fckeditor
    3.到該應(yīng)用程序根目錄下,然后運(yùn)行rake fckeditor:install,則執(zhí)行自動(dòng)安裝
    4.在自己的view層中添加
    <%= javascript_include_tag :fckeditor %>
    以及在你需要編輯的字段textarea替換為
    <%= fckeditor_textarea("book", "desc", { :toolbarKit => 'Simple', :width => '100%', :height => '200px' }) %>
    第一個(gè)參數(shù)為你的domain對(duì)象,desc為你的編輯字段值,其他顧名思義
    然后運(yùn)行你的頁面程序,發(fā)現(xiàn)simple upload有點(diǎn)bug,上傳后javascript報(bào)錯(cuò)
    5.追蹤代碼發(fā)現(xiàn)
    vendor\plugins\fckeditor\app\controllers\fckeditor_controller.rb下的

    ??def?upload
    ????self.upload_file
    ??end
    調(diào)用了upload_file方法
    def?upload_file
    ????@new_file?
    =?params[:NewFile]
    ????@url?
    =?upload_directory_path
    ????begin
    ??????ftype?
    =?@new_file.content_type.strip
    ??????
    if?!?MIME_TYPES.include?(ftype)
    ????????@errorNumber?
    =?202
    ????????puts?
    "#{ftype}?is?invalid?MIME?type"
    ????????raise?
    "#{ftype}?is?invalid?MIME?type"
    ??????
    else
    ????????path?
    =?current_directory_path?+?"/"?+?@new_file.original_filename
    ????????File.open(path,
    "wb",0664)?do?|fp|
    ??????????FileUtils.copy_stream(@new_file,?fp)
    ????????end
    ????????@errorNumber?
    =?0
    ??????end
    ????rescue?
    =>?e
    ??????@errorNumber?
    =?110?if?@errorNumber.nil?
    ????end
    ????
    ????#?Fix?provided?by?Nicola?Piccinini?
    --?http://superfluo.org
    ????render?:text?=>?%Q'<script>window.parent.frames[\'frmUpload\'].OnUploadCompleted(#{@errorNumber});</script>'
    ????#render?:inline?
    =>?'page?<<?"window.parent.frames[\'frmUpload\'].OnUploadCompleted(#{@errorNumber},?\'#{@new_file}\');"',?:type?=>?:rjs
    ??end
    中的
    render?:text?=>?%Q'<script>window.parent.frames[\'frmUpload\'].OnUploadCompleted(#{@errorNumber});</script>'
    在瀏覽服務(wù)器時(shí)是正常的,但是在快速上傳中不應(yīng)該返回這個(gè)script語句
    則修改upload方法
    def?upload
    ????@new_file?
    =?params[:NewFile]
    ????@url?
    =?upload_directory_path
    ????begin
    ??????ftype?
    =?@new_file.content_type.strip
    ??????
    if?!?MIME_TYPES.include?(ftype)
    ????????@errorNumber?
    =?202
    ????????puts?
    "#{ftype}?is?invalid?MIME?type"
    ????????raise?
    "#{ftype}?is?invalid?MIME?type"
    ??????
    else
    ????????path?
    =?current_directory_path?+?"/"?+?@new_file.original_filename
    ????????File.open(path,
    "wb",0664)?do?|fp|
    ??????????FileUtils.copy_stream(@new_file,?fp)
    ????????end
    ????????@errorNumber?
    =?0
    ??????end
    ????rescue?
    =>?e
    ??????@errorNumber?
    =?110?if?@errorNumber.nil?
    ????end
    ????
    ????#?Fix?provided?by?Nicola?Piccinini?
    --?http://superfluo.org
    ????render?:text?=>?%Q'<script>window.parent.OnUploadCompleted(#{@errorNumber},\"#{UPLOADED}/#{params[:Type]}\",\"#{@new_file.original_filename}\",\"\");</script>'
    ??end
    快速上傳問題修復(fù)

    6.發(fā)現(xiàn)文件夾里邊如果上傳圖片過多不好備份,故采用/年/月方式保存
    修改代碼如下:
    ???def?upload
    ????@new_file?
    =?params[:NewFile]
    ????@url?
    =?upload_directory_path
    ????begin
    ??????ftype?
    =?@new_file.content_type.strip
    ??????
    if?!?MIME_TYPES.include?(ftype)
    ????????@errorNumber?
    =?202
    ????????puts?
    "#{ftype}?is?invalid?MIME?type"
    ????????raise?
    "#{ftype}?is?invalid?MIME?type"
    ??????
    else
    ????????path?
    =?date_directory_path?+?"/"?+?@new_file.original_filename
    ????????File.open(path,
    "wb",0664)?do?|fp|
    ??????????FileUtils.copy_stream(@new_file,?fp)
    ????????end
    ????????@errorNumber?
    =?0
    ??????end
    ????rescue?
    =>?e
    ??????@errorNumber?
    =?110?if?@errorNumber.nil?
    ????end
    ????
    ????#?Fix?provided?by?Nicola?Piccinini?
    --?http://superfluo.org
    ????render?:text?=>?%Q'<script>window.parent.OnUploadCompleted(#{@errorNumber},\"#{UPLOADED}/#{params[:Type]}/#{Time.now.year}/#{Time.now.month}/#{@new_file.original_filename}\",\"#{@new_file.original_filename}\",\"\");</script>'
    ??end?
    ??
    private
    ??def?date_directory_path
    ????base_dir?
    =?"#{UPLOADED_ROOT}/#{params[:Type]}/#{Time.now.year}/#{Time.now.month}"
    ????#Dir.mkdir(base_dir,
    0775)?unless?File.exists?(base_dir)
    ????FileUtils.mkdir_p?base_dir
    ????
    "#{base_dir}"
    ??end
    7.同理可以對(duì)其上傳文件名稱進(jìn)行隨機(jī)處理以防重名,就不多說了。
    做此筆記,拋磚引玉。

    發(fā)現(xiàn)rails的plugin機(jī)制挺不錯(cuò)的,比較靈活,不過網(wǎng)上介紹plugin的文章真的不是很多
    posted on 2006-11-04 01:29 老妖 閱讀(4385) 評(píng)論(11)  編輯  收藏 所屬分類: rails

    FeedBack:
    # re: rails實(shí)戰(zhàn)--(四)FCKEditor與rails的集成
    2006-11-04 02:46 | li
    ROR plug-in is really cool stuff. It's more flexible than many other web framework's plug-in approach...

      回復(fù)  更多評(píng)論
      
    # re: rails實(shí)戰(zhàn)--(四)FCKEditor與rails的集成
    2006-11-05 17:10 | jelly->
    呵呵, 變成blograils了,

    我一般簡(jiǎn)單應(yīng)用的時(shí)候,喜歡直接在helper里寫一個(gè)fckeditor的方法, 像在普通htm里使用一樣。   回復(fù)  更多評(píng)論
      
    # re: rails實(shí)戰(zhàn)--(四)FCKEditor與rails的集成
    2006-11-06 19:41 | aotianlong
    Thank you . your article will posted at http://railser.com .  回復(fù)  更多評(píng)論
      
    # re: rails實(shí)戰(zhàn)--(四)FCKEditor與rails的集成
    2006-12-09 00:55 | Jerry[匿名]
    發(fā)現(xiàn)這個(gè):toolbarKit => 'Simple',顯示的根本不是Simples方式,還是復(fù)雜方式。不知道為什么。  回復(fù)  更多評(píng)論
      
    # re: rails實(shí)戰(zhàn)--(四)FCKEditor與rails的集成
    2006-12-20 17:46 | raise
    很抱歉 打擾了。

    我按照你的方法配制了,但是沒有成功,不知您是否可以提供一個(gè)已經(jīng)配制成功的例子給我。nmlnj@163.com

    謝謝了!!  回復(fù)  更多評(píng)論
      
    # re: rails實(shí)戰(zhàn)--(四)FCKEditor與rails的集成
    2006-12-20 17:51 | raise
    nmlnj@163.com

    已經(jīng)成功了

    謝謝

    打擾了  回復(fù)  更多評(píng)論
      
    # re: rails實(shí)戰(zhàn)--(四)FCKEditor與rails的集成
    2007-08-29 16:44 | Fengbo
    @Jerry[匿名]
    看看fckeditor里面toolKitset有沒有一個(gè)Simple的定義。  回復(fù)  更多評(píng)論
      
    # re: rails實(shí)戰(zhàn)--(四)FCKEditor與rails的集成
    2007-09-20 17:36 | CFC
    :toolbarKit是錯(cuò)誤的
    請(qǐng)改成
    :toolbarSet

    :)  回復(fù)  更多評(píng)論
      
    # re: rails實(shí)戰(zhàn)--(四)FCKEditor與rails的集成
    2007-09-25 16:38 | 陳剛
    如果是象博客那樣的多用戶系統(tǒng),那么需要上傳文件的目錄需要分用戶存放。如何實(shí)現(xiàn)呢?  回復(fù)  更多評(píng)論
      
    # re: rails實(shí)戰(zhàn)--(四)FCKEditor與rails的集成[未登錄]
    2007-11-30 16:01 | 小馬
    現(xiàn)實(shí)的中沒有幾個(gè)人能夠真為對(duì)方去死,甚至山盟海誓很快就會(huì)在金錢面前變的微不足道,這才是生活。沒有永遠(yuǎn)的愛,除了你的父母對(duì)你,當(dāng)然也就沒有永遠(yuǎn)的恨,更沒有永遠(yuǎn)的痛,時(shí)間是最好的治療大師,它會(huì)很快撫平你心靈上累累的傷痕。很多年以后你想起來時(shí),那些在你生命中洶涌來往的人群至多是個(gè)模糊的影子或者毫無意義的名字

    一席話驚醒夢(mèng)中人,命陪命陪命命陪……  回復(fù)  更多評(píng)論
      
    # re: rails實(shí)戰(zhàn)--(四)FCKEditor與rails的集成
    2014-09-04 14:29 | 我來學(xué)習(xí)
    提供基本的東西,但是允許輕松擴(kuò)展自定義  回復(fù)  更多評(píng)論
      

    <2014年9月>
    31123456
    78910111213
    14151617181920
    21222324252627
    2829301234
    567891011

    常用鏈接

    隨筆分類(48)

    隨筆檔案(104)

    好友鏈接

    我的豆瓣

    積分與排名

    • 積分 - 221775
    • 排名 - 257

    最新評(píng)論

    閱讀排行榜

    主站蜘蛛池模板: 亚洲国产成人久久综合碰| 四虎精品成人免费视频| 亚洲av中文无码乱人伦在线播放 | 57pao一国产成永久免费| 日韩免费在线中文字幕| 亚洲xxxx18| 91亚洲精品第一综合不卡播放| 99热亚洲色精品国产88| 亚洲AV永久无码精品成人| 国产精品亚洲玖玖玖在线观看| 在线jlzzjlzz免费播放| 麻豆最新国产剧情AV原创免费| 特级精品毛片免费观看| 国产无遮挡又黄又爽免费网站| 国产成人亚洲精品91专区高清 | 亚洲第一精品福利| 国产AV无码专区亚洲AV手机麻豆 | 亚洲精品无码人妻无码| 亚洲精品成a人在线观看| 男女午夜24式免费视频| 77777午夜亚洲| 亚洲女人影院想要爱| 久久综合亚洲鲁鲁五月天| 亚洲AV日韩AV永久无码绿巨人| 日本亚洲欧洲免费天堂午夜看片女人员| 久久久久久精品成人免费图片| 18禁超污无遮挡无码免费网站| 亚洲国产系列一区二区三区| 亚洲免费在线视频观看| 亚洲乱码中文论理电影| 亚洲va精品中文字幕| 亚洲va在线va天堂va手机| 亚洲精品二三区伊人久久| 久久亚洲最大成人网4438| 亚洲avav天堂av在线网爱情| 亚洲免费观看在线视频| 在线观看亚洲AV日韩A∨| 亚洲国产精品网站在线播放 | 久久久久免费看成人影片| 中文字幕无码一区二区免费| 无码AV片在线观看免费|