contentment 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (260) hide show
  1. data/README.rdoc +15 -0
  2. data/config/routes.rb +18 -0
  3. data/lib/contentment.rb +8 -0
  4. data/lib/contentment/engine.rb +16 -0
  5. data/lib/extensions/action_controller/base.rb +5 -0
  6. data/lib/generators/contentment/contentment_views_templates/contents/_preview.html.erb +9 -0
  7. data/lib/generators/contentment/contentment_views_templates/contents/edit.html.erb +56 -0
  8. data/lib/generators/contentment/contentment_views_templates/contents/index.html.erb +28 -0
  9. data/lib/generators/contentment/contentment_views_templates/contents/new.html.erb +37 -0
  10. data/lib/generators/contentment/contentment_views_templates/contents/show.html.erb +22 -0
  11. data/lib/generators/contentment/templates/content.rb +48 -0
  12. data/lib/generators/contentment/templates/contents_controller.rb +58 -0
  13. data/lib/generators/contentment/templates/migration.rb +24 -0
  14. data/lib/generators/contentment_generator.rb +46 -0
  15. data/lib/generators/contentment_views_generator.rb +15 -0
  16. data/public/javascripts/tiny_mce/langs/en.js +169 -0
  17. data/public/javascripts/tiny_mce/license.txt +504 -0
  18. data/public/javascripts/tiny_mce/plugins/advhr/css/advhr.css +5 -0
  19. data/public/javascripts/tiny_mce/plugins/advhr/editor_plugin.js +1 -0
  20. data/public/javascripts/tiny_mce/plugins/advhr/editor_plugin_src.js +57 -0
  21. data/public/javascripts/tiny_mce/plugins/advhr/js/rule.js +43 -0
  22. data/public/javascripts/tiny_mce/plugins/advhr/langs/en_dlg.js +5 -0
  23. data/public/javascripts/tiny_mce/plugins/advhr/rule.htm +62 -0
  24. data/public/javascripts/tiny_mce/plugins/advimage/css/advimage.css +13 -0
  25. data/public/javascripts/tiny_mce/plugins/advimage/editor_plugin.js +1 -0
  26. data/public/javascripts/tiny_mce/plugins/advimage/editor_plugin_src.js +50 -0
  27. data/public/javascripts/tiny_mce/plugins/advimage/image.htm +237 -0
  28. data/public/javascripts/tiny_mce/plugins/advimage/img/sample.gif +0 -0
  29. data/public/javascripts/tiny_mce/plugins/advimage/js/image.js +443 -0
  30. data/public/javascripts/tiny_mce/plugins/advimage/langs/en_dlg.js +43 -0
  31. data/public/javascripts/tiny_mce/plugins/advlink/css/advlink.css +8 -0
  32. data/public/javascripts/tiny_mce/plugins/advlink/editor_plugin.js +1 -0
  33. data/public/javascripts/tiny_mce/plugins/advlink/editor_plugin_src.js +61 -0
  34. data/public/javascripts/tiny_mce/plugins/advlink/js/advlink.js +528 -0
  35. data/public/javascripts/tiny_mce/plugins/advlink/langs/en_dlg.js +52 -0
  36. data/public/javascripts/tiny_mce/plugins/advlink/link.htm +338 -0
  37. data/public/javascripts/tiny_mce/plugins/advlist/editor_plugin.js +1 -0
  38. data/public/javascripts/tiny_mce/plugins/advlist/editor_plugin_src.js +154 -0
  39. data/public/javascripts/tiny_mce/plugins/autoresize/editor_plugin.js +1 -0
  40. data/public/javascripts/tiny_mce/plugins/autoresize/editor_plugin_src.js +117 -0
  41. data/public/javascripts/tiny_mce/plugins/autosave/editor_plugin.js +1 -0
  42. data/public/javascripts/tiny_mce/plugins/autosave/editor_plugin_src.js +422 -0
  43. data/public/javascripts/tiny_mce/plugins/autosave/langs/en.js +4 -0
  44. data/public/javascripts/tiny_mce/plugins/bbcode/editor_plugin.js +1 -0
  45. data/public/javascripts/tiny_mce/plugins/bbcode/editor_plugin_src.js +120 -0
  46. data/public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -0
  47. data/public/javascripts/tiny_mce/plugins/contextmenu/editor_plugin_src.js +127 -0
  48. data/public/javascripts/tiny_mce/plugins/directionality/editor_plugin.js +1 -0
  49. data/public/javascripts/tiny_mce/plugins/directionality/editor_plugin_src.js +82 -0
  50. data/public/javascripts/tiny_mce/plugins/emotions/editor_plugin.js +1 -0
  51. data/public/javascripts/tiny_mce/plugins/emotions/editor_plugin_src.js +43 -0
  52. data/public/javascripts/tiny_mce/plugins/emotions/emotions.htm +40 -0
  53. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-cool.gif +0 -0
  54. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-cry.gif +0 -0
  55. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-embarassed.gif +0 -0
  56. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
  57. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-frown.gif +0 -0
  58. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-innocent.gif +0 -0
  59. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-kiss.gif +0 -0
  60. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-laughing.gif +0 -0
  61. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
  62. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-sealed.gif +0 -0
  63. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-smile.gif +0 -0
  64. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-surprised.gif +0 -0
  65. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
  66. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-undecided.gif +0 -0
  67. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-wink.gif +0 -0
  68. data/public/javascripts/tiny_mce/plugins/emotions/img/smiley-yell.gif +0 -0
  69. data/public/javascripts/tiny_mce/plugins/emotions/js/emotions.js +22 -0
  70. data/public/javascripts/tiny_mce/plugins/emotions/langs/en_dlg.js +20 -0
  71. data/public/javascripts/tiny_mce/plugins/example/dialog.htm +27 -0
  72. data/public/javascripts/tiny_mce/plugins/example/editor_plugin.js +1 -0
  73. data/public/javascripts/tiny_mce/plugins/example/editor_plugin_src.js +84 -0
  74. data/public/javascripts/tiny_mce/plugins/example/img/example.gif +0 -0
  75. data/public/javascripts/tiny_mce/plugins/example/js/dialog.js +19 -0
  76. data/public/javascripts/tiny_mce/plugins/example/langs/en.js +3 -0
  77. data/public/javascripts/tiny_mce/plugins/example/langs/en_dlg.js +3 -0
  78. data/public/javascripts/tiny_mce/plugins/fullpage/css/fullpage.css +182 -0
  79. data/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin.js +1 -0
  80. data/public/javascripts/tiny_mce/plugins/fullpage/editor_plugin_src.js +149 -0
  81. data/public/javascripts/tiny_mce/plugins/fullpage/fullpage.htm +576 -0
  82. data/public/javascripts/tiny_mce/plugins/fullpage/js/fullpage.js +471 -0
  83. data/public/javascripts/tiny_mce/plugins/fullpage/langs/en_dlg.js +85 -0
  84. data/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin.js +1 -0
  85. data/public/javascripts/tiny_mce/plugins/fullscreen/editor_plugin_src.js +148 -0
  86. data/public/javascripts/tiny_mce/plugins/fullscreen/fullscreen.htm +110 -0
  87. data/public/javascripts/tiny_mce/plugins/iespell/editor_plugin.js +1 -0
  88. data/public/javascripts/tiny_mce/plugins/iespell/editor_plugin_src.js +54 -0
  89. data/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin.js +1 -0
  90. data/public/javascripts/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +635 -0
  91. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
  92. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
  93. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
  94. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
  95. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
  96. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
  97. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
  98. data/public/javascripts/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +90 -0
  99. data/public/javascripts/tiny_mce/plugins/inlinepopups/template.htm +387 -0
  100. data/public/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin.js +1 -0
  101. data/public/javascripts/tiny_mce/plugins/insertdatetime/editor_plugin_src.js +83 -0
  102. data/public/javascripts/tiny_mce/plugins/layer/editor_plugin.js +1 -0
  103. data/public/javascripts/tiny_mce/plugins/layer/editor_plugin_src.js +212 -0
  104. data/public/javascripts/tiny_mce/plugins/legacyoutput/editor_plugin.js +1 -0
  105. data/public/javascripts/tiny_mce/plugins/legacyoutput/editor_plugin_src.js +133 -0
  106. data/public/javascripts/tiny_mce/plugins/media/css/content.css +6 -0
  107. data/public/javascripts/tiny_mce/plugins/media/css/media.css +16 -0
  108. data/public/javascripts/tiny_mce/plugins/media/editor_plugin.js +1 -0
  109. data/public/javascripts/tiny_mce/plugins/media/editor_plugin_src.js +414 -0
  110. data/public/javascripts/tiny_mce/plugins/media/img/flash.gif +0 -0
  111. data/public/javascripts/tiny_mce/plugins/media/img/flv_player.swf +0 -0
  112. data/public/javascripts/tiny_mce/plugins/media/img/quicktime.gif +0 -0
  113. data/public/javascripts/tiny_mce/plugins/media/img/realmedia.gif +0 -0
  114. data/public/javascripts/tiny_mce/plugins/media/img/shockwave.gif +0 -0
  115. data/public/javascripts/tiny_mce/plugins/media/img/trans.gif +0 -0
  116. data/public/javascripts/tiny_mce/plugins/media/img/windowsmedia.gif +0 -0
  117. data/public/javascripts/tiny_mce/plugins/media/js/embed.js +73 -0
  118. data/public/javascripts/tiny_mce/plugins/media/js/media.js +630 -0
  119. data/public/javascripts/tiny_mce/plugins/media/langs/en_dlg.js +103 -0
  120. data/public/javascripts/tiny_mce/plugins/media/media.htm +822 -0
  121. data/public/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin.js +1 -0
  122. data/public/javascripts/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +53 -0
  123. data/public/javascripts/tiny_mce/plugins/noneditable/editor_plugin.js +1 -0
  124. data/public/javascripts/tiny_mce/plugins/noneditable/editor_plugin_src.js +90 -0
  125. data/public/javascripts/tiny_mce/plugins/pagebreak/css/content.css +1 -0
  126. data/public/javascripts/tiny_mce/plugins/pagebreak/editor_plugin.js +1 -0
  127. data/public/javascripts/tiny_mce/plugins/pagebreak/editor_plugin_src.js +77 -0
  128. data/public/javascripts/tiny_mce/plugins/pagebreak/img/pagebreak.gif +0 -0
  129. data/public/javascripts/tiny_mce/plugins/pagebreak/img/trans.gif +0 -0
  130. data/public/javascripts/tiny_mce/plugins/paste/editor_plugin.js +1 -0
  131. data/public/javascripts/tiny_mce/plugins/paste/editor_plugin_src.js +929 -0
  132. data/public/javascripts/tiny_mce/plugins/paste/js/pastetext.js +36 -0
  133. data/public/javascripts/tiny_mce/plugins/paste/js/pasteword.js +51 -0
  134. data/public/javascripts/tiny_mce/plugins/paste/langs/en_dlg.js +5 -0
  135. data/public/javascripts/tiny_mce/plugins/paste/pastetext.htm +33 -0
  136. data/public/javascripts/tiny_mce/plugins/paste/pasteword.htm +27 -0
  137. data/public/javascripts/tiny_mce/plugins/preview/editor_plugin.js +1 -0
  138. data/public/javascripts/tiny_mce/plugins/preview/editor_plugin_src.js +53 -0
  139. data/public/javascripts/tiny_mce/plugins/preview/example.html +28 -0
  140. data/public/javascripts/tiny_mce/plugins/preview/jscripts/embed.js +73 -0
  141. data/public/javascripts/tiny_mce/plugins/preview/preview.html +17 -0
  142. data/public/javascripts/tiny_mce/plugins/print/editor_plugin.js +1 -0
  143. data/public/javascripts/tiny_mce/plugins/print/editor_plugin_src.js +34 -0
  144. data/public/javascripts/tiny_mce/plugins/save/editor_plugin.js +1 -0
  145. data/public/javascripts/tiny_mce/plugins/save/editor_plugin_src.js +101 -0
  146. data/public/javascripts/tiny_mce/plugins/searchreplace/css/searchreplace.css +6 -0
  147. data/public/javascripts/tiny_mce/plugins/searchreplace/editor_plugin.js +1 -0
  148. data/public/javascripts/tiny_mce/plugins/searchreplace/editor_plugin_src.js +57 -0
  149. data/public/javascripts/tiny_mce/plugins/searchreplace/js/searchreplace.js +126 -0
  150. data/public/javascripts/tiny_mce/plugins/searchreplace/langs/en_dlg.js +16 -0
  151. data/public/javascripts/tiny_mce/plugins/searchreplace/searchreplace.htm +104 -0
  152. data/public/javascripts/tiny_mce/plugins/spellchecker/css/content.css +1 -0
  153. data/public/javascripts/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -0
  154. data/public/javascripts/tiny_mce/plugins/spellchecker/editor_plugin_src.js +341 -0
  155. data/public/javascripts/tiny_mce/plugins/spellchecker/img/wline.gif +0 -0
  156. data/public/javascripts/tiny_mce/plugins/style/css/props.css +13 -0
  157. data/public/javascripts/tiny_mce/plugins/style/editor_plugin.js +1 -0
  158. data/public/javascripts/tiny_mce/plugins/style/editor_plugin_src.js +55 -0
  159. data/public/javascripts/tiny_mce/plugins/style/js/props.js +641 -0
  160. data/public/javascripts/tiny_mce/plugins/style/langs/en_dlg.js +63 -0
  161. data/public/javascripts/tiny_mce/plugins/style/props.htm +730 -0
  162. data/public/javascripts/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -0
  163. data/public/javascripts/tiny_mce/plugins/tabfocus/editor_plugin_src.js +112 -0
  164. data/public/javascripts/tiny_mce/plugins/table/cell.htm +183 -0
  165. data/public/javascripts/tiny_mce/plugins/table/css/cell.css +17 -0
  166. data/public/javascripts/tiny_mce/plugins/table/css/row.css +25 -0
  167. data/public/javascripts/tiny_mce/plugins/table/css/table.css +13 -0
  168. data/public/javascripts/tiny_mce/plugins/table/editor_plugin.js +1 -0
  169. data/public/javascripts/tiny_mce/plugins/table/editor_plugin_src.js +1118 -0
  170. data/public/javascripts/tiny_mce/plugins/table/js/cell.js +269 -0
  171. data/public/javascripts/tiny_mce/plugins/table/js/merge_cells.js +27 -0
  172. data/public/javascripts/tiny_mce/plugins/table/js/row.js +212 -0
  173. data/public/javascripts/tiny_mce/plugins/table/js/table.js +449 -0
  174. data/public/javascripts/tiny_mce/plugins/table/langs/en_dlg.js +74 -0
  175. data/public/javascripts/tiny_mce/plugins/table/merge_cells.htm +37 -0
  176. data/public/javascripts/tiny_mce/plugins/table/row.htm +160 -0
  177. data/public/javascripts/tiny_mce/plugins/table/table.htm +192 -0
  178. data/public/javascripts/tiny_mce/plugins/template/blank.htm +12 -0
  179. data/public/javascripts/tiny_mce/plugins/template/css/template.css +23 -0
  180. data/public/javascripts/tiny_mce/plugins/template/editor_plugin.js +1 -0
  181. data/public/javascripts/tiny_mce/plugins/template/editor_plugin_src.js +159 -0
  182. data/public/javascripts/tiny_mce/plugins/template/js/template.js +106 -0
  183. data/public/javascripts/tiny_mce/plugins/template/langs/en_dlg.js +15 -0
  184. data/public/javascripts/tiny_mce/plugins/template/template.htm +38 -0
  185. data/public/javascripts/tiny_mce/plugins/visualchars/editor_plugin.js +1 -0
  186. data/public/javascripts/tiny_mce/plugins/visualchars/editor_plugin_src.js +76 -0
  187. data/public/javascripts/tiny_mce/plugins/wordcount/editor_plugin.js +1 -0
  188. data/public/javascripts/tiny_mce/plugins/wordcount/editor_plugin_src.js +98 -0
  189. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/abbr.htm +148 -0
  190. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/acronym.htm +148 -0
  191. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/attributes.htm +153 -0
  192. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/cite.htm +148 -0
  193. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/css/attributes.css +11 -0
  194. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/css/popup.css +9 -0
  195. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/del.htm +169 -0
  196. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +1 -0
  197. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +139 -0
  198. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/ins.htm +169 -0
  199. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/abbr.js +28 -0
  200. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/acronym.js +28 -0
  201. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/attributes.js +126 -0
  202. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/cite.js +28 -0
  203. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/del.js +63 -0
  204. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/element_common.js +234 -0
  205. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/js/ins.js +62 -0
  206. data/public/javascripts/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js +32 -0
  207. data/public/javascripts/tiny_mce/themes/advanced/about.htm +56 -0
  208. data/public/javascripts/tiny_mce/themes/advanced/anchor.htm +31 -0
  209. data/public/javascripts/tiny_mce/themes/advanced/charmap.htm +53 -0
  210. data/public/javascripts/tiny_mce/themes/advanced/color_picker.htm +75 -0
  211. data/public/javascripts/tiny_mce/themes/advanced/editor_template.js +1 -0
  212. data/public/javascripts/tiny_mce/themes/advanced/editor_template_src.js +1209 -0
  213. data/public/javascripts/tiny_mce/themes/advanced/image.htm +85 -0
  214. data/public/javascripts/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
  215. data/public/javascripts/tiny_mce/themes/advanced/img/icons.gif +0 -0
  216. data/public/javascripts/tiny_mce/themes/advanced/js/about.js +72 -0
  217. data/public/javascripts/tiny_mce/themes/advanced/js/anchor.js +37 -0
  218. data/public/javascripts/tiny_mce/themes/advanced/js/charmap.js +335 -0
  219. data/public/javascripts/tiny_mce/themes/advanced/js/color_picker.js +253 -0
  220. data/public/javascripts/tiny_mce/themes/advanced/js/image.js +245 -0
  221. data/public/javascripts/tiny_mce/themes/advanced/js/link.js +156 -0
  222. data/public/javascripts/tiny_mce/themes/advanced/js/source_editor.js +62 -0
  223. data/public/javascripts/tiny_mce/themes/advanced/langs/en.js +62 -0
  224. data/public/javascripts/tiny_mce/themes/advanced/langs/en_dlg.js +51 -0
  225. data/public/javascripts/tiny_mce/themes/advanced/link.htm +63 -0
  226. data/public/javascripts/tiny_mce/themes/advanced/skins/default/content.css +36 -0
  227. data/public/javascripts/tiny_mce/themes/advanced/skins/default/dialog.css +116 -0
  228. data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
  229. data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
  230. data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
  231. data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
  232. data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
  233. data/public/javascripts/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
  234. data/public/javascripts/tiny_mce/themes/advanced/skins/default/ui.css +215 -0
  235. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/content.css +35 -0
  236. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/dialog.css +115 -0
  237. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
  238. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
  239. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
  240. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui.css +216 -0
  241. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +8 -0
  242. data/public/javascripts/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
  243. data/public/javascripts/tiny_mce/themes/advanced/source_editor.htm +31 -0
  244. data/public/javascripts/tiny_mce/themes/simple/editor_template.js +1 -0
  245. data/public/javascripts/tiny_mce/themes/simple/editor_template_src.js +85 -0
  246. data/public/javascripts/tiny_mce/themes/simple/img/icons.gif +0 -0
  247. data/public/javascripts/tiny_mce/themes/simple/langs/en.js +11 -0
  248. data/public/javascripts/tiny_mce/themes/simple/skins/default/content.css +25 -0
  249. data/public/javascripts/tiny_mce/themes/simple/skins/default/ui.css +32 -0
  250. data/public/javascripts/tiny_mce/themes/simple/skins/o2k7/content.css +17 -0
  251. data/public/javascripts/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
  252. data/public/javascripts/tiny_mce/themes/simple/skins/o2k7/ui.css +35 -0
  253. data/public/javascripts/tiny_mce/tiny_mce.js +1 -0
  254. data/public/javascripts/tiny_mce/tiny_mce_popup.js +5 -0
  255. data/public/javascripts/tiny_mce/tiny_mce_src.js +13771 -0
  256. data/public/javascripts/tiny_mce/utils/editable_selects.js +70 -0
  257. data/public/javascripts/tiny_mce/utils/form_utils.js +200 -0
  258. data/public/javascripts/tiny_mce/utils/mctabs.js +77 -0
  259. data/public/javascripts/tiny_mce/utils/validate.js +220 -0
  260. metadata +322 -0
