rails_kindeditor 0.0.3 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +115 -16
- data/app/controllers/kindeditor/assets_controller.rb +119 -42
- data/app/uploaders/kindeditor/asset_uploader.rb +68 -0
- data/app/uploaders/kindeditor/file_uploader.rb +3 -58
- data/app/uploaders/kindeditor/flash_uploader.rb +14 -0
- data/app/uploaders/kindeditor/image_uploader.rb +3 -58
- data/app/uploaders/kindeditor/media_uploader.rb +14 -0
- data/lib/generators/rails_kindeditor/install/install_generator.rb +1 -2
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor-init.js +9 -8
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor-min.js +158 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/en.js +208 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/zh_CN.js +210 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/lang/zh_TW.js +210 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/clearhtml/clearhtml.js +28 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/code/code.js +57 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/code/prettify.css +13 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/code/prettify.js +28 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/emoticons.js +129 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{0.gif → images/0.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{1.gif → images/1.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{10.gif → images/10.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{100.gif → images/100.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{101.gif → images/101.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{102.gif → images/102.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{103.gif → images/103.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{104.gif → images/104.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{105.gif → images/105.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{106.gif → images/106.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{107.gif → images/107.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{108.gif → images/108.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{109.gif → images/109.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{11.gif → images/11.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{110.gif → images/110.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{111.gif → images/111.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{112.gif → images/112.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{113.gif → images/113.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{114.gif → images/114.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{115.gif → images/115.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{116.gif → images/116.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{117.gif → images/117.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{118.gif → images/118.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{119.gif → images/119.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{12.gif → images/12.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{120.gif → images/120.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{121.gif → images/121.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{122.gif → images/122.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{123.gif → images/123.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{124.gif → images/124.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{125.gif → images/125.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{126.gif → images/126.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{127.gif → images/127.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{128.gif → images/128.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{129.gif → images/129.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{13.gif → images/13.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{130.gif → images/130.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{131.gif → images/131.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{132.gif → images/132.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{133.gif → images/133.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{134.gif → images/134.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{14.gif → images/14.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{15.gif → images/15.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{16.gif → images/16.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{17.gif → images/17.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{18.gif → images/18.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{19.gif → images/19.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{2.gif → images/2.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{20.gif → images/20.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{21.gif → images/21.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{22.gif → images/22.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{23.gif → images/23.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{24.gif → images/24.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{25.gif → images/25.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{26.gif → images/26.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{27.gif → images/27.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{28.gif → images/28.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{29.gif → images/29.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{3.gif → images/3.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{30.gif → images/30.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{31.gif → images/31.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{32.gif → images/32.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{33.gif → images/33.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{34.gif → images/34.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{35.gif → images/35.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{36.gif → images/36.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{37.gif → images/37.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{38.gif → images/38.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{39.gif → images/39.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{4.gif → images/4.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{40.gif → images/40.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{41.gif → images/41.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{42.gif → images/42.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{43.gif → images/43.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{44.gif → images/44.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{45.gif → images/45.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{46.gif → images/46.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{47.gif → images/47.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{48.gif → images/48.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{49.gif → images/49.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{5.gif → images/5.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{50.gif → images/50.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{51.gif → images/51.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{52.gif → images/52.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{53.gif → images/53.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{54.gif → images/54.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{55.gif → images/55.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{56.gif → images/56.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{57.gif → images/57.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{58.gif → images/58.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{59.gif → images/59.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{6.gif → images/6.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{60.gif → images/60.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{61.gif → images/61.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{62.gif → images/62.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{63.gif → images/63.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{64.gif → images/64.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{65.gif → images/65.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{66.gif → images/66.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{67.gif → images/67.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{68.gif → images/68.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{69.gif → images/69.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{7.gif → images/7.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{70.gif → images/70.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{71.gif → images/71.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{72.gif → images/72.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{73.gif → images/73.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{74.gif → images/74.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{75.gif → images/75.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{76.gif → images/76.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{77.gif → images/77.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{78.gif → images/78.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{79.gif → images/79.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{8.gif → images/8.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{80.gif → images/80.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{81.gif → images/81.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{82.gif → images/82.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{83.gif → images/83.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{84.gif → images/84.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{85.gif → images/85.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{86.gif → images/86.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{87.gif → images/87.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{88.gif → images/88.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{89.gif → images/89.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{9.gif → images/9.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{90.gif → images/90.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{91.gif → images/91.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{92.gif → images/92.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{93.gif → images/93.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{94.gif → images/94.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{95.gif → images/95.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{96.gif → images/96.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{97.gif → images/97.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{98.gif → images/98.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{99.gif → images/99.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/emoticons/{qq.gif → images/static.gif} +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/filemanager/filemanager.js +189 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/file-16.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/file-64.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/folder-16.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/folder-64.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/{file_manager → filemanager}/images/go-up.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/flash/flash.js +128 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/image/image.js +226 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/insertfile/insertfile.js +104 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/lineheight/lineheight.js +38 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/link/link.js +59 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/map/map.html +57 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/map/map.js +135 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/media/media.js +136 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/pagebreak/pagebreak.js +26 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/plainpaste/plainpaste.js +41 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/preview/preview.js +31 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/quickformat/quickformat.js +71 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/table/table.js +661 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/html/1.html +14 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/html/2.html +42 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/html/3.html +36 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/template/template.js +58 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/wordpaste/wordpaste.js +57 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/blank.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/flash.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/loading.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/media.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/common/rm.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes}/default/bg.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/{skins → themes/default}/default.css +427 -396
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/themes/default/default.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/themes/simple/simple.css +148 -0
- data/lib/generators/rails_kindeditor/migration/migration_generator.rb +16 -3
- data/{app/models → lib/generators/rails_kindeditor/migration/templates/models/active_record}/kindeditor/asset.rb +2 -5
- data/{app/models → lib/generators/rails_kindeditor/migration/templates/models/active_record}/kindeditor/file.rb +1 -2
- data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/flash.rb +3 -0
- data/{app/models → lib/generators/rails_kindeditor/migration/templates/models/active_record}/kindeditor/image.rb +1 -2
- data/lib/generators/rails_kindeditor/migration/templates/models/active_record/kindeditor/media.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/asset.rb +20 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/file.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/flash.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/image.rb +3 -0
- data/lib/generators/rails_kindeditor/migration/templates/models/mongoid/kindeditor/media.rb +3 -0
- data/lib/rails_kindeditor/helper.rb +14 -2
- data/lib/rails_kindeditor/version.rb +1 -1
- data/rails_kindeditor.gemspec +3 -3
- metadata +199 -182
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/kindeditor.js +0 -4688
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/about.html +0 -52
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/accessory.html +0 -74
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/advtable/advtable.html +0 -235
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/advtable/cell.html +0 -201
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.css +0 -64
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.html +0 -31
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/file_manager/file_manager.js +0 -221
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/flash.html +0 -69
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/image/image.html +0 -305
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/link/link.html +0 -82
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/media.html +0 -73
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/plainpaste.html +0 -44
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/wordpaste.html +0 -50
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/doc.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/editor.css +0 -47
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/mp3.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/pdf.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/rar.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/common/xls.gif +0 -0
- data/lib/generators/rails_kindeditor/install/templates/kindeditor/skins/default/default.gif +0 -0
data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/filemanager/filemanager.js
ADDED
@@ -0,0 +1,189 @@
|
|
1
|
+
/*******************************************************************************
|
2
|
+
* KindEditor - WYSIWYG HTML Editor for Internet
|
3
|
+
* Copyright (C) 2006-2011 kindsoft.net
|
4
|
+
*
|
5
|
+
* @author Roddy <luolonghao@gmail.com>
|
6
|
+
* @site http://www.kindsoft.net/
|
7
|
+
* @licence http://www.kindsoft.net/license.php
|
8
|
+
*******************************************************************************/
|
9
|
+
|
10
|
+
KindEditor.plugin('filemanager', function(K) {
|
11
|
+
var self = this, name = 'filemanager',
|
12
|
+
fileManagerJson = K.undef(self.fileManagerJson, self.basePath + 'php/file_manager_json.php'),
|
13
|
+
imgPath = self.pluginsPath + name + '/images/',
|
14
|
+
lang = self.lang(name + '.');
|
15
|
+
function makeFileTitle(filename, filesize, datetime) {
|
16
|
+
return filename + ' (' + Math.ceil(filesize / 1024) + 'KB, ' + datetime + ')';
|
17
|
+
}
|
18
|
+
function bindTitle(el, data) {
|
19
|
+
if (data.is_dir) {
|
20
|
+
el.attr('title', data.filename);
|
21
|
+
} else {
|
22
|
+
el.attr('title', makeFileTitle(data.filename, data.filesize, data.datetime));
|
23
|
+
}
|
24
|
+
}
|
25
|
+
self.plugin.filemanagerDialog = function(options) {
|
26
|
+
var width = K.undef(options.width, 520),
|
27
|
+
height = K.undef(options.height, 510),
|
28
|
+
dirName = K.undef(options.dirName, ''),
|
29
|
+
viewType = K.undef(options.viewType, 'VIEW').toUpperCase(), // "LIST" or "VIEW"
|
30
|
+
clickFn = options.clickFn;
|
31
|
+
var html = [
|
32
|
+
'<div style="padding:10px 20px;">',
|
33
|
+
// header start
|
34
|
+
'<div class="ke-plugin-filemanager-header">',
|
35
|
+
// left start
|
36
|
+
'<div class="ke-left">',
|
37
|
+
'<img class="ke-inline-block" name="moveupImg" src="' + imgPath + 'go-up.gif" width="16" height="16" border="0" alt="" /> ',
|
38
|
+
'<a class="ke-inline-block" name="moveupLink" href="javascript:;">' + lang.moveup + '</a>',
|
39
|
+
'</div>',
|
40
|
+
// right start
|
41
|
+
'<div class="ke-right">',
|
42
|
+
lang.viewType + ' <select class="ke-inline-block" name="viewType">',
|
43
|
+
'<option value="VIEW">' + lang.viewImage + '</option>',
|
44
|
+
'<option value="LIST">' + lang.listImage + '</option>',
|
45
|
+
'</select> ',
|
46
|
+
lang.orderType + ' <select class="ke-inline-block" name="orderType">',
|
47
|
+
'<option value="NAME">' + lang.fileName + '</option>',
|
48
|
+
'<option value="SIZE">' + lang.fileSize + '</option>',
|
49
|
+
'<option value="TYPE">' + lang.fileType + '</option>',
|
50
|
+
'</select>',
|
51
|
+
'</div>',
|
52
|
+
'<div class="ke-clearfix"></div>',
|
53
|
+
'</div>',
|
54
|
+
// body start
|
55
|
+
'<div class="ke-plugin-filemanager-body"></div>',
|
56
|
+
'</div>'
|
57
|
+
].join('');
|
58
|
+
var dialog = self.createDialog({
|
59
|
+
name : name,
|
60
|
+
width : width,
|
61
|
+
height : height,
|
62
|
+
title : self.lang(name),
|
63
|
+
body : html
|
64
|
+
}),
|
65
|
+
div = dialog.div,
|
66
|
+
bodyDiv = K('.ke-plugin-filemanager-body', div),
|
67
|
+
moveupImg = K('[name="moveupImg"]', div),
|
68
|
+
moveupLink = K('[name="moveupLink"]', div),
|
69
|
+
viewServerBtn = K('[name="viewServer"]', div),
|
70
|
+
viewTypeBox = K('[name="viewType"]', div),
|
71
|
+
orderTypeBox = K('[name="orderType"]', div);
|
72
|
+
function reloadPage(path, order, func) {
|
73
|
+
var url = fileManagerJson, param = '&path=' + path + '&order=' + order + '&dir=' + dirName;
|
74
|
+
if (!/\?/.test(url)) {
|
75
|
+
url += '?';
|
76
|
+
param = param.substr(1);
|
77
|
+
}
|
78
|
+
url += param + '&' + new Date().getTime();
|
79
|
+
K.ajax(url, func);
|
80
|
+
}
|
81
|
+
var elList = [];
|
82
|
+
function bindEvent(el, result, data, createFunc) {
|
83
|
+
var fileUrl = K.formatUrl(result.current_url + data.filename, 'absolute'),
|
84
|
+
dirPath = encodeURIComponent(result.current_dir_path + data.filename + '/');
|
85
|
+
if (data.is_dir) {
|
86
|
+
el.click(function(e) {
|
87
|
+
reloadPage(dirPath, orderTypeBox.val(), createFunc);
|
88
|
+
});
|
89
|
+
} else if (data.is_photo) {
|
90
|
+
el.click(function(e) {
|
91
|
+
clickFn.call(this, fileUrl, data.filename);
|
92
|
+
});
|
93
|
+
} else {
|
94
|
+
el.click(function(e) {
|
95
|
+
clickFn.call(this, fileUrl, data.filename);
|
96
|
+
});
|
97
|
+
}
|
98
|
+
elList.push(el);
|
99
|
+
}
|
100
|
+
function createCommon(result, createFunc) {
|
101
|
+
// remove events
|
102
|
+
K.each(elList, function() {
|
103
|
+
this.unbind();
|
104
|
+
});
|
105
|
+
moveupLink.unbind();
|
106
|
+
viewTypeBox.unbind();
|
107
|
+
orderTypeBox.unbind();
|
108
|
+
// add events
|
109
|
+
if (result.current_dir_path) {
|
110
|
+
moveupLink.click(function(e) {
|
111
|
+
reloadPage(result.moveup_dir_path, orderTypeBox.val(), createFunc);
|
112
|
+
});
|
113
|
+
}
|
114
|
+
function changeFunc() {
|
115
|
+
if (viewTypeBox.val() == 'VIEW') {
|
116
|
+
reloadPage(result.current_dir_path, orderTypeBox.val(), createView);
|
117
|
+
} else {
|
118
|
+
reloadPage(result.current_dir_path, orderTypeBox.val(), createList);
|
119
|
+
}
|
120
|
+
}
|
121
|
+
viewTypeBox.change(changeFunc);
|
122
|
+
orderTypeBox.change(changeFunc);
|
123
|
+
bodyDiv.html('');
|
124
|
+
}
|
125
|
+
function createList(result) {
|
126
|
+
createCommon(result, createList);
|
127
|
+
var table = document.createElement('table');
|
128
|
+
table.className = 'ke-table';
|
129
|
+
table.cellPadding = 0;
|
130
|
+
table.cellSpacing = 0;
|
131
|
+
table.border = 0;
|
132
|
+
bodyDiv.append(table);
|
133
|
+
var fileList = result.file_list;
|
134
|
+
for (var i = 0, len = fileList.length; i < len; i++) {
|
135
|
+
var data = fileList[i], row = K(table.insertRow(i));
|
136
|
+
row.mouseover(function(e) {
|
137
|
+
K(this).addClass('ke-on');
|
138
|
+
})
|
139
|
+
.mouseout(function(e) {
|
140
|
+
K(this).removeClass('ke-on');
|
141
|
+
});
|
142
|
+
var iconUrl = imgPath + (data.is_dir ? 'folder-16.gif' : 'file-16.gif'),
|
143
|
+
img = K('<img src="' + iconUrl + '" width="16" height="16" alt="' + data.filename + '" align="absmiddle" />'),
|
144
|
+
cell0 = K(row[0].insertCell(0)).addClass('ke-cell ke-name').append(img).append(document.createTextNode(' ' + data.filename));
|
145
|
+
if (!data.is_dir || data.has_file) {
|
146
|
+
row.css('cursor', 'pointer');
|
147
|
+
cell0.attr('title', data.filename);
|
148
|
+
bindEvent(cell0, result, data, createList);
|
149
|
+
} else {
|
150
|
+
cell0.attr('title', lang.emptyFolder);
|
151
|
+
}
|
152
|
+
K(row[0].insertCell(1)).addClass('ke-cell ke-size').html(data.is_dir ? '-' : Math.ceil(data.filesize / 1024) + 'KB');
|
153
|
+
K(row[0].insertCell(2)).addClass('ke-cell ke-datetime').html(data.datetime);
|
154
|
+
}
|
155
|
+
}
|
156
|
+
function createView(result) {
|
157
|
+
createCommon(result, createView);
|
158
|
+
var fileList = result.file_list;
|
159
|
+
for (var i = 0, len = fileList.length; i < len; i++) {
|
160
|
+
var data = fileList[i],
|
161
|
+
div = K('<div class="ke-inline-block ke-item"></div>');
|
162
|
+
bodyDiv.append(div);
|
163
|
+
var photoDiv = K('<div class="ke-inline-block ke-photo"></div>')
|
164
|
+
.mouseover(function(e) {
|
165
|
+
K(this).addClass('ke-on');
|
166
|
+
})
|
167
|
+
.mouseout(function(e) {
|
168
|
+
K(this).removeClass('ke-on');
|
169
|
+
});
|
170
|
+
div.append(photoDiv);
|
171
|
+
var fileUrl = result.current_url + data.filename,
|
172
|
+
iconUrl = data.is_dir ? imgPath + 'folder-64.gif' : (data.is_photo ? fileUrl : imgPath + 'file-64.gif');
|
173
|
+
var img = K('<img src="' + iconUrl + '" width="80" height="80" alt="' + data.filename + '" />');
|
174
|
+
if (!data.is_dir || data.has_file) {
|
175
|
+
photoDiv.css('cursor', 'pointer');
|
176
|
+
bindTitle(photoDiv, data);
|
177
|
+
bindEvent(photoDiv, result, data, createView);
|
178
|
+
} else {
|
179
|
+
photoDiv.attr('title', lang.emptyFolder);
|
180
|
+
}
|
181
|
+
photoDiv.append(img);
|
182
|
+
div.append('<div class="ke-name" title="' + data.filename + '">' + data.filename + '</div>');
|
183
|
+
}
|
184
|
+
}
|
185
|
+
viewTypeBox.val(viewType);
|
186
|
+
reloadPage('', orderTypeBox.val(), viewType == 'VIEW' ? createView : createList);
|
187
|
+
}
|
188
|
+
|
189
|
+
});
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,128 @@
|
|
1
|
+
/*******************************************************************************
|
2
|
+
* KindEditor - WYSIWYG HTML Editor for Internet
|
3
|
+
* Copyright (C) 2006-2011 kindsoft.net
|
4
|
+
*
|
5
|
+
* @author Roddy <luolonghao@gmail.com>
|
6
|
+
* @site http://www.kindsoft.net/
|
7
|
+
* @licence http://www.kindsoft.net/license.php
|
8
|
+
*******************************************************************************/
|
9
|
+
|
10
|
+
KindEditor.plugin('flash', function(K) {
|
11
|
+
var self = this, name = 'flash', lang = self.lang(name + '.'),
|
12
|
+
allowFlashUpload = K.undef(self.allowFlashUpload, true),
|
13
|
+
allowFileManager = K.undef(self.allowFileManager, false),
|
14
|
+
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php');
|
15
|
+
self.plugin.flash = {
|
16
|
+
edit : function() {
|
17
|
+
var html = [
|
18
|
+
'<div style="padding:10px 20px;">',
|
19
|
+
//url
|
20
|
+
'<div class="ke-dialog-row">',
|
21
|
+
'<label for="keUrl" style="width:60px;">' + lang.url + '</label>',
|
22
|
+
'<input class="ke-input-text" type="text" id="keUrl" name="url" value="" style="width:160px;" /> ',
|
23
|
+
'<input type="button" class="ke-upload-button" value="' + lang.upload + '" /> ',
|
24
|
+
'<span class="ke-button-common ke-button-outer">',
|
25
|
+
'<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />',
|
26
|
+
'</span>',
|
27
|
+
'</div>',
|
28
|
+
//width
|
29
|
+
'<div class="ke-dialog-row">',
|
30
|
+
'<label for="keWidth" style="width:60px;">' + lang.width + '</label>',
|
31
|
+
'<input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="550" maxlength="4" /> ',
|
32
|
+
'</div>',
|
33
|
+
//height
|
34
|
+
'<div class="ke-dialog-row">',
|
35
|
+
'<label for="keHeight" style="width:60px;">' + lang.height + '</label>',
|
36
|
+
'<input type="text" id="keHeight" class="ke-input-text ke-input-number" name="height" value="400" maxlength="4" /> ',
|
37
|
+
'</div>',
|
38
|
+
'</div>'
|
39
|
+
].join('');
|
40
|
+
var dialog = self.createDialog({
|
41
|
+
name : name,
|
42
|
+
width : 450,
|
43
|
+
height : 200,
|
44
|
+
title : self.lang(name),
|
45
|
+
body : html,
|
46
|
+
yesBtn : {
|
47
|
+
name : self.lang('yes'),
|
48
|
+
click : function(e) {
|
49
|
+
var url = urlBox.val(),
|
50
|
+
html = K.mediaImg(self.themesPath + 'common/blank.gif', {
|
51
|
+
src : url,
|
52
|
+
type : K.mediaType('.swf'),
|
53
|
+
width : widthBox.val(),
|
54
|
+
height : heightBox.val(),
|
55
|
+
quality : 'high'
|
56
|
+
});
|
57
|
+
self.insertHtml(html).hideDialog().focus();
|
58
|
+
}
|
59
|
+
}
|
60
|
+
}),
|
61
|
+
div = dialog.div,
|
62
|
+
urlBox = K('[name="url"]', div),
|
63
|
+
viewServerBtn = K('[name="viewServer"]', div),
|
64
|
+
widthBox = K('[name="width"]', div),
|
65
|
+
heightBox = K('[name="height"]', div);
|
66
|
+
urlBox.val('http://');
|
67
|
+
|
68
|
+
if (allowFlashUpload) {
|
69
|
+
var uploadbutton = K.uploadbutton({
|
70
|
+
button : K('.ke-upload-button', div)[0],
|
71
|
+
fieldName : 'imgFile',
|
72
|
+
url : uploadJson + '?dir=flash',
|
73
|
+
afterUpload : function(data) {
|
74
|
+
if (data.error === 0) {
|
75
|
+
var url = K.formatUrl(data.url, 'absolute');
|
76
|
+
urlBox.val(url);
|
77
|
+
if (self.afterUpload) {
|
78
|
+
self.afterUpload.call(self, url);
|
79
|
+
}
|
80
|
+
alert(self.lang('uploadSuccess'));
|
81
|
+
} else {
|
82
|
+
alert(data.message);
|
83
|
+
}
|
84
|
+
}
|
85
|
+
});
|
86
|
+
uploadbutton.fileBox.change(function(e) {
|
87
|
+
uploadbutton.submit();
|
88
|
+
});
|
89
|
+
} else {
|
90
|
+
K('.ke-upload-button', div).hide();
|
91
|
+
urlBox.width(250);
|
92
|
+
}
|
93
|
+
|
94
|
+
if (allowFileManager) {
|
95
|
+
viewServerBtn.click(function(e) {
|
96
|
+
self.loadPlugin('filemanager', function() {
|
97
|
+
self.plugin.filemanagerDialog({
|
98
|
+
viewType : 'LIST',
|
99
|
+
dirName : 'flash',
|
100
|
+
clickFn : function(url, title) {
|
101
|
+
if (self.dialogs.length > 1) {
|
102
|
+
K('[name="url"]', div).val(url);
|
103
|
+
self.hideDialog();
|
104
|
+
}
|
105
|
+
}
|
106
|
+
});
|
107
|
+
});
|
108
|
+
});
|
109
|
+
} else {
|
110
|
+
viewServerBtn.hide();
|
111
|
+
}
|
112
|
+
|
113
|
+
var img = self.plugin.getSelectedFlash();
|
114
|
+
if (img) {
|
115
|
+
var attrs = K.mediaAttrs(img.attr('data-ke-tag'));
|
116
|
+
urlBox.val(attrs.src);
|
117
|
+
widthBox.val(K.removeUnit(img.css('width')) || attrs.width || 0);
|
118
|
+
heightBox.val(K.removeUnit(img.css('height')) || attrs.height || 0);
|
119
|
+
}
|
120
|
+
urlBox[0].focus();
|
121
|
+
urlBox[0].select();
|
122
|
+
},
|
123
|
+
'delete' : function() {
|
124
|
+
self.plugin.getSelectedFlash().remove();
|
125
|
+
}
|
126
|
+
};
|
127
|
+
self.clickToolbar(name, self.plugin.flash.edit);
|
128
|
+
});
|
@@ -0,0 +1,226 @@
|
|
1
|
+
/*******************************************************************************
|
2
|
+
* KindEditor - WYSIWYG HTML Editor for Internet
|
3
|
+
* Copyright (C) 2006-2011 kindsoft.net
|
4
|
+
*
|
5
|
+
* @author Roddy <luolonghao@gmail.com>
|
6
|
+
* @site http://www.kindsoft.net/
|
7
|
+
* @licence http://www.kindsoft.net/license.php
|
8
|
+
*******************************************************************************/
|
9
|
+
|
10
|
+
KindEditor.plugin('image', function(K) {
|
11
|
+
var self = this, name = 'image',
|
12
|
+
allowImageUpload = K.undef(self.allowImageUpload, true),
|
13
|
+
allowFileManager = K.undef(self.allowFileManager, false),
|
14
|
+
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'),
|
15
|
+
imgPath = self.basePath + 'plugins/image/images/',
|
16
|
+
lang = self.lang(name + '.');
|
17
|
+
self.plugin.image = {
|
18
|
+
edit : function() {
|
19
|
+
var html = [
|
20
|
+
'<div style="padding:10px 20px;">',
|
21
|
+
//tabs
|
22
|
+
'<div class="tabs"></div>',
|
23
|
+
//url or file
|
24
|
+
'<div class="ke-dialog-row">',
|
25
|
+
'<div class="tab1" style="display:none;">',
|
26
|
+
'<label for="keUrl" style="width:60px;">' + lang.remoteUrl + '</label>',
|
27
|
+
'<input type="text" id="keUrl" class="ke-input-text" name="url" value="" style="width:200px;" /> ',
|
28
|
+
'<span class="ke-button-common ke-button-outer">',
|
29
|
+
'<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />',
|
30
|
+
'</span>',
|
31
|
+
'</div>',
|
32
|
+
'<div class="tab2" style="display:none;">',
|
33
|
+
'<label style="width:60px;">' + lang.localUrl + '</label>',
|
34
|
+
'<input type="text" name="localUrl" class="ke-input-text" tabindex="-1" style="width:200px;" readonly="true" /> ',
|
35
|
+
'<input type="button" class="ke-upload-button" value="' + lang.viewServer + '" />',
|
36
|
+
'</div>',
|
37
|
+
'</div>',
|
38
|
+
//size
|
39
|
+
'<div class="ke-dialog-row">',
|
40
|
+
'<label for="keWidth" style="width:60px;">' + lang.size + '</label>',
|
41
|
+
lang.width + ' <input type="text" id="keWidth" class="ke-input-text ke-input-number" name="width" value="" maxlength="4" /> ',
|
42
|
+
lang.height + ' <input type="text" class="ke-input-text ke-input-number" name="height" value="" maxlength="4" /> ',
|
43
|
+
'<img class="ke-refresh-btn" src="' + imgPath + 'refresh.gif" width="16" height="16" alt="" style="cursor:pointer;" />',
|
44
|
+
'</div>',
|
45
|
+
//align
|
46
|
+
'<div class="ke-dialog-row">',
|
47
|
+
'<label style="width:60px;">' + lang.align + '</label>',
|
48
|
+
'<input type="radio" name="align" class="ke-inline-block" value="" checked="checked" /> <img name="defaultImg" src="' + imgPath + 'align_top.gif" width="23" height="25" alt="" />',
|
49
|
+
' <input type="radio" name="align" class="ke-inline-block" value="left" /> <img name="leftImg" src="' + imgPath + 'align_left.gif" width="23" height="25" alt="" />',
|
50
|
+
' <input type="radio" name="align" class="ke-inline-block" value="right" /> <img name="rightImg" src="' + imgPath + 'align_right.gif" width="23" height="25" alt="" />',
|
51
|
+
'</div>',
|
52
|
+
//title
|
53
|
+
'<div class="ke-dialog-row">',
|
54
|
+
'<label for="keTitle" style="width:60px;">' + lang.imgTitle + '</label>',
|
55
|
+
'<input type="text" id="keTitle" class="ke-input-text" name="title" value="" style="width:200px;" /></div>',
|
56
|
+
'</div>',
|
57
|
+
'</div>'
|
58
|
+
].join('');
|
59
|
+
var dialogWidth = allowImageUpload ? 450 : 400;
|
60
|
+
dialogHeight = allowImageUpload ? 300 : 250;
|
61
|
+
var dialog = self.createDialog({
|
62
|
+
name : name,
|
63
|
+
width : dialogWidth,
|
64
|
+
height : dialogHeight,
|
65
|
+
title : self.lang(name),
|
66
|
+
body : html,
|
67
|
+
yesBtn : {
|
68
|
+
name : self.lang('yes'),
|
69
|
+
click : function(e) {
|
70
|
+
// insert local image
|
71
|
+
if (tabs.selectedIndex === 1) {
|
72
|
+
uploadbutton.submit();
|
73
|
+
return;
|
74
|
+
}
|
75
|
+
// insert remote image
|
76
|
+
var url = urlBox.val(),
|
77
|
+
width = widthBox.val(),
|
78
|
+
height = heightBox.val(),
|
79
|
+
title = titleBox.val(),
|
80
|
+
align = '';
|
81
|
+
alignBox.each(function() {
|
82
|
+
if (this.checked) {
|
83
|
+
align = this.value;
|
84
|
+
return false;
|
85
|
+
}
|
86
|
+
});
|
87
|
+
self.exec('insertimage', url, title, width, height, 0, align).hideDialog().focus();
|
88
|
+
}
|
89
|
+
},
|
90
|
+
beforeRemove : function() {
|
91
|
+
viewServerBtn.remove();
|
92
|
+
widthBox.remove();
|
93
|
+
heightBox.remove();
|
94
|
+
refreshBtn.remove();
|
95
|
+
uploadbutton.remove();
|
96
|
+
}
|
97
|
+
}),
|
98
|
+
div = dialog.div;
|
99
|
+
|
100
|
+
var tabs;
|
101
|
+
if (allowImageUpload) {
|
102
|
+
tabs = K.tabs({
|
103
|
+
src : K('.tabs', div),
|
104
|
+
afterSelect : function(i) {
|
105
|
+
|
106
|
+
}
|
107
|
+
});
|
108
|
+
tabs.add({
|
109
|
+
title : lang.remoteImage,
|
110
|
+
panel : K('.tab1', div)
|
111
|
+
});
|
112
|
+
tabs.add({
|
113
|
+
title : lang.localImage,
|
114
|
+
panel : K('.tab2', div)
|
115
|
+
});
|
116
|
+
tabs.select(0);
|
117
|
+
} else {
|
118
|
+
K('.tab1', div).show();
|
119
|
+
}
|
120
|
+
|
121
|
+
var urlBox = K('[name="url"]', div),
|
122
|
+
localUrlBox = K('[name="localUrl"]', div),
|
123
|
+
viewServerBtn = K('[name="viewServer"]', div),
|
124
|
+
widthBox = K('[name="width"]', div),
|
125
|
+
heightBox = K('[name="height"]', div),
|
126
|
+
refreshBtn = K('.ke-refresh-btn', div),
|
127
|
+
titleBox = K('[name="title"]', div),
|
128
|
+
alignBox = K('[name="align"]');
|
129
|
+
|
130
|
+
var uploadbutton = K.uploadbutton({
|
131
|
+
button : K('.ke-upload-button', div)[0],
|
132
|
+
fieldName : 'imgFile',
|
133
|
+
url : uploadJson + '?dir=image',
|
134
|
+
afterUpload : function(data) {
|
135
|
+
if (data.error === 0) {
|
136
|
+
var width = widthBox.val(),
|
137
|
+
height = heightBox.val(),
|
138
|
+
title = titleBox.val(),
|
139
|
+
align = '';
|
140
|
+
alignBox.each(function() {
|
141
|
+
if (this.checked) {
|
142
|
+
align = this.value;
|
143
|
+
return false;
|
144
|
+
}
|
145
|
+
});
|
146
|
+
var url = K.formatUrl(data.url, 'absolute');
|
147
|
+
self.exec('insertimage', url, title, width, height, 0, align).hideDialog().focus();
|
148
|
+
if (self.afterUpload) {
|
149
|
+
self.afterUpload.call(self, url);
|
150
|
+
}
|
151
|
+
} else {
|
152
|
+
alert(data.message);
|
153
|
+
}
|
154
|
+
}
|
155
|
+
});
|
156
|
+
uploadbutton.fileBox.change(function(e) {
|
157
|
+
localUrlBox.val(uploadbutton.fileBox.val());
|
158
|
+
});
|
159
|
+
if (allowFileManager) {
|
160
|
+
viewServerBtn.click(function(e) {
|
161
|
+
self.loadPlugin('filemanager', function() {
|
162
|
+
self.plugin.filemanagerDialog({
|
163
|
+
viewType : 'VIEW',
|
164
|
+
dirName : 'image',
|
165
|
+
clickFn : function(url, title) {
|
166
|
+
if (self.dialogs.length > 1) {
|
167
|
+
K('[name="url"]', div).val(url);
|
168
|
+
self.hideDialog();
|
169
|
+
}
|
170
|
+
}
|
171
|
+
});
|
172
|
+
});
|
173
|
+
});
|
174
|
+
} else {
|
175
|
+
viewServerBtn.hide();
|
176
|
+
}
|
177
|
+
var originalWidth = 0, originalHeight = 0;
|
178
|
+
function setSize(width, height) {
|
179
|
+
widthBox.val(width);
|
180
|
+
heightBox.val(height);
|
181
|
+
originalWidth = width;
|
182
|
+
originalHeight = height;
|
183
|
+
}
|
184
|
+
refreshBtn.click(function(e) {
|
185
|
+
var tempImg = K('<img src="' + urlBox.val() + '" />', self.edit.doc).css({
|
186
|
+
position : 'absolute',
|
187
|
+
visibility : 'hidden',
|
188
|
+
top : 0,
|
189
|
+
left : '1000px'
|
190
|
+
});
|
191
|
+
K(self.edit.doc.body).append(tempImg);
|
192
|
+
setSize(tempImg.width(), tempImg.height());
|
193
|
+
tempImg.remove();
|
194
|
+
});
|
195
|
+
widthBox.change(function(e) {
|
196
|
+
if (originalWidth > 0) {
|
197
|
+
heightBox.val(Math.round(originalHeight / originalWidth * parseInt(this.value, 10)));
|
198
|
+
}
|
199
|
+
});
|
200
|
+
heightBox.change(function(e) {
|
201
|
+
if (originalHeight > 0) {
|
202
|
+
widthBox.val(Math.round(originalWidth / originalHeight * parseInt(this.value, 10)));
|
203
|
+
}
|
204
|
+
});
|
205
|
+
urlBox.val('http://');
|
206
|
+
var img = self.plugin.getSelectedImage();
|
207
|
+
if (img) {
|
208
|
+
urlBox.val(img.attr('data-ke-src'));
|
209
|
+
setSize(img.width(), img.height());
|
210
|
+
titleBox.val(img.attr('title'));
|
211
|
+
alignBox.each(function() {
|
212
|
+
if (this.value === img.attr('align')) {
|
213
|
+
this.checked = true;
|
214
|
+
return false;
|
215
|
+
}
|
216
|
+
});
|
217
|
+
}
|
218
|
+
urlBox[0].focus();
|
219
|
+
urlBox[0].select();
|
220
|
+
},
|
221
|
+
'delete' : function() {
|
222
|
+
self.plugin.getSelectedImage().remove();
|
223
|
+
}
|
224
|
+
};
|
225
|
+
self.clickToolbar(name, self.plugin.image.edit);
|
226
|
+
});
|
data/lib/generators/rails_kindeditor/install/templates/kindeditor/plugins/insertfile/insertfile.js
ADDED
@@ -0,0 +1,104 @@
|
|
1
|
+
/*******************************************************************************
|
2
|
+
* KindEditor - WYSIWYG HTML Editor for Internet
|
3
|
+
* Copyright (C) 2006-2011 kindsoft.net
|
4
|
+
*
|
5
|
+
* @author Roddy <luolonghao@gmail.com>
|
6
|
+
* @site http://www.kindsoft.net/
|
7
|
+
* @licence http://www.kindsoft.net/license.php
|
8
|
+
*******************************************************************************/
|
9
|
+
|
10
|
+
KindEditor.plugin('insertfile', function(K) {
|
11
|
+
var self = this, name = 'insertfile',
|
12
|
+
allowFileManager = K.undef(self.allowFileManager, false),
|
13
|
+
uploadJson = K.undef(self.uploadJson, self.basePath + 'php/upload_json.php'),
|
14
|
+
lang = self.lang(name + '.');
|
15
|
+
self.clickToolbar(name, function() {
|
16
|
+
var html = [
|
17
|
+
'<div style="padding:10px 20px;">',
|
18
|
+
'<div class="ke-dialog-row">',
|
19
|
+
'<label for="keUrl" style="width:60px;">' + lang.url + '</label>',
|
20
|
+
'<input type="text" id="keUrl" name="url" class="ke-input-text" style="width:160px;" /> ',
|
21
|
+
'<input type="button" class="ke-upload-button" value="' + lang.upload + '" /> ',
|
22
|
+
'<span class="ke-button-common ke-button-outer">',
|
23
|
+
'<input type="button" class="ke-button-common ke-button" name="viewServer" value="' + lang.viewServer + '" />',
|
24
|
+
'</span>',
|
25
|
+
'</div>',
|
26
|
+
//title
|
27
|
+
'<div class="ke-dialog-row">',
|
28
|
+
'<label for="keTitle" style="width:60px;">' + lang.title + '</label>',
|
29
|
+
'<input type="text" id="keTitle" class="ke-input-text" name="title" value="" style="width:160px;" /></div>',
|
30
|
+
'</div>',
|
31
|
+
//form end
|
32
|
+
'</form>',
|
33
|
+
'</div>'
|
34
|
+
].join('');
|
35
|
+
var dialog = self.createDialog({
|
36
|
+
name : name,
|
37
|
+
width : 450,
|
38
|
+
height : 180,
|
39
|
+
title : self.lang(name),
|
40
|
+
body : html,
|
41
|
+
yesBtn : {
|
42
|
+
name : self.lang('yes'),
|
43
|
+
click : function(e) {
|
44
|
+
var url = urlBox.val(),
|
45
|
+
title = titleBox.val();
|
46
|
+
if (K.trim(title) === '') {
|
47
|
+
title = url;
|
48
|
+
}
|
49
|
+
var html = '<a href="' + url + '" data-ke-src="' + url + '" target="_blank">' + title + '</a>';
|
50
|
+
self.insertHtml(html);
|
51
|
+
uploadbutton.remove();
|
52
|
+
self.hideDialog().focus();
|
53
|
+
}
|
54
|
+
}
|
55
|
+
}),
|
56
|
+
div = dialog.div;
|
57
|
+
|
58
|
+
var urlBox = K('[name="url"]', div),
|
59
|
+
viewServerBtn = K('[name="viewServer"]', div),
|
60
|
+
titleBox = K('[name="title"]', div);
|
61
|
+
|
62
|
+
var uploadbutton = K.uploadbutton({
|
63
|
+
button : K('.ke-upload-button', div)[0],
|
64
|
+
fieldName : 'imgFile',
|
65
|
+
url : uploadJson + '?dir=file',
|
66
|
+
afterUpload : function(data) {
|
67
|
+
if (data.error === 0) {
|
68
|
+
var url = K.formatUrl(data.url, 'absolute');
|
69
|
+
urlBox.val(url);
|
70
|
+
if (self.afterUpload) {
|
71
|
+
self.afterUpload.call(self, url);
|
72
|
+
}
|
73
|
+
alert(self.lang('uploadSuccess'));
|
74
|
+
} else {
|
75
|
+
alert(data.message);
|
76
|
+
}
|
77
|
+
}
|
78
|
+
});
|
79
|
+
uploadbutton.fileBox.change(function(e) {
|
80
|
+
uploadbutton.submit();
|
81
|
+
});
|
82
|
+
if (allowFileManager) {
|
83
|
+
viewServerBtn.click(function(e) {
|
84
|
+
self.loadPlugin('filemanager', function() {
|
85
|
+
self.plugin.filemanagerDialog({
|
86
|
+
viewType : 'LIST',
|
87
|
+
dirName : 'file',
|
88
|
+
clickFn : function(url, title) {
|
89
|
+
if (self.dialogs.length > 1) {
|
90
|
+
K('[name="url"]', div).val(url);
|
91
|
+
self.hideDialog();
|
92
|
+
}
|
93
|
+
}
|
94
|
+
});
|
95
|
+
});
|
96
|
+
});
|
97
|
+
} else {
|
98
|
+
viewServerBtn.hide();
|
99
|
+
}
|
100
|
+
urlBox.val('http://');
|
101
|
+
urlBox[0].focus();
|
102
|
+
urlBox[0].select();
|
103
|
+
});
|
104
|
+
});
|