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,85 @@
1
+ tinyMCE.addI18n('en.fullpage_dlg',{
2
+ title:"Document properties",
3
+ meta_tab:"General",
4
+ appearance_tab:"Appearance",
5
+ advanced_tab:"Advanced",
6
+ meta_props:"Meta information",
7
+ langprops:"Language and encoding",
8
+ meta_title:"Title",
9
+ meta_keywords:"Keywords",
10
+ meta_description:"Description",
11
+ meta_robots:"Robots",
12
+ doctypes:"Doctype",
13
+ langcode:"Language code",
14
+ langdir:"Language direction",
15
+ ltr:"Left to right",
16
+ rtl:"Right to left",
17
+ xml_pi:"XML declaration",
18
+ encoding:"Character encoding",
19
+ appearance_bgprops:"Background properties",
20
+ appearance_marginprops:"Body margins",
21
+ appearance_linkprops:"Link colors",
22
+ appearance_textprops:"Text properties",
23
+ bgcolor:"Background color",
24
+ bgimage:"Background image",
25
+ left_margin:"Left margin",
26
+ right_margin:"Right margin",
27
+ top_margin:"Top margin",
28
+ bottom_margin:"Bottom margin",
29
+ text_color:"Text color",
30
+ font_size:"Font size",
31
+ font_face:"Font face",
32
+ link_color:"Link color",
33
+ hover_color:"Hover color",
34
+ visited_color:"Visited color",
35
+ active_color:"Active color",
36
+ textcolor:"Color",
37
+ fontsize:"Font size",
38
+ fontface:"Font family",
39
+ meta_index_follow:"Index and follow the links",
40
+ meta_index_nofollow:"Index and don't follow the links",
41
+ meta_noindex_follow:"Do not index but follow the links",
42
+ meta_noindex_nofollow:"Do not index and don\'t follow the links",
43
+ appearance_style:"Stylesheet and style properties",
44
+ stylesheet:"Stylesheet",
45
+ style:"Style",
46
+ author:"Author",
47
+ copyright:"Copyright",
48
+ add:"Add new element",
49
+ remove:"Remove selected element",
50
+ moveup:"Move selected element up",
51
+ movedown:"Move selected element down",
52
+ head_elements:"Head elements",
53
+ info:"Information",
54
+ add_title:"Title element",
55
+ add_meta:"Meta element",
56
+ add_script:"Script element",
57
+ add_style:"Style element",
58
+ add_link:"Link element",
59
+ add_base:"Base element",
60
+ add_comment:"Comment node",
61
+ title_element:"Title element",
62
+ script_element:"Script element",
63
+ style_element:"Style element",
64
+ base_element:"Base element",
65
+ link_element:"Link element",
66
+ meta_element:"Meta element",
67
+ comment_element:"Comment",
68
+ src:"Src",
69
+ language:"Language",
70
+ href:"Href",
71
+ target:"Target",
72
+ type:"Type",
73
+ charset:"Charset",
74
+ defer:"Defer",
75
+ media:"Media",
76
+ properties:"Properties",
77
+ name:"Name",
78
+ value:"Value",
79
+ content:"Content",
80
+ rel:"Rel",
81
+ rev:"Rev",
82
+ hreflang:"Href lang",
83
+ general_props:"General",
84
+ advanced_props:"Advanced"
85
+ });
@@ -0,0 +1 @@
1
+ (function(){var a=tinymce.DOM;tinymce.create("tinymce.plugins.FullScreenPlugin",{init:function(c,d){var e=this,f={},b;e.editor=c;c.addCommand("mceFullScreen",function(){var h,i=a.doc.documentElement;if(c.getParam("fullscreen_is_enabled")){if(c.getParam("fullscreen_new_window")){closeFullscreen()}else{a.win.setTimeout(function(){tinymce.dom.Event.remove(a.win,"resize",e.resizeFunc);tinyMCE.get(c.getParam("fullscreen_editor_id")).setContent(c.getContent({format:"raw"}),{format:"raw"});tinyMCE.remove(c);a.remove("mce_fullscreen_container");i.style.overflow=c.getParam("fullscreen_html_overflow");a.setStyle(a.doc.body,"overflow",c.getParam("fullscreen_overflow"));a.win.scrollTo(c.getParam("fullscreen_scrollx"),c.getParam("fullscreen_scrolly"));tinyMCE.settings=tinyMCE.oldSettings},10)}return}if(c.getParam("fullscreen_new_window")){h=a.win.open(d+"/fullscreen.htm","mceFullScreenPopup","fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width="+screen.availWidth+",height="+screen.availHeight);try{h.resizeTo(screen.availWidth,screen.availHeight)}catch(g){}}else{tinyMCE.oldSettings=tinyMCE.settings;f.fullscreen_overflow=a.getStyle(a.doc.body,"overflow",1)||"auto";f.fullscreen_html_overflow=a.getStyle(i,"overflow",1);b=a.getViewPort();f.fullscreen_scrollx=b.x;f.fullscreen_scrolly=b.y;if(tinymce.isOpera&&f.fullscreen_overflow=="visible"){f.fullscreen_overflow="auto"}if(tinymce.isIE&&f.fullscreen_overflow=="scroll"){f.fullscreen_overflow="auto"}if(tinymce.isIE&&(f.fullscreen_html_overflow=="visible"||f.fullscreen_html_overflow=="scroll")){f.fullscreen_html_overflow="auto"}if(f.fullscreen_overflow=="0px"){f.fullscreen_overflow=""}a.setStyle(a.doc.body,"overflow","hidden");i.style.overflow="hidden";b=a.getViewPort();a.win.scrollTo(0,0);if(tinymce.isIE){b.h-=1}n=a.add(a.doc.body,"div",{id:"mce_fullscreen_container",style:"position:"+(tinymce.isIE6||(tinymce.isIE&&!a.boxModel)?"absolute":"fixed")+";top:0;left:0;width:"+b.w+"px;height:"+b.h+"px;z-index:200000;"});a.add(n,"div",{id:"mce_fullscreen"});tinymce.each(c.settings,function(j,k){f[k]=j});f.id="mce_fullscreen";f.width=n.clientWidth;f.height=n.clientHeight-15;f.fullscreen_is_enabled=true;f.fullscreen_editor_id=c.id;f.theme_advanced_resizing=false;f.save_onsavecallback=function(){c.setContent(tinyMCE.get(f.id).getContent({format:"raw"}),{format:"raw"});c.execCommand("mceSave")};tinymce.each(c.getParam("fullscreen_settings"),function(l,j){f[j]=l});if(f.theme_advanced_toolbar_location==="external"){f.theme_advanced_toolbar_location="top"}e.fullscreenEditor=new tinymce.Editor("mce_fullscreen",f);e.fullscreenEditor.onInit.add(function(){e.fullscreenEditor.setContent(c.getContent());e.fullscreenEditor.focus()});e.fullscreenEditor.render();tinyMCE.add(e.fullscreenEditor);e.fullscreenElement=new tinymce.dom.Element("mce_fullscreen_container");e.fullscreenElement.update();e.resizeFunc=tinymce.dom.Event.add(a.win,"resize",function(){var j=tinymce.DOM.getViewPort();e.fullscreenEditor.theme.resizeTo(j.w,j.h)})}});c.addButton("fullscreen",{title:"fullscreen.desc",cmd:"mceFullScreen"});c.onNodeChange.add(function(h,g){g.setActive("fullscreen",h.getParam("fullscreen_is_enabled"))})},getInfo:function(){return{longname:"Fullscreen",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("fullscreen",tinymce.plugins.FullScreenPlugin)})();
@@ -0,0 +1,148 @@
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 DOM = tinymce.DOM;
13
+
14
+ tinymce.create('tinymce.plugins.FullScreenPlugin', {
15
+ init : function(ed, url) {
16
+ var t = this, s = {}, vp;
17
+
18
+ t.editor = ed;
19
+
20
+ // Register commands
21
+ ed.addCommand('mceFullScreen', function() {
22
+ var win, de = DOM.doc.documentElement;
23
+
24
+ if (ed.getParam('fullscreen_is_enabled')) {
25
+ if (ed.getParam('fullscreen_new_window'))
26
+ closeFullscreen(); // Call to close in new window
27
+ else {
28
+ DOM.win.setTimeout(function() {
29
+ tinymce.dom.Event.remove(DOM.win, 'resize', t.resizeFunc);
30
+ tinyMCE.get(ed.getParam('fullscreen_editor_id')).setContent(ed.getContent({format : 'raw'}), {format : 'raw'});
31
+ tinyMCE.remove(ed);
32
+ DOM.remove('mce_fullscreen_container');
33
+ de.style.overflow = ed.getParam('fullscreen_html_overflow');
34
+ DOM.setStyle(DOM.doc.body, 'overflow', ed.getParam('fullscreen_overflow'));
35
+ DOM.win.scrollTo(ed.getParam('fullscreen_scrollx'), ed.getParam('fullscreen_scrolly'));
36
+ tinyMCE.settings = tinyMCE.oldSettings; // Restore old settings
37
+ }, 10);
38
+ }
39
+
40
+ return;
41
+ }
42
+
43
+ if (ed.getParam('fullscreen_new_window')) {
44
+ win = DOM.win.open(url + "/fullscreen.htm", "mceFullScreenPopup", "fullscreen=yes,menubar=no,toolbar=no,scrollbars=no,resizable=yes,left=0,top=0,width=" + screen.availWidth + ",height=" + screen.availHeight);
45
+ try {
46
+ win.resizeTo(screen.availWidth, screen.availHeight);
47
+ } catch (e) {
48
+ // Ignore
49
+ }
50
+ } else {
51
+ tinyMCE.oldSettings = tinyMCE.settings; // Store old settings
52
+ s.fullscreen_overflow = DOM.getStyle(DOM.doc.body, 'overflow', 1) || 'auto';
53
+ s.fullscreen_html_overflow = DOM.getStyle(de, 'overflow', 1);
54
+ vp = DOM.getViewPort();
55
+ s.fullscreen_scrollx = vp.x;
56
+ s.fullscreen_scrolly = vp.y;
57
+
58
+ // Fixes an Opera bug where the scrollbars doesn't reappear
59
+ if (tinymce.isOpera && s.fullscreen_overflow == 'visible')
60
+ s.fullscreen_overflow = 'auto';
61
+
62
+ // Fixes an IE bug where horizontal scrollbars would appear
63
+ if (tinymce.isIE && s.fullscreen_overflow == 'scroll')
64
+ s.fullscreen_overflow = 'auto';
65
+
66
+ // Fixes an IE bug where the scrollbars doesn't reappear
67
+ if (tinymce.isIE && (s.fullscreen_html_overflow == 'visible' || s.fullscreen_html_overflow == 'scroll'))
68
+ s.fullscreen_html_overflow = 'auto';
69
+
70
+ if (s.fullscreen_overflow == '0px')
71
+ s.fullscreen_overflow = '';
72
+
73
+ DOM.setStyle(DOM.doc.body, 'overflow', 'hidden');
74
+ de.style.overflow = 'hidden'; //Fix for IE6/7
75
+ vp = DOM.getViewPort();
76
+ DOM.win.scrollTo(0, 0);
77
+
78
+ if (tinymce.isIE)
79
+ vp.h -= 1;
80
+
81
+ n = DOM.add(DOM.doc.body, 'div', {id : 'mce_fullscreen_container', style : 'position:' + (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel) ? 'absolute' : 'fixed') + ';top:0;left:0;width:' + vp.w + 'px;height:' + vp.h + 'px;z-index:200000;'});
82
+ DOM.add(n, 'div', {id : 'mce_fullscreen'});
83
+
84
+ tinymce.each(ed.settings, function(v, n) {
85
+ s[n] = v;
86
+ });
87
+
88
+ s.id = 'mce_fullscreen';
89
+ s.width = n.clientWidth;
90
+ s.height = n.clientHeight - 15;
91
+ s.fullscreen_is_enabled = true;
92
+ s.fullscreen_editor_id = ed.id;
93
+ s.theme_advanced_resizing = false;
94
+ s.save_onsavecallback = function() {
95
+ ed.setContent(tinyMCE.get(s.id).getContent({format : 'raw'}), {format : 'raw'});
96
+ ed.execCommand('mceSave');
97
+ };
98
+
99
+ tinymce.each(ed.getParam('fullscreen_settings'), function(v, k) {
100
+ s[k] = v;
101
+ });
102
+
103
+ if (s.theme_advanced_toolbar_location === 'external')
104
+ s.theme_advanced_toolbar_location = 'top';
105
+
106
+ t.fullscreenEditor = new tinymce.Editor('mce_fullscreen', s);
107
+ t.fullscreenEditor.onInit.add(function() {
108
+ t.fullscreenEditor.setContent(ed.getContent());
109
+ t.fullscreenEditor.focus();
110
+ });
111
+
112
+ t.fullscreenEditor.render();
113
+ tinyMCE.add(t.fullscreenEditor);
114
+
115
+ t.fullscreenElement = new tinymce.dom.Element('mce_fullscreen_container');
116
+ t.fullscreenElement.update();
117
+ //document.body.overflow = 'hidden';
118
+
119
+ t.resizeFunc = tinymce.dom.Event.add(DOM.win, 'resize', function() {
120
+ var vp = tinymce.DOM.getViewPort();
121
+
122
+ t.fullscreenEditor.theme.resizeTo(vp.w, vp.h);
123
+ });
124
+ }
125
+ });
126
+
127
+ // Register buttons
128
+ ed.addButton('fullscreen', {title : 'fullscreen.desc', cmd : 'mceFullScreen'});
129
+
130
+ ed.onNodeChange.add(function(ed, cm) {
131
+ cm.setActive('fullscreen', ed.getParam('fullscreen_is_enabled'));
132
+ });
133
+ },
134
+
135
+ getInfo : function() {
136
+ return {
137
+ longname : 'Fullscreen',
138
+ author : 'Moxiecode Systems AB',
139
+ authorurl : 'http://tinymce.moxiecode.com',
140
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/fullscreen',
141
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
142
+ };
143
+ }
144
+ });
145
+
146
+ // Register plugin
147
+ tinymce.PluginManager.add('fullscreen', tinymce.plugins.FullScreenPlugin);
148
+ })();
@@ -0,0 +1,110 @@
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></title>
5
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
6
+ <script type="text/javascript" src="../../tiny_mce.js"></script>
7
+ <script type="text/javascript">
8
+ function patchCallback(settings, key) {
9
+ if (settings[key])
10
+ settings[key] = "window.opener." + settings[key];
11
+ }
12
+
13
+ var settings = {}, paSe = window.opener.tinyMCE.activeEditor.settings, oeID = window.opener.tinyMCE.activeEditor.id;
14
+
15
+ // Clone array
16
+ for (var n in paSe)
17
+ settings[n] = paSe[n];
18
+
19
+ // Override options for fullscreen
20
+ for (var n in paSe.fullscreen_settings)
21
+ settings[n] = paSe.fullscreen_settings[n];
22
+
23
+ // Patch callbacks, make them point to window.opener
24
+ patchCallback(settings, 'urlconverter_callback');
25
+ patchCallback(settings, 'insertlink_callback');
26
+ patchCallback(settings, 'insertimage_callback');
27
+ patchCallback(settings, 'setupcontent_callback');
28
+ patchCallback(settings, 'save_callback');
29
+ patchCallback(settings, 'onchange_callback');
30
+ patchCallback(settings, 'init_instance_callback');
31
+ patchCallback(settings, 'file_browser_callback');
32
+ patchCallback(settings, 'cleanup_callback');
33
+ patchCallback(settings, 'execcommand_callback');
34
+ patchCallback(settings, 'oninit');
35
+
36
+ // Set options
37
+ delete settings.id;
38
+ settings['mode'] = 'exact';
39
+ settings['elements'] = 'fullscreenarea';
40
+ settings['add_unload_trigger'] = false;
41
+ settings['ask'] = false;
42
+ settings['document_base_url'] = window.opener.tinyMCE.activeEditor.documentBaseURI.getURI();
43
+ settings['fullscreen_is_enabled'] = true;
44
+ settings['fullscreen_editor_id'] = oeID;
45
+ settings['theme_advanced_resizing'] = false;
46
+ settings['strict_loading_mode'] = true;
47
+
48
+ settings.save_onsavecallback = function() {
49
+ window.opener.tinyMCE.get(oeID).setContent(tinyMCE.get('fullscreenarea').getContent({format : 'raw'}), {format : 'raw'});
50
+ window.opener.tinyMCE.get(oeID).execCommand('mceSave');
51
+ window.close();
52
+ };
53
+
54
+ function unloadHandler(e) {
55
+ moveContent();
56
+ }
57
+
58
+ function moveContent() {
59
+ window.opener.tinyMCE.get(oeID).setContent(tinyMCE.activeEditor.getContent());
60
+ }
61
+
62
+ function closeFullscreen() {
63
+ moveContent();
64
+ window.close();
65
+ }
66
+
67
+ function doParentSubmit() {
68
+ moveContent();
69
+
70
+ if (window.opener.tinyMCE.selectedInstance.formElement.form)
71
+ window.opener.tinyMCE.selectedInstance.formElement.form.submit();
72
+
73
+ window.close();
74
+
75
+ return false;
76
+ }
77
+
78
+ function render() {
79
+ var e = document.getElementById('fullscreenarea'), vp, ed, ow, oh, dom = tinymce.DOM;
80
+
81
+ e.value = window.opener.tinyMCE.get(oeID).getContent();
82
+
83
+ vp = dom.getViewPort();
84
+ settings.width = vp.w;
85
+ settings.height = vp.h - 15;
86
+
87
+ tinymce.dom.Event.add(window, 'resize', function() {
88
+ var vp = dom.getViewPort();
89
+
90
+ tinyMCE.activeEditor.theme.resizeTo(vp.w, vp.h);
91
+ });
92
+
93
+ tinyMCE.init(settings);
94
+ }
95
+
96
+ // Add onunload
97
+ tinymce.dom.Event.add(window, "beforeunload", unloadHandler);
98
+ </script>
99
+ </head>
100
+ <body style="margin:0;overflow:hidden;width:100%;height:100%" scrolling="no" scroll="no">
101
+ <form onsubmit="doParentSubmit();">
102
+ <textarea id="fullscreenarea" style="width:100%; height:100%"></textarea>
103
+ </form>
104
+
105
+ <script type="text/javascript">
106
+ render();
107
+ </script>
108
+
109
+ </body>
110
+ </html>
@@ -0,0 +1 @@
1
+ (function(){tinymce.create("tinymce.plugins.IESpell",{init:function(a,b){var c=this,d;if(!tinymce.isIE){return}c.editor=a;a.addCommand("mceIESpell",function(){try{d=new ActiveXObject("ieSpell.ieSpellExtension");d.CheckDocumentNode(a.getDoc().documentElement)}catch(f){if(f.number==-2146827859){a.windowManager.confirm(a.getLang("iespell.download"),function(e){if(e){window.open("http://www.iespell.com/download.php","ieSpellDownload","")}})}else{a.windowManager.alert("Error Loading ieSpell: Exception "+f.number)}}});a.addButton("iespell",{title:"iespell.iespell_desc",cmd:"mceIESpell"})},getInfo:function(){return{longname:"IESpell (IE Only)",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/iespell",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.PluginManager.add("iespell",tinymce.plugins.IESpell)})();
@@ -0,0 +1,54 @@
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.IESpell', {
13
+ init : function(ed, url) {
14
+ var t = this, sp;
15
+
16
+ if (!tinymce.isIE)
17
+ return;
18
+
19
+ t.editor = ed;
20
+
21
+ // Register commands
22
+ ed.addCommand('mceIESpell', function() {
23
+ try {
24
+ sp = new ActiveXObject("ieSpell.ieSpellExtension");
25
+ sp.CheckDocumentNode(ed.getDoc().documentElement);
26
+ } catch (e) {
27
+ if (e.number == -2146827859) {
28
+ ed.windowManager.confirm(ed.getLang("iespell.download"), function(s) {
29
+ if (s)
30
+ window.open('http://www.iespell.com/download.php', 'ieSpellDownload', '');
31
+ });
32
+ } else
33
+ ed.windowManager.alert("Error Loading ieSpell: Exception " + e.number);
34
+ }
35
+ });
36
+
37
+ // Register buttons
38
+ ed.addButton('iespell', {title : 'iespell.iespell_desc', cmd : 'mceIESpell'});
39
+ },
40
+
41
+ getInfo : function() {
42
+ return {
43
+ longname : 'IESpell (IE Only)',
44
+ author : 'Moxiecode Systems AB',
45
+ authorurl : 'http://tinymce.moxiecode.com',
46
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/iespell',
47
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
48
+ };
49
+ }
50
+ });
51
+
52
+ // Register plugin
53
+ tinymce.PluginManager.add('iespell', tinymce.plugins.IESpell);
54
+ })();
@@ -0,0 +1 @@
1
+ (function(){var d=tinymce.DOM,b=tinymce.dom.Element,a=tinymce.dom.Event,e=tinymce.each,c=tinymce.is;tinymce.create("tinymce.plugins.InlinePopups",{init:function(f,g){f.onBeforeRenderUI.add(function(){f.windowManager=new tinymce.InlineWindowManager(f);d.loadCSS(g+"/skins/"+(f.settings.inlinepopups_skin||"clearlooks2")+"/window.css")})},getInfo:function(){return{longname:"InlinePopups",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",infourl:"http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.create("tinymce.InlineWindowManager:tinymce.WindowManager",{InlineWindowManager:function(f){var g=this;g.parent(f);g.zIndex=300000;g.count=0;g.windows={}},open:function(r,j){var y=this,i,k="",q=y.editor,g=0,s=0,h,m,n,o,l,v,x;r=r||{};j=j||{};if(!r.inline){return y.parent(r,j)}if(!r.type){y.bookmark=q.selection.getBookmark(1)}i=d.uniqueId();h=d.getViewPort();r.width=parseInt(r.width||320);r.height=parseInt(r.height||240)+(tinymce.isIE?8:0);r.min_width=parseInt(r.min_width||150);r.min_height=parseInt(r.min_height||100);r.max_width=parseInt(r.max_width||2000);r.max_height=parseInt(r.max_height||2000);r.left=r.left||Math.round(Math.max(h.x,h.x+(h.w/2)-(r.width/2)));r.top=r.top||Math.round(Math.max(h.y,h.y+(h.h/2)-(r.height/2)));r.movable=r.resizable=true;j.mce_width=r.width;j.mce_height=r.height;j.mce_inline=true;j.mce_window_id=i;j.mce_auto_focus=r.auto_focus;y.features=r;y.params=j;y.onOpen.dispatch(y,r,j);if(r.type){k+=" mceModal";if(r.type){k+=" mce"+r.type.substring(0,1).toUpperCase()+r.type.substring(1)}r.resizable=false}if(r.statusbar){k+=" mceStatusbar"}if(r.resizable){k+=" mceResizable"}if(r.minimizable){k+=" mceMinimizable"}if(r.maximizable){k+=" mceMaximizable"}if(r.movable){k+=" mceMovable"}y._addAll(d.doc.body,["div",{id:i,"class":q.settings.inlinepopups_skin||"clearlooks2",style:"width:100px;height:100px"},["div",{id:i+"_wrapper","class":"mceWrapper"+k},["div",{id:i+"_top","class":"mceTop"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_title"},r.title||""]],["div",{id:i+"_middle","class":"mceMiddle"},["div",{id:i+"_left","class":"mceLeft"}],["span",{id:i+"_content"}],["div",{id:i+"_right","class":"mceRight"}]],["div",{id:i+"_bottom","class":"mceBottom"},["div",{"class":"mceLeft"}],["div",{"class":"mceCenter"}],["div",{"class":"mceRight"}],["span",{id:i+"_status"},"Content"]],["a",{"class":"mceMove",tabindex:"-1",href:"javascript:;"}],["a",{"class":"mceMin",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMax",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceMed",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{"class":"mceClose",tabindex:"-1",href:"javascript:;",onmousedown:"return false;"}],["a",{id:i+"_resize_n","class":"mceResize mceResizeN",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_s","class":"mceResize mceResizeS",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_w","class":"mceResize mceResizeW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_e","class":"mceResize mceResizeE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_nw","class":"mceResize mceResizeNW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_ne","class":"mceResize mceResizeNE",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_sw","class":"mceResize mceResizeSW",tabindex:"-1",href:"javascript:;"}],["a",{id:i+"_resize_se","class":"mceResize mceResizeSE",tabindex:"-1",href:"javascript:;"}]]]);d.setStyles(i,{top:-10000,left:-10000});if(tinymce.isGecko){d.setStyle(i,"overflow","auto")}if(!r.type){g+=d.get(i+"_left").clientWidth;g+=d.get(i+"_right").clientWidth;s+=d.get(i+"_top").clientHeight;s+=d.get(i+"_bottom").clientHeight}d.setStyles(i,{top:r.top,left:r.left,width:r.width+g,height:r.height+s});x=r.url||r.file;if(x){if(tinymce.relaxedDomain){x+=(x.indexOf("?")==-1?"?":"&")+"mce_rdomain="+tinymce.relaxedDomain}x=tinymce._addVer(x)}if(!r.type){d.add(i+"_content","iframe",{id:i+"_ifr",src:'javascript:""',frameBorder:0,style:"border:0;width:10px;height:10px"});d.setStyles(i+"_ifr",{width:r.width,height:r.height});d.setAttrib(i+"_ifr","src",x)}else{d.add(i+"_wrapper","a",{id:i+"_ok","class":"mceButton mceOk",href:"javascript:;",onmousedown:"return false;"},"Ok");if(r.type=="confirm"){d.add(i+"_wrapper","a",{"class":"mceButton mceCancel",href:"javascript:;",onmousedown:"return false;"},"Cancel")}d.add(i+"_middle","div",{"class":"mceIcon"});d.setHTML(i+"_content",r.content.replace("\n","<br />"))}n=a.add(i,"mousedown",function(t){var u=t.target,f,p;f=y.windows[i];y.focus(i);if(u.nodeName=="A"||u.nodeName=="a"){if(u.className=="mceMax"){f.oldPos=f.element.getXY();f.oldSize=f.element.getSize();p=d.getViewPort();p.w-=2;p.h-=2;f.element.moveTo(p.x,p.y);f.element.resizeTo(p.w,p.h);d.setStyles(i+"_ifr",{width:p.w-f.deltaWidth,height:p.h-f.deltaHeight});d.addClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMed"){f.element.moveTo(f.oldPos.x,f.oldPos.y);f.element.resizeTo(f.oldSize.w,f.oldSize.h);f.iframeElement.resizeTo(f.oldSize.w-f.deltaWidth,f.oldSize.h-f.deltaHeight);d.removeClass(i+"_wrapper","mceMaximized")}else{if(u.className=="mceMove"){return y._startDrag(i,t,u.className)}else{if(d.hasClass(u,"mceResize")){return y._startDrag(i,t,u.className.substring(13))}}}}}});o=a.add(i,"click",function(f){var p=f.target;y.focus(i);if(p.nodeName=="A"||p.nodeName=="a"){switch(p.className){case"mceClose":y.close(null,i);return a.cancel(f);case"mceButton mceOk":case"mceButton mceCancel":r.button_func(p.className=="mceButton mceOk");return a.cancel(f)}}});v=y.windows[i]={id:i,mousedown_func:n,click_func:o,element:new b(i,{blocker:1,container:q.getContainer()}),iframeElement:new b(i+"_ifr"),features:r,deltaWidth:g,deltaHeight:s};v.iframeElement.on("focus",function(){y.focus(i)});if(y.count==0&&y.editor.getParam("dialog_type","modal")=="modal"){d.add(d.doc.body,"div",{id:"mceModalBlocker","class":(y.editor.settings.inlinepopups_skin||"clearlooks2")+"_modalBlocker",style:{zIndex:y.zIndex-1}});d.show("mceModalBlocker")}else{d.setStyle("mceModalBlocker","z-index",y.zIndex-1)}if(tinymce.isIE6||/Firefox\/2\./.test(navigator.userAgent)||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceModalBlocker",{position:"absolute",left:h.x,top:h.y,width:h.w-2,height:h.h-2})}y.focus(i);y._fixIELayout(i,1);if(d.get(i+"_ok")){d.get(i+"_ok").focus()}y.count++;return v},focus:function(h){var g=this,f;if(f=g.windows[h]){f.zIndex=this.zIndex++;f.element.setStyle("zIndex",f.zIndex);f.element.update();h=h+"_wrapper";d.removeClass(g.lastId,"mceFocus");d.addClass(h,"mceFocus");g.lastId=h}},_addAll:function(k,h){var g,l,f=this,j=tinymce.DOM;if(c(h,"string")){k.appendChild(j.doc.createTextNode(h))}else{if(h.length){k=k.appendChild(j.create(h[0],h[1]));for(g=2;g<h.length;g++){f._addAll(k,h[g])}}}},_startDrag:function(v,G,E){var o=this,u,z,C=d.doc,f,l=o.windows[v],h=l.element,y=h.getXY(),x,q,F,g,A,s,r,j,i,m,k,n,B;g={x:0,y:0};A=d.getViewPort();A.w-=2;A.h-=2;j=G.screenX;i=G.screenY;m=k=n=B=0;u=a.add(C,"mouseup",function(p){a.remove(C,"mouseup",u);a.remove(C,"mousemove",z);if(f){f.remove()}h.moveBy(m,k);h.resizeBy(n,B);q=h.getSize();d.setStyles(v+"_ifr",{width:q.w-l.deltaWidth,height:q.h-l.deltaHeight});o._fixIELayout(v,1);return a.cancel(p)});if(E!="Move"){D()}function D(){if(f){return}o._fixIELayout(v,0);d.add(C.body,"div",{id:"mceEventBlocker","class":"mceEventBlocker "+(o.editor.settings.inlinepopups_skin||"clearlooks2"),style:{zIndex:o.zIndex+1}});if(tinymce.isIE6||(tinymce.isIE&&!d.boxModel)){d.setStyles("mceEventBlocker",{position:"absolute",left:A.x,top:A.y,width:A.w-2,height:A.h-2})}f=new b("mceEventBlocker");f.update();x=h.getXY();q=h.getSize();s=g.x+x.x-A.x;r=g.y+x.y-A.y;d.add(f.get(),"div",{id:"mcePlaceHolder","class":"mcePlaceHolder",style:{left:s,top:r,width:q.w,height:q.h}});F=new b("mcePlaceHolder")}z=a.add(C,"mousemove",function(w){var p,H,t;D();p=w.screenX-j;H=w.screenY-i;switch(E){case"ResizeW":m=p;n=0-p;break;case"ResizeE":n=p;break;case"ResizeN":case"ResizeNW":case"ResizeNE":if(E=="ResizeNW"){m=p;n=0-p}else{if(E=="ResizeNE"){n=p}}k=H;B=0-H;break;case"ResizeS":case"ResizeSW":case"ResizeSE":if(E=="ResizeSW"){m=p;n=0-p}else{if(E=="ResizeSE"){n=p}}B=H;break;case"mceMove":m=p;k=H;break}if(n<(t=l.features.min_width-q.w)){if(m!==0){m+=n-t}n=t}if(B<(t=l.features.min_height-q.h)){if(k!==0){k+=B-t}B=t}n=Math.min(n,l.features.max_width-q.w);B=Math.min(B,l.features.max_height-q.h);m=Math.max(m,A.x-(s+A.x));k=Math.max(k,A.y-(r+A.y));m=Math.min(m,(A.w+A.x)-(s+q.w+A.x));k=Math.min(k,(A.h+A.y)-(r+q.h+A.y));if(m+k!==0){if(s+m<0){m=0}if(r+k<0){k=0}F.moveTo(s+m,r+k)}if(n+B!==0){F.resizeTo(q.w+n,q.h+B)}return a.cancel(w)});return a.cancel(G)},resizeBy:function(g,h,i){var f=this.windows[i];if(f){f.element.resizeBy(g,h);f.iframeElement.resizeBy(g,h)}},close:function(j,l){var h=this,g,k=d.doc,f=0,i,l;l=h._findId(l||j);if(!h.windows[l]){h.parent(j);return}h.count--;if(h.count==0){d.remove("mceModalBlocker")}if(g=h.windows[l]){h.onClose.dispatch(h);a.remove(k,"mousedown",g.mousedownFunc);a.remove(k,"click",g.clickFunc);a.clear(l);a.clear(l+"_ifr");d.setAttrib(l+"_ifr","src",'javascript:""');g.element.remove();delete h.windows[l];e(h.windows,function(m){if(m.zIndex>f){i=m;f=m.zIndex}});if(i){h.focus(i.id)}}},setTitle:function(f,g){var h;f=this._findId(f);if(h=d.get(f+"_title")){h.innerHTML=d.encode(g)}},alert:function(g,f,j){var i=this,h;h=i.open({title:i,type:"alert",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},confirm:function(g,f,j){var i=this,h;h=i.open({title:i,type:"confirm",button_func:function(k){if(f){f.call(k||i,k)}i.close(null,h.id)},content:d.encode(i.editor.getLang(g,g)),inline:1,width:400,height:130})},_findId:function(f){var g=this;if(typeof(f)=="string"){return f}e(g.windows,function(h){var i=d.get(h.id+"_ifr");if(i&&f==i.contentWindow){f=h.id;return false}});return f},_fixIELayout:function(i,h){var f,g;if(!tinymce.isIE6){return}e(["n","s","w","e","nw","ne","sw","se"],function(j){var k=d.get(i+"_resize_"+j);d.setStyles(k,{width:h?k.clientWidth:"",height:h?k.clientHeight:"",cursor:d.getStyle(k,"cursor",1)});d.setStyle(i+"_bottom","bottom","-1px");k=0});if(f=this.windows[i]){f.element.hide();f.element.show();e(d.select("div,a",i),function(k,j){if(k.currentStyle.backgroundImage!="none"){g=new Image();g.src=k.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/,"$1")}});d.get(i).style.filter=""}}});tinymce.PluginManager.add("inlinepopups",tinymce.plugins.InlinePopups)})();
@@ -0,0 +1,635 @@
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 DOM = tinymce.DOM, Element = tinymce.dom.Element, Event = tinymce.dom.Event, each = tinymce.each, is = tinymce.is;
13
+
14
+ tinymce.create('tinymce.plugins.InlinePopups', {
15
+ init : function(ed, url) {
16
+ // Replace window manager
17
+ ed.onBeforeRenderUI.add(function() {
18
+ ed.windowManager = new tinymce.InlineWindowManager(ed);
19
+ DOM.loadCSS(url + '/skins/' + (ed.settings.inlinepopups_skin || 'clearlooks2') + "/window.css");
20
+ });
21
+ },
22
+
23
+ getInfo : function() {
24
+ return {
25
+ longname : 'InlinePopups',
26
+ author : 'Moxiecode Systems AB',
27
+ authorurl : 'http://tinymce.moxiecode.com',
28
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/inlinepopups',
29
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
30
+ };
31
+ }
32
+ });
33
+
34
+ tinymce.create('tinymce.InlineWindowManager:tinymce.WindowManager', {
35
+ InlineWindowManager : function(ed) {
36
+ var t = this;
37
+
38
+ t.parent(ed);
39
+ t.zIndex = 300000;
40
+ t.count = 0;
41
+ t.windows = {};
42
+ },
43
+
44
+ open : function(f, p) {
45
+ var t = this, id, opt = '', ed = t.editor, dw = 0, dh = 0, vp, po, mdf, clf, we, w, u;
46
+
47
+ f = f || {};
48
+ p = p || {};
49
+
50
+ // Run native windows
51
+ if (!f.inline)
52
+ return t.parent(f, p);
53
+
54
+ // Only store selection if the type is a normal window
55
+ if (!f.type)
56
+ t.bookmark = ed.selection.getBookmark(1);
57
+
58
+ id = DOM.uniqueId();
59
+ vp = DOM.getViewPort();
60
+ f.width = parseInt(f.width || 320);
61
+ f.height = parseInt(f.height || 240) + (tinymce.isIE ? 8 : 0);
62
+ f.min_width = parseInt(f.min_width || 150);
63
+ f.min_height = parseInt(f.min_height || 100);
64
+ f.max_width = parseInt(f.max_width || 2000);
65
+ f.max_height = parseInt(f.max_height || 2000);
66
+ f.left = f.left || Math.round(Math.max(vp.x, vp.x + (vp.w / 2.0) - (f.width / 2.0)));
67
+ f.top = f.top || Math.round(Math.max(vp.y, vp.y + (vp.h / 2.0) - (f.height / 2.0)));
68
+ f.movable = f.resizable = true;
69
+ p.mce_width = f.width;
70
+ p.mce_height = f.height;
71
+ p.mce_inline = true;
72
+ p.mce_window_id = id;
73
+ p.mce_auto_focus = f.auto_focus;
74
+
75
+ // Transpose
76
+ // po = DOM.getPos(ed.getContainer());
77
+ // f.left -= po.x;
78
+ // f.top -= po.y;
79
+
80
+ t.features = f;
81
+ t.params = p;
82
+ t.onOpen.dispatch(t, f, p);
83
+
84
+ if (f.type) {
85
+ opt += ' mceModal';
86
+
87
+ if (f.type)
88
+ opt += ' mce' + f.type.substring(0, 1).toUpperCase() + f.type.substring(1);
89
+
90
+ f.resizable = false;
91
+ }
92
+
93
+ if (f.statusbar)
94
+ opt += ' mceStatusbar';
95
+
96
+ if (f.resizable)
97
+ opt += ' mceResizable';
98
+
99
+ if (f.minimizable)
100
+ opt += ' mceMinimizable';
101
+
102
+ if (f.maximizable)
103
+ opt += ' mceMaximizable';
104
+
105
+ if (f.movable)
106
+ opt += ' mceMovable';
107
+
108
+ // Create DOM objects
109
+ t._addAll(DOM.doc.body,
110
+ ['div', {id : id, 'class' : ed.settings.inlinepopups_skin || 'clearlooks2', style : 'width:100px;height:100px'},
111
+ ['div', {id : id + '_wrapper', 'class' : 'mceWrapper' + opt},
112
+ ['div', {id : id + '_top', 'class' : 'mceTop'},
113
+ ['div', {'class' : 'mceLeft'}],
114
+ ['div', {'class' : 'mceCenter'}],
115
+ ['div', {'class' : 'mceRight'}],
116
+ ['span', {id : id + '_title'}, f.title || '']
117
+ ],
118
+
119
+ ['div', {id : id + '_middle', 'class' : 'mceMiddle'},
120
+ ['div', {id : id + '_left', 'class' : 'mceLeft'}],
121
+ ['span', {id : id + '_content'}],
122
+ ['div', {id : id + '_right', 'class' : 'mceRight'}]
123
+ ],
124
+
125
+ ['div', {id : id + '_bottom', 'class' : 'mceBottom'},
126
+ ['div', {'class' : 'mceLeft'}],
127
+ ['div', {'class' : 'mceCenter'}],
128
+ ['div', {'class' : 'mceRight'}],
129
+ ['span', {id : id + '_status'}, 'Content']
130
+ ],
131
+
132
+ ['a', {'class' : 'mceMove', tabindex : '-1', href : 'javascript:;'}],
133
+ ['a', {'class' : 'mceMin', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
134
+ ['a', {'class' : 'mceMax', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
135
+ ['a', {'class' : 'mceMed', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
136
+ ['a', {'class' : 'mceClose', tabindex : '-1', href : 'javascript:;', onmousedown : 'return false;'}],
137
+ ['a', {id : id + '_resize_n', 'class' : 'mceResize mceResizeN', tabindex : '-1', href : 'javascript:;'}],
138
+ ['a', {id : id + '_resize_s', 'class' : 'mceResize mceResizeS', tabindex : '-1', href : 'javascript:;'}],
139
+ ['a', {id : id + '_resize_w', 'class' : 'mceResize mceResizeW', tabindex : '-1', href : 'javascript:;'}],
140
+ ['a', {id : id + '_resize_e', 'class' : 'mceResize mceResizeE', tabindex : '-1', href : 'javascript:;'}],
141
+ ['a', {id : id + '_resize_nw', 'class' : 'mceResize mceResizeNW', tabindex : '-1', href : 'javascript:;'}],
142
+ ['a', {id : id + '_resize_ne', 'class' : 'mceResize mceResizeNE', tabindex : '-1', href : 'javascript:;'}],
143
+ ['a', {id : id + '_resize_sw', 'class' : 'mceResize mceResizeSW', tabindex : '-1', href : 'javascript:;'}],
144
+ ['a', {id : id + '_resize_se', 'class' : 'mceResize mceResizeSE', tabindex : '-1', href : 'javascript:;'}]
145
+ ]
146
+ ]
147
+ );
148
+
149
+ DOM.setStyles(id, {top : -10000, left : -10000});
150
+
151
+ // Fix gecko rendering bug, where the editors iframe messed with window contents
152
+ if (tinymce.isGecko)
153
+ DOM.setStyle(id, 'overflow', 'auto');
154
+
155
+ // Measure borders
156
+ if (!f.type) {
157
+ dw += DOM.get(id + '_left').clientWidth;
158
+ dw += DOM.get(id + '_right').clientWidth;
159
+ dh += DOM.get(id + '_top').clientHeight;
160
+ dh += DOM.get(id + '_bottom').clientHeight;
161
+ }
162
+
163
+ // Resize window
164
+ DOM.setStyles(id, {top : f.top, left : f.left, width : f.width + dw, height : f.height + dh});
165
+
166
+ u = f.url || f.file;
167
+ if (u) {
168
+ if (tinymce.relaxedDomain)
169
+ u += (u.indexOf('?') == -1 ? '?' : '&') + 'mce_rdomain=' + tinymce.relaxedDomain;
170
+
171
+ u = tinymce._addVer(u);
172
+ }
173
+
174
+ if (!f.type) {
175
+ DOM.add(id + '_content', 'iframe', {id : id + '_ifr', src : 'javascript:""', frameBorder : 0, style : 'border:0;width:10px;height:10px'});
176
+ DOM.setStyles(id + '_ifr', {width : f.width, height : f.height});
177
+ DOM.setAttrib(id + '_ifr', 'src', u);
178
+ } else {
179
+ DOM.add(id + '_wrapper', 'a', {id : id + '_ok', 'class' : 'mceButton mceOk', href : 'javascript:;', onmousedown : 'return false;'}, 'Ok');
180
+
181
+ if (f.type == 'confirm')
182
+ DOM.add(id + '_wrapper', 'a', {'class' : 'mceButton mceCancel', href : 'javascript:;', onmousedown : 'return false;'}, 'Cancel');
183
+
184
+ DOM.add(id + '_middle', 'div', {'class' : 'mceIcon'});
185
+ DOM.setHTML(id + '_content', f.content.replace('\n', '<br />'));
186
+ }
187
+
188
+ // Register events
189
+ mdf = Event.add(id, 'mousedown', function(e) {
190
+ var n = e.target, w, vp;
191
+
192
+ w = t.windows[id];
193
+ t.focus(id);
194
+
195
+ if (n.nodeName == 'A' || n.nodeName == 'a') {
196
+ if (n.className == 'mceMax') {
197
+ w.oldPos = w.element.getXY();
198
+ w.oldSize = w.element.getSize();
199
+
200
+ vp = DOM.getViewPort();
201
+
202
+ // Reduce viewport size to avoid scrollbars
203
+ vp.w -= 2;
204
+ vp.h -= 2;
205
+
206
+ w.element.moveTo(vp.x, vp.y);
207
+ w.element.resizeTo(vp.w, vp.h);
208
+ DOM.setStyles(id + '_ifr', {width : vp.w - w.deltaWidth, height : vp.h - w.deltaHeight});
209
+ DOM.addClass(id + '_wrapper', 'mceMaximized');
210
+ } else if (n.className == 'mceMed') {
211
+ // Reset to old size
212
+ w.element.moveTo(w.oldPos.x, w.oldPos.y);
213
+ w.element.resizeTo(w.oldSize.w, w.oldSize.h);
214
+ w.iframeElement.resizeTo(w.oldSize.w - w.deltaWidth, w.oldSize.h - w.deltaHeight);
215
+
216
+ DOM.removeClass(id + '_wrapper', 'mceMaximized');
217
+ } else if (n.className == 'mceMove')
218
+ return t._startDrag(id, e, n.className);
219
+ else if (DOM.hasClass(n, 'mceResize'))
220
+ return t._startDrag(id, e, n.className.substring(13));
221
+ }
222
+ });
223
+
224
+ clf = Event.add(id, 'click', function(e) {
225
+ var n = e.target;
226
+
227
+ t.focus(id);
228
+
229
+ if (n.nodeName == 'A' || n.nodeName == 'a') {
230
+ switch (n.className) {
231
+ case 'mceClose':
232
+ t.close(null, id);
233
+ return Event.cancel(e);
234
+
235
+ case 'mceButton mceOk':
236
+ case 'mceButton mceCancel':
237
+ f.button_func(n.className == 'mceButton mceOk');
238
+ return Event.cancel(e);
239
+ }
240
+ }
241
+ });
242
+
243
+ // Add window
244
+ w = t.windows[id] = {
245
+ id : id,
246
+ mousedown_func : mdf,
247
+ click_func : clf,
248
+ element : new Element(id, {blocker : 1, container : ed.getContainer()}),
249
+ iframeElement : new Element(id + '_ifr'),
250
+ features : f,
251
+ deltaWidth : dw,
252
+ deltaHeight : dh
253
+ };
254
+
255
+ w.iframeElement.on('focus', function() {
256
+ t.focus(id);
257
+ });
258
+
259
+ // Setup blocker
260
+ if (t.count == 0 && t.editor.getParam('dialog_type', 'modal') == 'modal') {
261
+ DOM.add(DOM.doc.body, 'div', {
262
+ id : 'mceModalBlocker',
263
+ 'class' : (t.editor.settings.inlinepopups_skin || 'clearlooks2') + '_modalBlocker',
264
+ style : {zIndex : t.zIndex - 1}
265
+ });
266
+
267
+ DOM.show('mceModalBlocker'); // Reduces flicker in IE
268
+ } else
269
+ DOM.setStyle('mceModalBlocker', 'z-index', t.zIndex - 1);
270
+
271
+ if (tinymce.isIE6 || /Firefox\/2\./.test(navigator.userAgent) || (tinymce.isIE && !DOM.boxModel))
272
+ DOM.setStyles('mceModalBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});
273
+
274
+ t.focus(id);
275
+ t._fixIELayout(id, 1);
276
+
277
+ // Focus ok button
278
+ if (DOM.get(id + '_ok'))
279
+ DOM.get(id + '_ok').focus();
280
+
281
+ t.count++;
282
+
283
+ return w;
284
+ },
285
+
286
+ focus : function(id) {
287
+ var t = this, w;
288
+
289
+ if (w = t.windows[id]) {
290
+ w.zIndex = this.zIndex++;
291
+ w.element.setStyle('zIndex', w.zIndex);
292
+ w.element.update();
293
+
294
+ id = id + '_wrapper';
295
+ DOM.removeClass(t.lastId, 'mceFocus');
296
+ DOM.addClass(id, 'mceFocus');
297
+ t.lastId = id;
298
+ }
299
+ },
300
+
301
+ _addAll : function(te, ne) {
302
+ var i, n, t = this, dom = tinymce.DOM;
303
+
304
+ if (is(ne, 'string'))
305
+ te.appendChild(dom.doc.createTextNode(ne));
306
+ else if (ne.length) {
307
+ te = te.appendChild(dom.create(ne[0], ne[1]));
308
+
309
+ for (i=2; i<ne.length; i++)
310
+ t._addAll(te, ne[i]);
311
+ }
312
+ },
313
+
314
+ _startDrag : function(id, se, ac) {
315
+ var t = this, mu, mm, d = DOM.doc, eb, w = t.windows[id], we = w.element, sp = we.getXY(), p, sz, ph, cp, vp, sx, sy, sex, sey, dx, dy, dw, dh;
316
+
317
+ // Get positons and sizes
318
+ // cp = DOM.getPos(t.editor.getContainer());
319
+ cp = {x : 0, y : 0};
320
+ vp = DOM.getViewPort();
321
+
322
+ // Reduce viewport size to avoid scrollbars while dragging
323
+ vp.w -= 2;
324
+ vp.h -= 2;
325
+
326
+ sex = se.screenX;
327
+ sey = se.screenY;
328
+ dx = dy = dw = dh = 0;
329
+
330
+ // Handle mouse up
331
+ mu = Event.add(d, 'mouseup', function(e) {
332
+ Event.remove(d, 'mouseup', mu);
333
+ Event.remove(d, 'mousemove', mm);
334
+
335
+ if (eb)
336
+ eb.remove();
337
+
338
+ we.moveBy(dx, dy);
339
+ we.resizeBy(dw, dh);
340
+ sz = we.getSize();
341
+ DOM.setStyles(id + '_ifr', {width : sz.w - w.deltaWidth, height : sz.h - w.deltaHeight});
342
+ t._fixIELayout(id, 1);
343
+
344
+ return Event.cancel(e);
345
+ });
346
+
347
+ if (ac != 'Move')
348
+ startMove();
349
+
350
+ function startMove() {
351
+ if (eb)
352
+ return;
353
+
354
+ t._fixIELayout(id, 0);
355
+
356
+ // Setup event blocker
357
+ DOM.add(d.body, 'div', {
358
+ id : 'mceEventBlocker',
359
+ 'class' : 'mceEventBlocker ' + (t.editor.settings.inlinepopups_skin || 'clearlooks2'),
360
+ style : {zIndex : t.zIndex + 1}
361
+ });
362
+
363
+ if (tinymce.isIE6 || (tinymce.isIE && !DOM.boxModel))
364
+ DOM.setStyles('mceEventBlocker', {position : 'absolute', left : vp.x, top : vp.y, width : vp.w - 2, height : vp.h - 2});
365
+
366
+ eb = new Element('mceEventBlocker');
367
+ eb.update();
368
+
369
+ // Setup placeholder
370
+ p = we.getXY();
371
+ sz = we.getSize();
372
+ sx = cp.x + p.x - vp.x;
373
+ sy = cp.y + p.y - vp.y;
374
+ DOM.add(eb.get(), 'div', {id : 'mcePlaceHolder', 'class' : 'mcePlaceHolder', style : {left : sx, top : sy, width : sz.w, height : sz.h}});
375
+ ph = new Element('mcePlaceHolder');
376
+ };
377
+
378
+ // Handle mouse move/drag
379
+ mm = Event.add(d, 'mousemove', function(e) {
380
+ var x, y, v;
381
+
382
+ startMove();
383
+
384
+ x = e.screenX - sex;
385
+ y = e.screenY - sey;
386
+
387
+ switch (ac) {
388
+ case 'ResizeW':
389
+ dx = x;
390
+ dw = 0 - x;
391
+ break;
392
+
393
+ case 'ResizeE':
394
+ dw = x;
395
+ break;
396
+
397
+ case 'ResizeN':
398
+ case 'ResizeNW':
399
+ case 'ResizeNE':
400
+ if (ac == "ResizeNW") {
401
+ dx = x;
402
+ dw = 0 - x;
403
+ } else if (ac == "ResizeNE")
404
+ dw = x;
405
+
406
+ dy = y;
407
+ dh = 0 - y;
408
+ break;
409
+
410
+ case 'ResizeS':
411
+ case 'ResizeSW':
412
+ case 'ResizeSE':
413
+ if (ac == "ResizeSW") {
414
+ dx = x;
415
+ dw = 0 - x;
416
+ } else if (ac == "ResizeSE")
417
+ dw = x;
418
+
419
+ dh = y;
420
+ break;
421
+
422
+ case 'mceMove':
423
+ dx = x;
424
+ dy = y;
425
+ break;
426
+ }
427
+
428
+ // Boundary check
429
+ if (dw < (v = w.features.min_width - sz.w)) {
430
+ if (dx !== 0)
431
+ dx += dw - v;
432
+
433
+ dw = v;
434
+ }
435
+
436
+ if (dh < (v = w.features.min_height - sz.h)) {
437
+ if (dy !== 0)
438
+ dy += dh - v;
439
+
440
+ dh = v;
441
+ }
442
+
443
+ dw = Math.min(dw, w.features.max_width - sz.w);
444
+ dh = Math.min(dh, w.features.max_height - sz.h);
445
+ dx = Math.max(dx, vp.x - (sx + vp.x));
446
+ dy = Math.max(dy, vp.y - (sy + vp.y));
447
+ dx = Math.min(dx, (vp.w + vp.x) - (sx + sz.w + vp.x));
448
+ dy = Math.min(dy, (vp.h + vp.y) - (sy + sz.h + vp.y));
449
+
450
+ // Move if needed
451
+ if (dx + dy !== 0) {
452
+ if (sx + dx < 0)
453
+ dx = 0;
454
+
455
+ if (sy + dy < 0)
456
+ dy = 0;
457
+
458
+ ph.moveTo(sx + dx, sy + dy);
459
+ }
460
+
461
+ // Resize if needed
462
+ if (dw + dh !== 0)
463
+ ph.resizeTo(sz.w + dw, sz.h + dh);
464
+
465
+ return Event.cancel(e);
466
+ });
467
+
468
+ return Event.cancel(se);
469
+ },
470
+
471
+ resizeBy : function(dw, dh, id) {
472
+ var w = this.windows[id];
473
+
474
+ if (w) {
475
+ w.element.resizeBy(dw, dh);
476
+ w.iframeElement.resizeBy(dw, dh);
477
+ }
478
+ },
479
+
480
+ close : function(win, id) {
481
+ var t = this, w, d = DOM.doc, ix = 0, fw, id;
482
+
483
+ id = t._findId(id || win);
484
+
485
+ // Probably not inline
486
+ if (!t.windows[id]) {
487
+ t.parent(win);
488
+ return;
489
+ }
490
+
491
+ t.count--;
492
+
493
+ if (t.count == 0)
494
+ DOM.remove('mceModalBlocker');
495
+
496
+ if (w = t.windows[id]) {
497
+ t.onClose.dispatch(t);
498
+ Event.remove(d, 'mousedown', w.mousedownFunc);
499
+ Event.remove(d, 'click', w.clickFunc);
500
+ Event.clear(id);
501
+ Event.clear(id + '_ifr');
502
+
503
+ DOM.setAttrib(id + '_ifr', 'src', 'javascript:""'); // Prevent leak
504
+ w.element.remove();
505
+ delete t.windows[id];
506
+
507
+ // Find front most window and focus that
508
+ each (t.windows, function(w) {
509
+ if (w.zIndex > ix) {
510
+ fw = w;
511
+ ix = w.zIndex;
512
+ }
513
+ });
514
+
515
+ if (fw)
516
+ t.focus(fw.id);
517
+ }
518
+ },
519
+
520
+ setTitle : function(w, ti) {
521
+ var e;
522
+
523
+ w = this._findId(w);
524
+
525
+ if (e = DOM.get(w + '_title'))
526
+ e.innerHTML = DOM.encode(ti);
527
+ },
528
+
529
+ alert : function(txt, cb, s) {
530
+ var t = this, w;
531
+
532
+ w = t.open({
533
+ title : t,
534
+ type : 'alert',
535
+ button_func : function(s) {
536
+ if (cb)
537
+ cb.call(s || t, s);
538
+
539
+ t.close(null, w.id);
540
+ },
541
+ content : DOM.encode(t.editor.getLang(txt, txt)),
542
+ inline : 1,
543
+ width : 400,
544
+ height : 130
545
+ });
546
+ },
547
+
548
+ confirm : function(txt, cb, s) {
549
+ var t = this, w;
550
+
551
+ w = t.open({
552
+ title : t,
553
+ type : 'confirm',
554
+ button_func : function(s) {
555
+ if (cb)
556
+ cb.call(s || t, s);
557
+
558
+ t.close(null, w.id);
559
+ },
560
+ content : DOM.encode(t.editor.getLang(txt, txt)),
561
+ inline : 1,
562
+ width : 400,
563
+ height : 130
564
+ });
565
+ },
566
+
567
+ // Internal functions
568
+
569
+ _findId : function(w) {
570
+ var t = this;
571
+
572
+ if (typeof(w) == 'string')
573
+ return w;
574
+
575
+ each(t.windows, function(wo) {
576
+ var ifr = DOM.get(wo.id + '_ifr');
577
+
578
+ if (ifr && w == ifr.contentWindow) {
579
+ w = wo.id;
580
+ return false;
581
+ }
582
+ });
583
+
584
+ return w;
585
+ },
586
+
587
+ _fixIELayout : function(id, s) {
588
+ var w, img;
589
+
590
+ if (!tinymce.isIE6)
591
+ return;
592
+
593
+ // Fixes the bug where hover flickers and does odd things in IE6
594
+ each(['n','s','w','e','nw','ne','sw','se'], function(v) {
595
+ var e = DOM.get(id + '_resize_' + v);
596
+
597
+ DOM.setStyles(e, {
598
+ width : s ? e.clientWidth : '',
599
+ height : s ? e.clientHeight : '',
600
+ cursor : DOM.getStyle(e, 'cursor', 1)
601
+ });
602
+
603
+ DOM.setStyle(id + "_bottom", 'bottom', '-1px');
604
+
605
+ e = 0;
606
+ });
607
+
608
+ // Fixes graphics glitch
609
+ if (w = this.windows[id]) {
610
+ // Fixes rendering bug after resize
611
+ w.element.hide();
612
+ w.element.show();
613
+
614
+ // Forced a repaint of the window
615
+ //DOM.get(id).style.filter = '';
616
+
617
+ // IE has a bug where images used in CSS won't get loaded
618
+ // sometimes when the cache in the browser is disabled
619
+ // This fix tries to solve it by loading the images using the image object
620
+ each(DOM.select('div,a', id), function(e, i) {
621
+ if (e.currentStyle.backgroundImage != 'none') {
622
+ img = new Image();
623
+ img.src = e.currentStyle.backgroundImage.replace(/url\(\"(.+)\"\)/, '$1');
624
+ }
625
+ });
626
+
627
+ DOM.get(id).style.filter = '';
628
+ }
629
+ }
630
+ });
631
+
632
+ // Register plugin
633
+ tinymce.PluginManager.add('inlinepopups', tinymce.plugins.InlinePopups);
634
+ })();
635
+