@@ -0,0 +1,6 @@
1
+ .panel_wrapper {height:85px;}
2
+ .panel_wrapper div.current {height:85px;}
3
+
4
+ /* IE */
5
+ * html .panel_wrapper {height:100px;}
6
+ * html .panel_wrapper div.current {height:100px;}
@@ -0,0 +1 @@
1
+ (function(){tinymce.create("tinymce.plugins.SearchReplacePlugin",{init:function(a,c){function b(d){a.windowManager.open({file:c+"/searchreplace.htm",width:420+parseInt(a.getLang("searchreplace.delta_width",0)),height:160+parseInt(a.getLang("searchreplace.delta_height",0)),inline:1,auto_focus:0},{mode:d,search_string:a.selection.getContent({format:"text"}),plugin_url:c})}a.addCommand("mceSearch",function(){b("search")});a.addCommand("mceReplace",function(){b("replace")});a.addButton("search",{title:"searchreplace.search_desc",cmd:"mceSearch"});a.addButton("replace",{title:"searchreplace.replace_desc",cmd:"mceReplace"});a.addShortcut("ctrl+f","searchreplace.search_desc","mceSearch")},getInfo:function(){return{longname:"Search/Replace",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("searchreplace",tinymce.plugins.SearchReplacePlugin)})();
@@ -0,0 +1,57 @@
1
+ /**
2
+ * editor_plugin_src.js
3
+ *
4
+ * Copyright 2009, Moxiecode Systems AB
5
+ * Released under LGPL License.
6
+ *
7
+ * License: http://tinymce.moxiecode.com/license
8
+ * Contributing: http://tinymce.moxiecode.com/contributing
9
+ */
10
+
11
+ (function() {
12
+ tinymce.create('tinymce.plugins.SearchReplacePlugin', {
13
+ init : function(ed, url) {
14
+ function open(m) {
15
+ ed.windowManager.open({
16
+ file : url + '/searchreplace.htm',
17
+ width : 420 + parseInt(ed.getLang('searchreplace.delta_width', 0)),
18
+ height : 160 + parseInt(ed.getLang('searchreplace.delta_height', 0)),
19
+ inline : 1,
20
+ auto_focus : 0
21
+ }, {
22
+ mode : m,
23
+ search_string : ed.selection.getContent({format : 'text'}),
24
+ plugin_url : url
25
+ });
26
+ };
27
+
28
+ // Register commands
29
+ ed.addCommand('mceSearch', function() {
30
+ open('search');
31
+ });
32
+
33
+ ed.addCommand('mceReplace', function() {
34
+ open('replace');
35
+ });
36
+
37
+ // Register buttons
38
+ ed.addButton('search', {title : 'searchreplace.search_desc', cmd : 'mceSearch'});
39
+ ed.addButton('replace', {title : 'searchreplace.replace_desc', cmd : 'mceReplace'});
40
+
41
+ ed.addShortcut('ctrl+f', 'searchreplace.search_desc', 'mceSearch');
42
+ },
43
+
44
+ getInfo : function() {
45
+ return {
46
+ longname : 'Search/Replace',
47
+ author : 'Moxiecode Systems AB',
48
+ authorurl : 'http://tinymce.moxiecode.com',
49
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/searchreplace',
50
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
51
+ };
52
+ }
53
+ });
54
+
55
+ // Register plugin
56
+ tinymce.PluginManager.add('searchreplace', tinymce.plugins.SearchReplacePlugin);
57
+ })();
@@ -0,0 +1,126 @@
1
+ tinyMCEPopup.requireLangPack();
2
+
3
+ var SearchReplaceDialog = {
4
+ init : function(ed) {
5
+ var f = document.forms[0], m = tinyMCEPopup.getWindowArg("mode");
6
+
7
+ this.switchMode(m);
8
+
9
+ f[m + '_panel_searchstring'].value = tinyMCEPopup.getWindowArg("search_string");
10
+
11
+ // Focus input field
12
+ f[m + '_panel_searchstring'].focus();
13
+ },
14
+
15
+ switchMode : function(m) {
16
+ var f, lm = this.lastMode;
17
+
18
+ if (lm != m) {
19
+ f = document.forms[0];
20
+
21
+ if (lm) {
22
+ f[m + '_panel_searchstring'].value = f[lm + '_panel_searchstring'].value;
23
+ f[m + '_panel_backwardsu'].checked = f[lm + '_panel_backwardsu'].checked;
24
+ f[m + '_panel_backwardsd'].checked = f[lm + '_panel_backwardsd'].checked;
25
+ f[m + '_panel_casesensitivebox'].checked = f[lm + '_panel_casesensitivebox'].checked;
26
+ }
27
+
28
+ mcTabs.displayTab(m + '_tab', m + '_panel');
29
+ document.getElementById("replaceBtn").style.display = (m == "replace") ? "inline" : "none";
30
+ document.getElementById("replaceAllBtn").style.display = (m == "replace") ? "inline" : "none";
31
+ this.lastMode = m;
32
+ }
33
+ },
34
+
35
+ searchNext : function(a) {
36
+ var ed = tinyMCEPopup.editor, se = ed.selection, r = se.getRng(), f, m = this.lastMode, s, b, fl = 0, w = ed.getWin(), wm = ed.windowManager, fo = 0;
37
+
38
+ // Get input
39
+ f = document.forms[0];
40
+ s = f[m + '_panel_searchstring'].value;
41
+ b = f[m + '_panel_backwardsu'].checked;
42
+ ca = f[m + '_panel_casesensitivebox'].checked;
43
+ rs = f['replace_panel_replacestring'].value;
44
+
45
+ if (s == '')
46
+ return;
47
+
48
+ function fix() {
49
+ // Correct Firefox graphics glitches
50
+ r = se.getRng().cloneRange();
51
+ ed.getDoc().execCommand('SelectAll', false, null);
52
+ se.setRng(r);
53
+ };
54
+
55
+ function replace() {
56
+ if (tinymce.isIE)
57
+ ed.selection.getRng().duplicate().pasteHTML(rs); // Needs to be duplicated due to selection bug in IE
58
+ else
59
+ ed.getDoc().execCommand('InsertHTML', false, rs);
60
+ };
61
+
62
+ // IE flags
63
+ if (ca)
64
+ fl = fl | 4;
65
+
66
+ switch (a) {
67
+ case 'all':
68
+ // Move caret to beginning of text
69
+ ed.execCommand('SelectAll');
70
+ ed.selection.collapse(true);
71
+
72
+ if (tinymce.isIE) {
73
+ while (r.findText(s, b ? -1 : 1, fl)) {
74
+ r.scrollIntoView();
75
+ r.select();
76
+ replace();
77
+ fo = 1;
78
+ }
79
+
80
+ tinyMCEPopup.storeSelection();
81
+ } else {
82
+ while (w.find(s, ca, b, false, false, false, false)) {
83
+ replace();
84
+ fo = 1;
85
+ }
86
+ }
87
+
88
+ if (fo)
89
+ tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.allreplaced'));
90
+ else
91
+ tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));
92
+
93
+ return;
94
+
95
+ case 'current':
96
+ if (!ed.selection.isCollapsed())
97
+ replace();
98
+
99
+ break;
100
+ }
101
+
102
+ se.collapse(b);
103
+ r = se.getRng();
104
+
105
+ // Whats the point
106
+ if (!s)
107
+ return;
108
+
109
+ if (tinymce.isIE) {
110
+ if (r.findText(s, b ? -1 : 1, fl)) {
111
+ r.scrollIntoView();
112
+ r.select();
113
+ } else
114
+ tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));
115
+
116
+ tinyMCEPopup.storeSelection();
117
+ } else {
118
+ if (!w.find(s, ca, b, false, false, false, false))
119
+ tinyMCEPopup.alert(ed.getLang('searchreplace_dlg.notfound'));
120
+ else
121
+ fix();
122
+ }
123
+ }
124
+ };
125
+
126
+ tinyMCEPopup.onInit.add(SearchReplaceDialog.init, SearchReplaceDialog);
@@ -0,0 +1,16 @@
1
+ tinyMCE.addI18n('en.searchreplace_dlg',{
2
+ searchnext_desc:"Find again",
3
+ notfound:"The search has been completed. The search string could not be found.",
4
+ search_title:"Find",
5
+ replace_title:"Find/Replace",
6
+ allreplaced:"All occurrences of the search string were replaced.",
7
+ findwhat:"Find what",
8
+ replacewith:"Replace with",
9
+ direction:"Direction",
10
+ up:"Up",
11
+ down:"Down",
12
+ mcase:"Match case",
13
+ findnext:"Find next",
14
+ replace:"Replace",
15
+ replaceall:"Replace all"
16
+ });
@@ -0,0 +1,104 @@
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <title>{#searchreplace_dlg.replace_title}</title>
5
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
7
+ <script type="text/javascript" src="../../utils/form_utils.js"></script>
8
+ <script type="text/javascript" src="js/searchreplace.js"></script>
9
+ <link rel="stylesheet" type="text/css" href="css/searchreplace.css" />
10
+ </head>
11
+ <body style="display:none;">
12
+ <form onsubmit="SearchReplaceDialog.searchNext('none');return false;" action="#">
13
+ <div class="tabs">
14
+ <ul>
15
+ <li id="search_tab"><span><a href="javascript:SearchReplaceDialog.switchMode('search');" onmousedown="return false;">{#searchreplace.search_desc}</a></span></li>
16
+ <li id="replace_tab"><span><a href="javascript:SearchReplaceDialog.switchMode('replace');" onmousedown="return false;">{#searchreplace_dlg.replace}</a></span></li>
17
+ </ul>
18
+ </div>
19
+
20
+ <div class="panel_wrapper">
21
+ <div id="search_panel" class="panel">
22
+ <table border="0" cellspacing="0" cellpadding="2">
23
+ <tr>
24
+ <td><label for="search_panel_searchstring">{#searchreplace_dlg.findwhat}</label></td>
25
+ <td><input type="text" id="search_panel_searchstring" name="search_panel_searchstring" style="width: 200px" /></td>
26
+ </tr>
27
+ <tr>
28
+ <td colspan="2">
29
+ <table border="0" cellspacing="0" cellpadding="0" class="direction">
30
+ <tr>
31
+ <td><label>{#searchreplace_dlg.direction}</label></td>
32
+ <td><input id="search_panel_backwardsu" name="search_panel_backwards" class="radio" type="radio" /></td>
33
+ <td><label for="search_panel_backwardsu">{#searchreplace_dlg.up}</label></td>
34
+ <td><input id="search_panel_backwardsd" name="search_panel_backwards" class="radio" type="radio" checked="checked" /></td>
35
+ <td><label for="search_panel_backwardsd">{#searchreplace_dlg.down}</label></td>
36
+ </tr>
37
+ </table>
38
+ </td>
39
+ </tr>
40
+ <tr>
41
+ <td colspan="2">
42
+ <table border="0" cellspacing="0" cellpadding="0">
43
+ <tr>
44
+ <td><input id="search_panel_casesensitivebox" name="search_panel_casesensitivebox" class="checkbox" type="checkbox" /></td>
45
+ <td><label for="search_panel_casesensitivebox">{#searchreplace_dlg.mcase}</label></td>
46
+ </tr>
47
+ </table>
48
+ </td>
49
+ </tr>
50
+ </table>
51
+ </div>
52
+
53
+ <div id="replace_panel" class="panel">
54
+ <table border="0" cellspacing="0" cellpadding="2">
55
+ <tr>
56
+ <td><label for="replace_panel_searchstring">{#searchreplace_dlg.findwhat}</label></td>
57
+ <td><input type="text" id="replace_panel_searchstring" name="replace_panel_searchstring" style="width: 200px" /></td>
58
+ </tr>
59
+ <tr>
60
+ <td><label for="replace_panel_replacestring">{#searchreplace_dlg.replacewith}</label></td>
61
+ <td><input type="text" id="replace_panel_replacestring" name="replace_panel_replacestring" style="width: 200px" /></td>
62
+ </tr>
63
+ <tr>
64
+ <td colspan="2">
65
+ <table border="0" cellspacing="0" cellpadding="0" class="direction">
66
+ <tr>
67
+ <td><label>{#searchreplace_dlg.direction}</label></td>
68
+ <td><input id="replace_panel_backwardsu" name="replace_panel_backwards" class="radio" type="radio" /></td>
69
+ <td><label for="replace_panel_backwardsu">{#searchreplace_dlg.up}</label></td>
70
+ <td><input id="replace_panel_backwardsd" name="replace_panel_backwards" class="radio" type="radio" checked="checked" /></td>
71
+ <td><label for="replace_panel_backwardsd">{#searchreplace_dlg.down}</label></td>
72
+ </tr>
73
+ </table>
74
+ </td>
75
+ </tr>
76
+ <tr>
77
+ <td colspan="2">
78
+ <table border="0" cellspacing="0" cellpadding="0">
79
+ <tr>
80
+ <td><input id="replace_panel_casesensitivebox" name="replace_panel_casesensitivebox" class="checkbox" type="checkbox" /></td>
81
+ <td><label for="replace_panel_casesensitivebox">{#searchreplace_dlg.mcase}</label></td>
82
+ </tr>
83
+ </table>
84
+ </td>
85
+ </tr>
86
+ </table>
87
+ </div>
88
+
89
+ </div>
90
+
91
+ <div class="mceActionPanel">
92
+ <div style="float: left">
93
+ <input type="submit" id="insert" name="insert" value="{#searchreplace_dlg.findnext}" />
94
+ <input type="button" class="button" id="replaceBtn" name="replaceBtn" value="{#searchreplace_dlg.replace}" onclick="SearchReplaceDialog.searchNext('current');" />
95
+ <input type="button" class="button" id="replaceAllBtn" name="replaceAllBtn" value="{#searchreplace_dlg.replaceall}" onclick="SearchReplaceDialog.searchNext('all');" />
96
+ </div>
97
+
98
+ <div style="float: right">
99
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
100
+ </div>
101
+ </div>
102
+ </form>
103
+ </body>
104
+ </html>
@@ -0,0 +1 @@
1
+ .mceItemHiddenSpellWord {background:url(../img/wline.gif) repeat-x bottom left; cursor:default;}
@@ -0,0 +1 @@
1
+ (function(){var a=tinymce.util.JSONRequest,c=tinymce.each,b=tinymce.DOM;tinymce.create("tinymce.plugins.SpellcheckerPlugin",{getInfo:function(){return{longname:"Spellchecker",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker",version:tinymce.majorVersion+"."+tinymce.minorVersion}},init:function(e,f){var g=this,d;g.url=f;g.editor=e;e.addCommand("mceSpellCheck",function(){if(!g.active){e.setProgressState(1);g._sendRPC("checkWords",[g.selectedLang,g._getWords()],function(h){if(h.length>0){g.active=1;g._markWords(h);e.setProgressState(0);e.nodeChanged()}else{e.setProgressState(0);e.windowManager.alert("spellchecker.no_mpell")}})}else{g._done()}});e.onInit.add(function(){if(e.settings.content_css!==false){e.dom.loadCSS(f+"/css/content.css")}});e.onClick.add(g._showMenu,g);e.onContextMenu.add(g._showMenu,g);e.onBeforeGetContent.add(function(){if(g.active){g._removeWords()}});e.onNodeChange.add(function(i,h){h.setActive("spellchecker",g.active)});e.onSetContent.add(function(){g._done()});e.onBeforeGetContent.add(function(){g._done()});e.onBeforeExecCommand.add(function(h,i){if(i=="mceFullScreen"){g._done()}});g.languages={};c(e.getParam("spellchecker_languages","+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv","hash"),function(i,h){if(h.indexOf("+")===0){h=h.substring(1);g.selectedLang=i}g.languages[h]=i})},createControl:function(h,d){var f=this,g,e=f.editor;if(h=="spellchecker"){g=d.createSplitButton(h,{title:"spellchecker.desc",cmd:"mceSpellCheck",scope:f});g.onRenderMenu.add(function(j,i){i.add({title:"spellchecker.langs","class":"mceMenuItemTitle"}).setDisabled(1);c(f.languages,function(n,m){var p={icon:1},l;p.onclick=function(){l.setSelected(1);f.selectedItem.setSelected(0);f.selectedItem=l;f.selectedLang=n};p.title=m;l=i.add(p);l.setSelected(n==f.selectedLang);if(n==f.selectedLang){f.selectedItem=l}})});return g}},_walk:function(i,g){var h=this.editor.getDoc(),e;if(h.createTreeWalker){e=h.createTreeWalker(i,NodeFilter.SHOW_TEXT,null,false);while((i=e.nextNode())!=null){g.call(this,i)}}else{tinymce.walk(i,g,"childNodes")}},_getSeparators:function(){var e="",d,f=this.editor.getParam("spellchecker_word_separator_chars",'\\s!"#$%&()*+,-./:;<=>?@[]^_{|}����������������\u201d\u201c');for(d=0;d<f.length;d++){e+="\\"+f.charAt(d)}return e},_getWords:function(){var e=this.editor,g=[],d="",f={};this._walk(e.getBody(),function(h){if(h.nodeType==3){d+=h.nodeValue+" "}});d=d.replace(new RegExp("([0-9]|["+this._getSeparators()+"])","g")," ");d=tinymce.trim(d.replace(/(\s+)/g," "));c(d.split(" "),function(h){if(!f[h]){g.push(h);f[h]=1}});return g},_removeWords:function(e){var f=this.editor,h=f.dom,g=f.selection,d=g.getBookmark();c(h.select("span").reverse(),function(i){if(i&&(h.hasClass(i,"mceItemHiddenSpellWord")||h.hasClass(i,"mceItemHidden"))){if(!e||h.decode(i.innerHTML)==e){h.remove(i,1)}}});g.moveToBookmark(d)},_markWords:function(o){var i,h,g,f,e,n="",k=this.editor,p=this._getSeparators(),j=k.dom,d=[];var l=k.selection,m=l.getBookmark();c(o,function(q){n+=(n?"|":"")+q});i=new RegExp("(["+p+"])("+n+")(["+p+"])","g");h=new RegExp("^("+n+")","g");g=new RegExp("("+n+")(["+p+"]?)$","g");f=new RegExp("^("+n+")(["+p+"]?)$","g");e=new RegExp("("+n+")(["+p+"])","g");this._walk(this.editor.getBody(),function(q){if(q.nodeType==3){d.push(q)}});c(d,function(r){var q;if(r.nodeType==3){q=r.nodeValue;if(i.test(q)||h.test(q)||g.test(q)||f.test(q)){q=j.encode(q);q=q.replace(e,'<span class="mceItemHiddenSpellWord">$1</span>$2');q=q.replace(g,'<span class="mceItemHiddenSpellWord">$1</span>$2');j.replace(j.create("span",{"class":"mceItemHidden"},q),r)}}});l.moveToBookmark(m)},_showMenu:function(g,i){var h=this,g=h.editor,d=h._menu,k,j=g.dom,f=j.getViewPort(g.getWin());if(!d){k=b.getPos(g.getContentAreaContainer());d=g.controlManager.createDropMenu("spellcheckermenu",{offset_x:k.x,offset_y:k.y,"class":"mceNoIcons"});h._menu=d}if(j.hasClass(i.target,"mceItemHiddenSpellWord")){d.removeAll();d.add({title:"spellchecker.wait","class":"mceMenuItemTitle"}).setDisabled(1);h._sendRPC("getSuggestions",[h.selectedLang,j.decode(i.target.innerHTML)],function(e){d.removeAll();if(e.length>0){d.add({title:"spellchecker.sug","class":"mceMenuItemTitle"}).setDisabled(1);c(e,function(l){d.add({title:l,onclick:function(){j.replace(g.getDoc().createTextNode(l),i.target);h._checkDone()}})});d.addSeparator()}else{d.add({title:"spellchecker.no_sug","class":"mceMenuItemTitle"}).setDisabled(1)}d.add({title:"spellchecker.ignore_word",onclick:function(){j.remove(i.target,1);h._checkDone()}});d.add({title:"spellchecker.ignore_words",onclick:function(){h._removeWords(j.decode(i.target.innerHTML));h._checkDone()}});d.update()});g.selection.select(i.target);k=j.getPos(i.target);d.showMenu(k.x,k.y+i.target.offsetHeight-f.y);return tinymce.dom.Event.cancel(i)}else{d.hideMenu()}},_checkDone:function(){var e=this,d=e.editor,g=d.dom,f;c(g.select("span"),function(h){if(h&&g.hasClass(h,"mceItemHiddenSpellWord")){f=true;return false}});if(!f){e._done()}},_done:function(){var d=this,e=d.active;if(d.active){d.active=0;d._removeWords();if(d._menu){d._menu.hideMenu()}if(e){d.editor.nodeChanged()}}},_sendRPC:function(e,h,d){var g=this,f=g.editor.getParam("spellchecker_rpc_url","{backend}");if(f=="{backend}"){g.editor.setProgressState(0);alert("Please specify: spellchecker_rpc_url");return}a.sendRPC({url:f,method:e,params:h,success:d,error:function(j,i){g.editor.setProgressState(0);g.editor.windowManager.alert(j.errstr||("Error response: "+i.responseText))}})}});tinymce.PluginManager.add("spellchecker",tinymce.plugins.SpellcheckerPlugin)})();
@@ -0,0 +1,341 @@
1
+ /**
2
+ * editor_plugin_src.js
3
+ *
4
+ * Copyright 2009, Moxiecode Systems AB
5
+ * Released under LGPL License.
6
+ *
7
+ * License: http://tinymce.moxiecode.com/license
8
+ * Contributing: http://tinymce.moxiecode.com/contributing
9
+ */
10
+
11
+ (function() {
12
+ var JSONRequest = tinymce.util.JSONRequest, each = tinymce.each, DOM = tinymce.DOM;
13
+
14
+ tinymce.create('tinymce.plugins.SpellcheckerPlugin', {
15
+ getInfo : function() {
16
+ return {
17
+ longname : 'Spellchecker',
18
+ author : 'Moxiecode Systems AB',
19
+ authorurl : 'http://tinymce.moxiecode.com',
20
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/spellchecker',
21
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
22
+ };
23
+ },
24
+
25
+ init : function(ed, url) {
26
+ var t = this, cm;
27
+
28
+ t.url = url;
29
+ t.editor = ed;
30
+
31
+ // Register commands
32
+ ed.addCommand('mceSpellCheck', function() {
33
+ if (!t.active) {
34
+ ed.setProgressState(1);
35
+ t._sendRPC('checkWords', [t.selectedLang, t._getWords()], function(r) {
36
+ if (r.length > 0) {
37
+ t.active = 1;
38
+ t._markWords(r);
39
+ ed.setProgressState(0);
40
+ ed.nodeChanged();
41
+ } else {
42
+ ed.setProgressState(0);
43
+ ed.windowManager.alert('spellchecker.no_mpell');
44
+ }
45
+ });
46
+ } else
47
+ t._done();
48
+ });
49
+
50
+ ed.onInit.add(function() {
51
+ if (ed.settings.content_css !== false)
52
+ ed.dom.loadCSS(url + '/css/content.css');
53
+ });
54
+
55
+ ed.onClick.add(t._showMenu, t);
56
+ ed.onContextMenu.add(t._showMenu, t);
57
+ ed.onBeforeGetContent.add(function() {
58
+ if (t.active)
59
+ t._removeWords();
60
+ });
61
+
62
+ ed.onNodeChange.add(function(ed, cm) {
63
+ cm.setActive('spellchecker', t.active);
64
+ });
65
+
66
+ ed.onSetContent.add(function() {
67
+ t._done();
68
+ });
69
+
70
+ ed.onBeforeGetContent.add(function() {
71
+ t._done();
72
+ });
73
+
74
+ ed.onBeforeExecCommand.add(function(ed, cmd) {
75
+ if (cmd == 'mceFullScreen')
76
+ t._done();
77
+ });
78
+
79
+ // Find selected language
80
+ t.languages = {};
81
+ each(ed.getParam('spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv', 'hash'), function(v, k) {
82
+ if (k.indexOf('+') === 0) {
83
+ k = k.substring(1);
84
+ t.selectedLang = v;
85
+ }
86
+
87
+ t.languages[k] = v;
88
+ });
89
+ },
90
+
91
+ createControl : function(n, cm) {
92
+ var t = this, c, ed = t.editor;
93
+
94
+ if (n == 'spellchecker') {
95
+ c = cm.createSplitButton(n, {title : 'spellchecker.desc', cmd : 'mceSpellCheck', scope : t});
96
+
97
+ c.onRenderMenu.add(function(c, m) {
98
+ m.add({title : 'spellchecker.langs', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
99
+ each(t.languages, function(v, k) {
100
+ var o = {icon : 1}, mi;
101
+
102
+ o.onclick = function() {
103
+ mi.setSelected(1);
104
+ t.selectedItem.setSelected(0);
105
+ t.selectedItem = mi;
106
+ t.selectedLang = v;
107
+ };
108
+
109
+ o.title = k;
110
+ mi = m.add(o);
111
+ mi.setSelected(v == t.selectedLang);
112
+
113
+ if (v == t.selectedLang)
114
+ t.selectedItem = mi;
115
+ })
116
+ });
117
+
118
+ return c;
119
+ }
120
+ },
121
+
122
+ // Internal functions
123
+
124
+ _walk : function(n, f) {
125
+ var d = this.editor.getDoc(), w;
126
+
127
+ if (d.createTreeWalker) {
128
+ w = d.createTreeWalker(n, NodeFilter.SHOW_TEXT, null, false);
129
+
130
+ while ((n = w.nextNode()) != null)
131
+ f.call(this, n);
132
+ } else
133
+ tinymce.walk(n, f, 'childNodes');
134
+ },
135
+
136
+ _getSeparators : function() {
137
+ var re = '', i, str = this.editor.getParam('spellchecker_word_separator_chars', '\\s!"#$%&()*+,-./:;<=>?@[\]^_{|}����������������\u201d\u201c');
138
+
139
+ // Build word separator regexp
140
+ for (i=0; i<str.length; i++)
141
+ re += '\\' + str.charAt(i);
142
+
143
+ return re;
144
+ },
145
+
146
+ _getWords : function() {
147
+ var ed = this.editor, wl = [], tx = '', lo = {};
148
+
149
+ // Get area text
150
+ this._walk(ed.getBody(), function(n) {
151
+ if (n.nodeType == 3)
152
+ tx += n.nodeValue + ' ';
153
+ });
154
+
155
+ // Split words by separator
156
+ tx = tx.replace(new RegExp('([0-9]|[' + this._getSeparators() + '])', 'g'), ' ');
157
+ tx = tinymce.trim(tx.replace(/(\s+)/g, ' '));
158
+
159
+ // Build word array and remove duplicates
160
+ each(tx.split(' '), function(v) {
161
+ if (!lo[v]) {
162
+ wl.push(v);
163
+ lo[v] = 1;
164
+ }
165
+ });
166
+
167
+ return wl;
168
+ },
169
+
170
+ _removeWords : function(w) {
171
+ var ed = this.editor, dom = ed.dom, se = ed.selection, b = se.getBookmark();
172
+
173
+ each(dom.select('span').reverse(), function(n) {
174
+ if (n && (dom.hasClass(n, 'mceItemHiddenSpellWord') || dom.hasClass(n, 'mceItemHidden'))) {
175
+ if (!w || dom.decode(n.innerHTML) == w)
176
+ dom.remove(n, 1);
177
+ }
178
+ });
179
+
180
+ se.moveToBookmark(b);
181
+ },
182
+
183
+ _markWords : function(wl) {
184
+ var r1, r2, r3, r4, r5, w = '', ed = this.editor, re = this._getSeparators(), dom = ed.dom, nl = [];
185
+ var se = ed.selection, b = se.getBookmark();
186
+
187
+ each(wl, function(v) {
188
+ w += (w ? '|' : '') + v;
189
+ });
190
+
191
+ r1 = new RegExp('([' + re + '])(' + w + ')([' + re + '])', 'g');
192
+ r2 = new RegExp('^(' + w + ')', 'g');
193
+ r3 = new RegExp('(' + w + ')([' + re + ']?)$', 'g');
194
+ r4 = new RegExp('^(' + w + ')([' + re + ']?)$', 'g');
195
+ r5 = new RegExp('(' + w + ')([' + re + '])', 'g');
196
+
197
+ // Collect all text nodes
198
+ this._walk(this.editor.getBody(), function(n) {
199
+ if (n.nodeType == 3) {
200
+ nl.push(n);
201
+ }
202
+ });
203
+
204
+ // Wrap incorrect words in spans
205
+ each(nl, function(n) {
206
+ var v;
207
+
208
+ if (n.nodeType == 3) {
209
+ v = n.nodeValue;
210
+
211
+ if (r1.test(v) || r2.test(v) || r3.test(v) || r4.test(v)) {
212
+ v = dom.encode(v);
213
+ v = v.replace(r5, '<span class="mceItemHiddenSpellWord">$1</span>$2');
214
+ v = v.replace(r3, '<span class="mceItemHiddenSpellWord">$1</span>$2');
215
+
216
+ dom.replace(dom.create('span', {'class' : 'mceItemHidden'}, v), n);
217
+ }
218
+ }
219
+ });
220
+
221
+ se.moveToBookmark(b);
222
+ },
223
+
224
+ _showMenu : function(ed, e) {
225
+ var t = this, ed = t.editor, m = t._menu, p1, dom = ed.dom, vp = dom.getViewPort(ed.getWin());
226
+
227
+ if (!m) {
228
+ p1 = DOM.getPos(ed.getContentAreaContainer());
229
+ //p2 = DOM.getPos(ed.getContainer());
230
+
231
+ m = ed.controlManager.createDropMenu('spellcheckermenu', {
232
+ offset_x : p1.x,
233
+ offset_y : p1.y,
234
+ 'class' : 'mceNoIcons'
235
+ });
236
+
237
+ t._menu = m;
238
+ }
239
+
240
+ if (dom.hasClass(e.target, 'mceItemHiddenSpellWord')) {
241
+ m.removeAll();
242
+ m.add({title : 'spellchecker.wait', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
243
+
244
+ t._sendRPC('getSuggestions', [t.selectedLang, dom.decode(e.target.innerHTML)], function(r) {
245
+ m.removeAll();
246
+
247
+ if (r.length > 0) {
248
+ m.add({title : 'spellchecker.sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
249
+ each(r, function(v) {
250
+ m.add({title : v, onclick : function() {
251
+ dom.replace(ed.getDoc().createTextNode(v), e.target);
252
+ t._checkDone();
253
+ }});
254
+ });
255
+
256
+ m.addSeparator();
257
+ } else
258
+ m.add({title : 'spellchecker.no_sug', 'class' : 'mceMenuItemTitle'}).setDisabled(1);
259
+
260
+ m.add({
261
+ title : 'spellchecker.ignore_word',
262
+ onclick : function() {
263
+ dom.remove(e.target, 1);
264
+ t._checkDone();
265
+ }
266
+ });
267
+
268
+ m.add({
269
+ title : 'spellchecker.ignore_words',
270
+ onclick : function() {
271
+ t._removeWords(dom.decode(e.target.innerHTML));
272
+ t._checkDone();
273
+ }
274
+ });
275
+
276
+ m.update();
277
+ });
278
+
279
+ ed.selection.select(e.target);
280
+ p1 = dom.getPos(e.target);
281
+ m.showMenu(p1.x, p1.y + e.target.offsetHeight - vp.y);
282
+
283
+ return tinymce.dom.Event.cancel(e);
284
+ } else
285
+ m.hideMenu();
286
+ },
287
+
288
+ _checkDone : function() {
289
+ var t = this, ed = t.editor, dom = ed.dom, o;
290
+
291
+ each(dom.select('span'), function(n) {
292
+ if (n && dom.hasClass(n, 'mceItemHiddenSpellWord')) {
293
+ o = true;
294
+ return false;
295
+ }
296
+ });
297
+
298
+ if (!o)
299
+ t._done();
300
+ },
301
+
302
+ _done : function() {
303
+ var t = this, la = t.active;
304
+
305
+ if (t.active) {
306
+ t.active = 0;
307
+ t._removeWords();
308
+
309
+ if (t._menu)
310
+ t._menu.hideMenu();
311
+
312
+ if (la)
313
+ t.editor.nodeChanged();
314
+ }
315
+ },
316
+
317
+ _sendRPC : function(m, p, cb) {
318
+ var t = this, url = t.editor.getParam("spellchecker_rpc_url", "{backend}");
319
+
320
+ if (url == '{backend}') {
321
+ t.editor.setProgressState(0);
322
+ alert('Please specify: spellchecker_rpc_url');
323
+ return;
324
+ }
325
+
326
+ JSONRequest.sendRPC({
327
+ url : url,
328
+ method : m,
329
+ params : p,
330
+ success : cb,
331
+ error : function(e, x) {
332
+ t.editor.setProgressState(0);
333
+ t.editor.windowManager.alert(e.errstr || ('Error response: ' + x.responseText));
334
+ }
335
+ });
336
+ }
337
+ });
338
+
339
+ // Register plugin
340
+ tinymce.PluginManager.add('spellchecker', tinymce.plugins.SpellcheckerPlugin);
341
+ })();