yodel_admin 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (321) hide show
  1. data/.gitignore +6 -0
  2. data/Gemfile +4 -0
  3. data/Rakefile +1 -0
  4. data/lib/layouts/admin_list_record.html +94 -0
  5. data/lib/layouts/admin_login.html +131 -0
  6. data/lib/layouts/admin_page/admin_list_page.html +55 -0
  7. data/lib/layouts/admin_page/admin_settings_page.html +34 -0
  8. data/lib/layouts/admin_page/admin_tree_page.html +51 -0
  9. data/lib/layouts/admin_page.html +56 -0
  10. data/lib/layouts/admin_record_form.html +74 -0
  11. data/lib/migrations/01_admin_pages.rb +99 -0
  12. data/lib/migrations/02_admin_default_pages.rb +98 -0
  13. data/lib/models/admin_editor_page.rb +27 -0
  14. data/lib/models/admin_list_page.rb +121 -0
  15. data/lib/models/admin_root_page.rb +9 -0
  16. data/lib/models/admin_settings_page.rb +20 -0
  17. data/lib/models/admin_sync_page.rb +82 -0
  18. data/lib/models/admin_tree_page.rb +141 -0
  19. data/lib/public/admin/chosen/chosen-sprite.png +0 -0
  20. data/lib/public/admin/chosen/chosen.css +340 -0
  21. data/lib/public/admin/chosen/chosen.jquery.min.js +10 -0
  22. data/lib/public/admin/css/admin.css +1086 -0
  23. data/lib/public/admin/css/reset.css +48 -0
  24. data/lib/public/admin/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png +0 -0
  25. data/lib/public/admin/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png +0 -0
  26. data/lib/public/admin/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png +0 -0
  27. data/lib/public/admin/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  28. data/lib/public/admin/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png +0 -0
  29. data/lib/public/admin/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png +0 -0
  30. data/lib/public/admin/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png +0 -0
  31. data/lib/public/admin/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png +0 -0
  32. data/lib/public/admin/css/smoothness/images/ui-icons_222222_256x240.png +0 -0
  33. data/lib/public/admin/css/smoothness/images/ui-icons_2e83ff_256x240.png +0 -0
  34. data/lib/public/admin/css/smoothness/images/ui-icons_454545_256x240.png +0 -0
  35. data/lib/public/admin/css/smoothness/images/ui-icons_888888_256x240.png +0 -0
  36. data/lib/public/admin/css/smoothness/images/ui-icons_cd0a0a_256x240.png +0 -0
  37. data/lib/public/admin/css/smoothness/jquery-ui-1.8.16.custom.css +380 -0
  38. data/lib/public/admin/images/add.png +0 -0
  39. data/lib/public/admin/images/clock.png +0 -0
  40. data/lib/public/admin/images/close.png +0 -0
  41. data/lib/public/admin/images/cross.png +0 -0
  42. data/lib/public/admin/images/default_icon.png +0 -0
  43. data/lib/public/admin/images/delete.png +0 -0
  44. data/lib/public/admin/images/deploy_spinner.gif +0 -0
  45. data/lib/public/admin/images/drag.png +0 -0
  46. data/lib/public/admin/images/group_icon.png +0 -0
  47. data/lib/public/admin/images/left_arrow.png +0 -0
  48. data/lib/public/admin/images/load_spinner.gif +0 -0
  49. data/lib/public/admin/images/load_spinner_selected.gif +0 -0
  50. data/lib/public/admin/images/missing_image.png +0 -0
  51. data/lib/public/admin/images/new.png +0 -0
  52. data/lib/public/admin/images/open.png +0 -0
  53. data/lib/public/admin/images/right_arrow.png +0 -0
  54. data/lib/public/admin/images/save_spinner.gif +0 -0
  55. data/lib/public/admin/images/search.png +0 -0
  56. data/lib/public/admin/images/tick.png +0 -0
  57. data/lib/public/admin/images/user_icon.png +0 -0
  58. data/lib/public/admin/images/yodel.png +0 -0
  59. data/lib/public/admin/js/admin.js +1030 -0
  60. data/lib/public/admin/js/jquery-ui-1.8.16.custom.min.js +227 -0
  61. data/lib/public/admin/js/jquery.min.js +18 -0
  62. data/lib/public/admin/js/jquery.tablesorter.min.js +4 -0
  63. data/lib/public/admin/js/json2.js +480 -0
  64. data/lib/public/admin/js/yodel_jquery.js +241 -0
  65. data/lib/public/admin/tiny_mce/jquery.tinymce.js +338 -0
  66. data/lib/public/admin/tiny_mce/langs/en.js +223 -0
  67. data/lib/public/admin/tiny_mce/license.txt +504 -0
  68. data/lib/public/admin/tiny_mce/plugins/advhr/css/advhr.css +5 -0
  69. data/lib/public/admin/tiny_mce/plugins/advhr/editor_plugin.js +1 -0
  70. data/lib/public/admin/tiny_mce/plugins/advhr/editor_plugin_src.js +57 -0
  71. data/lib/public/admin/tiny_mce/plugins/advhr/js/rule.js +43 -0
  72. data/lib/public/admin/tiny_mce/plugins/advhr/langs/en_dlg.js +7 -0
  73. data/lib/public/admin/tiny_mce/plugins/advhr/rule.htm +58 -0
  74. data/lib/public/admin/tiny_mce/plugins/advimage/css/advimage.css +13 -0
  75. data/lib/public/admin/tiny_mce/plugins/advimage/editor_plugin.js +1 -0
  76. data/lib/public/admin/tiny_mce/plugins/advimage/editor_plugin_src.js +50 -0
  77. data/lib/public/admin/tiny_mce/plugins/advimage/image.htm +235 -0
  78. data/lib/public/admin/tiny_mce/plugins/advimage/img/sample.gif +0 -0
  79. data/lib/public/admin/tiny_mce/plugins/advimage/js/image.js +458 -0
  80. data/lib/public/admin/tiny_mce/plugins/advimage/langs/en_dlg.js +45 -0
  81. data/lib/public/admin/tiny_mce/plugins/advlink/css/advlink.css +8 -0
  82. data/lib/public/admin/tiny_mce/plugins/advlink/editor_plugin.js +1 -0
  83. data/lib/public/admin/tiny_mce/plugins/advlink/editor_plugin_src.js +61 -0
  84. data/lib/public/admin/tiny_mce/plugins/advlink/js/advlink.js +532 -0
  85. data/lib/public/admin/tiny_mce/plugins/advlink/langs/en_dlg.js +54 -0
  86. data/lib/public/admin/tiny_mce/plugins/advlink/link.htm +338 -0
  87. data/lib/public/admin/tiny_mce/plugins/advlist/editor_plugin.js +1 -0
  88. data/lib/public/admin/tiny_mce/plugins/advlist/editor_plugin_src.js +176 -0
  89. data/lib/public/admin/tiny_mce/plugins/autolink/editor_plugin.js +1 -0
  90. data/lib/public/admin/tiny_mce/plugins/autolink/editor_plugin_src.js +172 -0
  91. data/lib/public/admin/tiny_mce/plugins/autoresize/editor_plugin.js +1 -0
  92. data/lib/public/admin/tiny_mce/plugins/autoresize/editor_plugin_src.js +137 -0
  93. data/lib/public/admin/tiny_mce/plugins/autosave/editor_plugin.js +1 -0
  94. data/lib/public/admin/tiny_mce/plugins/autosave/editor_plugin_src.js +431 -0
  95. data/lib/public/admin/tiny_mce/plugins/autosave/langs/en.js +4 -0
  96. data/lib/public/admin/tiny_mce/plugins/bbcode/editor_plugin.js +1 -0
  97. data/lib/public/admin/tiny_mce/plugins/bbcode/editor_plugin_src.js +120 -0
  98. data/lib/public/admin/tiny_mce/plugins/contextmenu/editor_plugin.js +1 -0
  99. data/lib/public/admin/tiny_mce/plugins/contextmenu/editor_plugin_src.js +160 -0
  100. data/lib/public/admin/tiny_mce/plugins/directionality/editor_plugin.js +1 -0
  101. data/lib/public/admin/tiny_mce/plugins/directionality/editor_plugin_src.js +82 -0
  102. data/lib/public/admin/tiny_mce/plugins/emotions/editor_plugin.js +1 -0
  103. data/lib/public/admin/tiny_mce/plugins/emotions/editor_plugin_src.js +43 -0
  104. data/lib/public/admin/tiny_mce/plugins/emotions/emotions.htm +41 -0
  105. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-cool.gif +0 -0
  106. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-cry.gif +0 -0
  107. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-embarassed.gif +0 -0
  108. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-foot-in-mouth.gif +0 -0
  109. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-frown.gif +0 -0
  110. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-innocent.gif +0 -0
  111. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-kiss.gif +0 -0
  112. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-laughing.gif +0 -0
  113. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-money-mouth.gif +0 -0
  114. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-sealed.gif +0 -0
  115. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-smile.gif +0 -0
  116. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-surprised.gif +0 -0
  117. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-tongue-out.gif +0 -0
  118. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-undecided.gif +0 -0
  119. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-wink.gif +0 -0
  120. data/lib/public/admin/tiny_mce/plugins/emotions/img/smiley-yell.gif +0 -0
  121. data/lib/public/admin/tiny_mce/plugins/emotions/js/emotions.js +22 -0
  122. data/lib/public/admin/tiny_mce/plugins/emotions/langs/en_dlg.js +20 -0
  123. data/lib/public/admin/tiny_mce/plugins/example/dialog.htm +22 -0
  124. data/lib/public/admin/tiny_mce/plugins/example/editor_plugin.js +1 -0
  125. data/lib/public/admin/tiny_mce/plugins/example/editor_plugin_src.js +84 -0
  126. data/lib/public/admin/tiny_mce/plugins/example/img/example.gif +0 -0
  127. data/lib/public/admin/tiny_mce/plugins/example/js/dialog.js +19 -0
  128. data/lib/public/admin/tiny_mce/plugins/example/langs/en.js +3 -0
  129. data/lib/public/admin/tiny_mce/plugins/example/langs/en_dlg.js +3 -0
  130. data/lib/public/admin/tiny_mce/plugins/example_dependency/editor_plugin.js +1 -0
  131. data/lib/public/admin/tiny_mce/plugins/example_dependency/editor_plugin_src.js +50 -0
  132. data/lib/public/admin/tiny_mce/plugins/fullpage/css/fullpage.css +143 -0
  133. data/lib/public/admin/tiny_mce/plugins/fullpage/editor_plugin.js +1 -0
  134. data/lib/public/admin/tiny_mce/plugins/fullpage/editor_plugin_src.js +399 -0
  135. data/lib/public/admin/tiny_mce/plugins/fullpage/fullpage.htm +259 -0
  136. data/lib/public/admin/tiny_mce/plugins/fullpage/js/fullpage.js +232 -0
  137. data/lib/public/admin/tiny_mce/plugins/fullpage/langs/en_dlg.js +85 -0
  138. data/lib/public/admin/tiny_mce/plugins/fullscreen/editor_plugin.js +1 -0
  139. data/lib/public/admin/tiny_mce/plugins/fullscreen/editor_plugin_src.js +159 -0
  140. data/lib/public/admin/tiny_mce/plugins/fullscreen/fullscreen.htm +109 -0
  141. data/lib/public/admin/tiny_mce/plugins/iespell/editor_plugin.js +1 -0
  142. data/lib/public/admin/tiny_mce/plugins/iespell/editor_plugin_src.js +54 -0
  143. data/lib/public/admin/tiny_mce/plugins/inlinepopups/editor_plugin.js +1 -0
  144. data/lib/public/admin/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +699 -0
  145. data/lib/public/admin/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
  146. data/lib/public/admin/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
  147. data/lib/public/admin/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
  148. data/lib/public/admin/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
  149. data/lib/public/admin/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
  150. data/lib/public/admin/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
  151. data/lib/public/admin/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
  152. data/lib/public/admin/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +90 -0
  153. data/lib/public/admin/tiny_mce/plugins/inlinepopups/template.htm +387 -0
  154. data/lib/public/admin/tiny_mce/plugins/insertdatetime/editor_plugin.js +1 -0
  155. data/lib/public/admin/tiny_mce/plugins/insertdatetime/editor_plugin_src.js +83 -0
  156. data/lib/public/admin/tiny_mce/plugins/layer/editor_plugin.js +1 -0
  157. data/lib/public/admin/tiny_mce/plugins/layer/editor_plugin_src.js +214 -0
  158. data/lib/public/admin/tiny_mce/plugins/legacyoutput/editor_plugin.js +1 -0
  159. data/lib/public/admin/tiny_mce/plugins/legacyoutput/editor_plugin_src.js +139 -0
  160. data/lib/public/admin/tiny_mce/plugins/lists/editor_plugin.js +1 -0
  161. data/lib/public/admin/tiny_mce/plugins/lists/editor_plugin_src.js +769 -0
  162. data/lib/public/admin/tiny_mce/plugins/media/css/media.css +17 -0
  163. data/lib/public/admin/tiny_mce/plugins/media/editor_plugin.js +1 -0
  164. data/lib/public/admin/tiny_mce/plugins/media/editor_plugin_src.js +822 -0
  165. data/lib/public/admin/tiny_mce/plugins/media/js/embed.js +73 -0
  166. data/lib/public/admin/tiny_mce/plugins/media/js/media.js +389 -0
  167. data/lib/public/admin/tiny_mce/plugins/media/langs/en_dlg.js +112 -0
  168. data/lib/public/admin/tiny_mce/plugins/media/media.htm +897 -0
  169. data/lib/public/admin/tiny_mce/plugins/media/moxieplayer.swf +0 -0
  170. data/lib/public/admin/tiny_mce/plugins/nonbreaking/editor_plugin.js +1 -0
  171. data/lib/public/admin/tiny_mce/plugins/nonbreaking/editor_plugin_src.js +53 -0
  172. data/lib/public/admin/tiny_mce/plugins/noneditable/editor_plugin.js +1 -0
  173. data/lib/public/admin/tiny_mce/plugins/noneditable/editor_plugin_src.js +95 -0
  174. data/lib/public/admin/tiny_mce/plugins/pagebreak/editor_plugin.js +1 -0
  175. data/lib/public/admin/tiny_mce/plugins/pagebreak/editor_plugin_src.js +74 -0
  176. data/lib/public/admin/tiny_mce/plugins/paste/editor_plugin.js +1 -0
  177. data/lib/public/admin/tiny_mce/plugins/paste/editor_plugin_src.js +942 -0
  178. data/lib/public/admin/tiny_mce/plugins/paste/js/pastetext.js +36 -0
  179. data/lib/public/admin/tiny_mce/plugins/paste/js/pasteword.js +51 -0
  180. data/lib/public/admin/tiny_mce/plugins/paste/langs/en_dlg.js +5 -0
  181. data/lib/public/admin/tiny_mce/plugins/paste/pastetext.htm +27 -0
  182. data/lib/public/admin/tiny_mce/plugins/paste/pasteword.htm +21 -0
  183. data/lib/public/admin/tiny_mce/plugins/preview/editor_plugin.js +1 -0
  184. data/lib/public/admin/tiny_mce/plugins/preview/editor_plugin_src.js +53 -0
  185. data/lib/public/admin/tiny_mce/plugins/preview/example.html +28 -0
  186. data/lib/public/admin/tiny_mce/plugins/preview/jscripts/embed.js +73 -0
  187. data/lib/public/admin/tiny_mce/plugins/preview/preview.html +17 -0
  188. data/lib/public/admin/tiny_mce/plugins/print/editor_plugin.js +1 -0
  189. data/lib/public/admin/tiny_mce/plugins/print/editor_plugin_src.js +34 -0
  190. data/lib/public/admin/tiny_mce/plugins/save/editor_plugin.js +1 -0
  191. data/lib/public/admin/tiny_mce/plugins/save/editor_plugin_src.js +101 -0
  192. data/lib/public/admin/tiny_mce/plugins/searchreplace/css/searchreplace.css +6 -0
  193. data/lib/public/admin/tiny_mce/plugins/searchreplace/editor_plugin.js +1 -0
  194. data/lib/public/admin/tiny_mce/plugins/searchreplace/editor_plugin_src.js +61 -0
  195. data/lib/public/admin/tiny_mce/plugins/searchreplace/js/searchreplace.js +142 -0
  196. data/lib/public/admin/tiny_mce/plugins/searchreplace/langs/en_dlg.js +16 -0
  197. data/lib/public/admin/tiny_mce/plugins/searchreplace/searchreplace.htm +100 -0
  198. data/lib/public/admin/tiny_mce/plugins/spellchecker/css/content.css +1 -0
  199. data/lib/public/admin/tiny_mce/plugins/spellchecker/editor_plugin.js +1 -0
  200. data/lib/public/admin/tiny_mce/plugins/spellchecker/editor_plugin_src.js +434 -0
  201. data/lib/public/admin/tiny_mce/plugins/spellchecker/img/wline.gif +0 -0
  202. data/lib/public/admin/tiny_mce/plugins/style/css/props.css +13 -0
  203. data/lib/public/admin/tiny_mce/plugins/style/editor_plugin.js +1 -0
  204. data/lib/public/admin/tiny_mce/plugins/style/editor_plugin_src.js +55 -0
  205. data/lib/public/admin/tiny_mce/plugins/style/js/props.js +635 -0
  206. data/lib/public/admin/tiny_mce/plugins/style/langs/en_dlg.js +70 -0
  207. data/lib/public/admin/tiny_mce/plugins/style/props.htm +840 -0
  208. data/lib/public/admin/tiny_mce/plugins/tabfocus/editor_plugin.js +1 -0
  209. data/lib/public/admin/tiny_mce/plugins/tabfocus/editor_plugin_src.js +122 -0
  210. data/lib/public/admin/tiny_mce/plugins/table/cell.htm +180 -0
  211. data/lib/public/admin/tiny_mce/plugins/table/css/cell.css +17 -0
  212. data/lib/public/admin/tiny_mce/plugins/table/css/row.css +25 -0
  213. data/lib/public/admin/tiny_mce/plugins/table/css/table.css +13 -0
  214. data/lib/public/admin/tiny_mce/plugins/table/editor_plugin.js +1 -0
  215. data/lib/public/admin/tiny_mce/plugins/table/editor_plugin_src.js +1363 -0
  216. data/lib/public/admin/tiny_mce/plugins/table/js/cell.js +319 -0
  217. data/lib/public/admin/tiny_mce/plugins/table/js/merge_cells.js +27 -0
  218. data/lib/public/admin/tiny_mce/plugins/table/js/row.js +237 -0
  219. data/lib/public/admin/tiny_mce/plugins/table/js/table.js +450 -0
  220. data/lib/public/admin/tiny_mce/plugins/table/langs/en_dlg.js +75 -0
  221. data/lib/public/admin/tiny_mce/plugins/table/merge_cells.htm +32 -0
  222. data/lib/public/admin/tiny_mce/plugins/table/row.htm +158 -0
  223. data/lib/public/admin/tiny_mce/plugins/table/table.htm +188 -0
  224. data/lib/public/admin/tiny_mce/plugins/template/blank.htm +12 -0
  225. data/lib/public/admin/tiny_mce/plugins/template/css/template.css +23 -0
  226. data/lib/public/admin/tiny_mce/plugins/template/editor_plugin.js +1 -0
  227. data/lib/public/admin/tiny_mce/plugins/template/editor_plugin_src.js +159 -0
  228. data/lib/public/admin/tiny_mce/plugins/template/js/template.js +106 -0
  229. data/lib/public/admin/tiny_mce/plugins/template/langs/en_dlg.js +15 -0
  230. data/lib/public/admin/tiny_mce/plugins/template/template.htm +31 -0
  231. data/lib/public/admin/tiny_mce/plugins/visualchars/editor_plugin.js +1 -0
  232. data/lib/public/admin/tiny_mce/plugins/visualchars/editor_plugin_src.js +83 -0
  233. data/lib/public/admin/tiny_mce/plugins/wordcount/editor_plugin.js +1 -0
  234. data/lib/public/admin/tiny_mce/plugins/wordcount/editor_plugin_src.js +114 -0
  235. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/abbr.htm +142 -0
  236. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/acronym.htm +142 -0
  237. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/attributes.htm +149 -0
  238. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/cite.htm +142 -0
  239. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/css/attributes.css +11 -0
  240. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/css/popup.css +9 -0
  241. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/del.htm +162 -0
  242. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/editor_plugin.js +1 -0
  243. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/editor_plugin_src.js +132 -0
  244. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/ins.htm +162 -0
  245. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/js/abbr.js +28 -0
  246. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/js/acronym.js +28 -0
  247. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/js/attributes.js +111 -0
  248. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/js/cite.js +28 -0
  249. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/js/del.js +53 -0
  250. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/js/element_common.js +229 -0
  251. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/js/ins.js +53 -0
  252. data/lib/public/admin/tiny_mce/plugins/xhtmlxtras/langs/en_dlg.js +32 -0
  253. data/lib/public/admin/tiny_mce/themes/advanced/about.htm +52 -0
  254. data/lib/public/admin/tiny_mce/themes/advanced/anchor.htm +26 -0
  255. data/lib/public/admin/tiny_mce/themes/advanced/charmap.htm +51 -0
  256. data/lib/public/admin/tiny_mce/themes/advanced/color_picker.htm +74 -0
  257. data/lib/public/admin/tiny_mce/themes/advanced/editor_template.js +1 -0
  258. data/lib/public/admin/tiny_mce/themes/advanced/editor_template_src.js +1358 -0
  259. data/lib/public/admin/tiny_mce/themes/advanced/image.htm +80 -0
  260. data/lib/public/admin/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
  261. data/lib/public/admin/tiny_mce/themes/advanced/img/flash.gif +0 -0
  262. data/lib/public/admin/tiny_mce/themes/advanced/img/icons.gif +0 -0
  263. data/lib/public/admin/tiny_mce/themes/advanced/img/iframe.gif +0 -0
  264. data/lib/public/admin/tiny_mce/themes/advanced/img/pagebreak.gif +0 -0
  265. data/lib/public/admin/tiny_mce/themes/advanced/img/quicktime.gif +0 -0
  266. data/lib/public/admin/tiny_mce/themes/advanced/img/realmedia.gif +0 -0
  267. data/lib/public/admin/tiny_mce/themes/advanced/img/shockwave.gif +0 -0
  268. data/lib/public/admin/tiny_mce/themes/advanced/img/trans.gif +0 -0
  269. data/lib/public/admin/tiny_mce/themes/advanced/img/video.gif +0 -0
  270. data/lib/public/admin/tiny_mce/themes/advanced/img/windowsmedia.gif +0 -0
  271. data/lib/public/admin/tiny_mce/themes/advanced/js/about.js +73 -0
  272. data/lib/public/admin/tiny_mce/themes/advanced/js/anchor.js +42 -0
  273. data/lib/public/admin/tiny_mce/themes/advanced/js/charmap.js +355 -0
  274. data/lib/public/admin/tiny_mce/themes/advanced/js/color_picker.js +329 -0
  275. data/lib/public/admin/tiny_mce/themes/advanced/js/image.js +247 -0
  276. data/lib/public/admin/tiny_mce/themes/advanced/js/link.js +153 -0
  277. data/lib/public/admin/tiny_mce/themes/advanced/js/source_editor.js +56 -0
  278. data/lib/public/admin/tiny_mce/themes/advanced/langs/en.js +68 -0
  279. data/lib/public/admin/tiny_mce/themes/advanced/langs/en_dlg.js +54 -0
  280. data/lib/public/admin/tiny_mce/themes/advanced/link.htm +57 -0
  281. data/lib/public/admin/tiny_mce/themes/advanced/shortcuts.htm +47 -0
  282. data/lib/public/admin/tiny_mce/themes/advanced/skins/default/content.css +48 -0
  283. data/lib/public/admin/tiny_mce/themes/advanced/skins/default/dialog.css +117 -0
  284. data/lib/public/admin/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
  285. data/lib/public/admin/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
  286. data/lib/public/admin/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
  287. data/lib/public/admin/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
  288. data/lib/public/admin/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
  289. data/lib/public/admin/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
  290. data/lib/public/admin/tiny_mce/themes/advanced/skins/default/ui.css +214 -0
  291. data/lib/public/admin/tiny_mce/themes/advanced/skins/highcontrast/content.css +23 -0
  292. data/lib/public/admin/tiny_mce/themes/advanced/skins/highcontrast/dialog.css +105 -0
  293. data/lib/public/admin/tiny_mce/themes/advanced/skins/highcontrast/ui.css +102 -0
  294. data/lib/public/admin/tiny_mce/themes/advanced/skins/o2k7/content.css +47 -0
  295. data/lib/public/admin/tiny_mce/themes/advanced/skins/o2k7/dialog.css +117 -0
  296. data/lib/public/admin/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
  297. data/lib/public/admin/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
  298. data/lib/public/admin/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
  299. data/lib/public/admin/tiny_mce/themes/advanced/skins/o2k7/ui.css +217 -0
  300. data/lib/public/admin/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +8 -0
  301. data/lib/public/admin/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +5 -0
  302. data/lib/public/admin/tiny_mce/themes/advanced/source_editor.htm +25 -0
  303. data/lib/public/admin/tiny_mce/themes/simple/editor_template.js +1 -0
  304. data/lib/public/admin/tiny_mce/themes/simple/editor_template_src.js +84 -0
  305. data/lib/public/admin/tiny_mce/themes/simple/img/icons.gif +0 -0
  306. data/lib/public/admin/tiny_mce/themes/simple/langs/en.js +11 -0
  307. data/lib/public/admin/tiny_mce/themes/simple/skins/default/content.css +25 -0
  308. data/lib/public/admin/tiny_mce/themes/simple/skins/default/ui.css +32 -0
  309. data/lib/public/admin/tiny_mce/themes/simple/skins/o2k7/content.css +17 -0
  310. data/lib/public/admin/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
  311. data/lib/public/admin/tiny_mce/themes/simple/skins/o2k7/ui.css +35 -0
  312. data/lib/public/admin/tiny_mce/tiny_mce.js +1 -0
  313. data/lib/public/admin/tiny_mce/tiny_mce_popup.js +5 -0
  314. data/lib/public/admin/tiny_mce/tiny_mce_src.js +15519 -0
  315. data/lib/public/admin/tiny_mce/utils/editable_selects.js +70 -0
  316. data/lib/public/admin/tiny_mce/utils/form_utils.js +210 -0
  317. data/lib/public/admin/tiny_mce/utils/mctabs.js +162 -0
  318. data/lib/public/admin/tiny_mce/utils/validate.js +252 -0
  319. data/lib/yodel_admin.rb +3 -0
  320. data/yodel_admin.gemspec +22 -0
  321. metadata +365 -0
@@ -0,0 +1,822 @@
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 rootAttributes = tinymce.explode('id,name,width,height,style,align,class,hspace,vspace,bgcolor,type'), excludedAttrs = tinymce.makeMap(rootAttributes.join(',')), Node = tinymce.html.Node,
13
+ mediaTypes, scriptRegExp, JSON = tinymce.util.JSON, mimeTypes;
14
+
15
+ // Media types supported by this plugin
16
+ mediaTypes = [
17
+ // Type, clsid:s, mime types, codebase
18
+ ["Flash", "d27cdb6e-ae6d-11cf-96b8-444553540000", "application/x-shockwave-flash", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],
19
+ ["ShockWave", "166b1bca-3f9c-11cf-8075-444553540000", "application/x-director", "http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=8,5,1,0"],
20
+ ["WindowsMedia", "6bf52a52-394a-11d3-b153-00c04f79faa6,22d6f312-b0f6-11d0-94ab-0080c74c7e95,05589fa1-c356-11ce-bf01-00aa0055595a", "application/x-mplayer2", "http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"],
21
+ ["QuickTime", "02bf25d5-8c17-4b23-bc80-d3488abddc6b", "video/quicktime", "http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"],
22
+ ["RealMedia", "cfcdaa03-8be4-11cf-b84b-0020afbbccfa", "audio/x-pn-realaudio-plugin", "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"],
23
+ ["Java", "8ad9c840-044e-11d1-b3e9-00805f499d93", "application/x-java-applet", "http://java.sun.com/products/plugin/autodl/jinstall-1_5_0-windows-i586.cab#Version=1,5,0,0"],
24
+ ["Silverlight", "dfeaf541-f3e1-4c24-acac-99c30715084a", "application/x-silverlight-2"],
25
+ ["Iframe"],
26
+ ["Video"],
27
+ ["Audio"]
28
+ ];
29
+
30
+ function toArray(obj) {
31
+ var undef, out, i;
32
+
33
+ if (obj && !obj.splice) {
34
+ out = [];
35
+
36
+ for (i = 0; true; i++) {
37
+ if (obj[i])
38
+ out[i] = obj[i];
39
+ else
40
+ break;
41
+ }
42
+
43
+ return out;
44
+ }
45
+
46
+ return obj;
47
+ };
48
+
49
+ tinymce.create('tinymce.plugins.MediaPlugin', {
50
+ init : function(ed, url) {
51
+ var self = this, lookup = {}, i, y, item, name;
52
+
53
+ function isMediaImg(node) {
54
+ return node && node.nodeName === 'IMG' && ed.dom.hasClass(node, 'mceItemMedia');
55
+ };
56
+
57
+ self.editor = ed;
58
+ self.url = url;
59
+
60
+ // Parse media types into a lookup table
61
+ scriptRegExp = '';
62
+ for (i = 0; i < mediaTypes.length; i++) {
63
+ name = mediaTypes[i][0];
64
+
65
+ item = {
66
+ name : name,
67
+ clsids : tinymce.explode(mediaTypes[i][1] || ''),
68
+ mimes : tinymce.explode(mediaTypes[i][2] || ''),
69
+ codebase : mediaTypes[i][3]
70
+ };
71
+
72
+ for (y = 0; y < item.clsids.length; y++)
73
+ lookup['clsid:' + item.clsids[y]] = item;
74
+
75
+ for (y = 0; y < item.mimes.length; y++)
76
+ lookup[item.mimes[y]] = item;
77
+
78
+ lookup['mceItem' + name] = item;
79
+ lookup[name.toLowerCase()] = item;
80
+
81
+ scriptRegExp += (scriptRegExp ? '|' : '') + name;
82
+ }
83
+
84
+ // Handle the media_types setting
85
+ tinymce.each(ed.getParam("media_types",
86
+ "video=mp4,m4v,ogv,webm;" +
87
+ "silverlight=xap;" +
88
+ "flash=swf,flv;" +
89
+ "shockwave=dcr;" +
90
+ "quicktime=mov,qt,mpg,mpeg;" +
91
+ "shockwave=dcr;" +
92
+ "windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;" +
93
+ "realmedia=rm,ra,ram;" +
94
+ "java=jar;" +
95
+ "audio=mp3,ogg"
96
+ ).split(';'), function(item) {
97
+ var i, extensions, type;
98
+
99
+ item = item.split(/=/);
100
+ extensions = tinymce.explode(item[1].toLowerCase());
101
+ for (i = 0; i < extensions.length; i++) {
102
+ type = lookup[item[0].toLowerCase()];
103
+
104
+ if (type)
105
+ lookup[extensions[i]] = type;
106
+ }
107
+ });
108
+
109
+ scriptRegExp = new RegExp('write(' + scriptRegExp + ')\\(([^)]+)\\)');
110
+ self.lookup = lookup;
111
+
112
+ ed.onPreInit.add(function() {
113
+ // Allow video elements
114
+ ed.schema.addValidElements('object[id|style|width|height|classid|codebase|*],param[name|value],embed[id|style|width|height|type|src|*],video[*],audio[*],source[*]');
115
+
116
+ // Convert video elements to image placeholder
117
+ ed.parser.addNodeFilter('object,embed,video,audio,script,iframe', function(nodes) {
118
+ var i = nodes.length;
119
+
120
+ while (i--)
121
+ self.objectToImg(nodes[i]);
122
+ });
123
+
124
+ // Convert image placeholders to video elements
125
+ ed.serializer.addNodeFilter('img', function(nodes, name, args) {
126
+ var i = nodes.length, node;
127
+
128
+ while (i--) {
129
+ node = nodes[i];
130
+ if ((node.attr('class') || '').indexOf('mceItemMedia') !== -1)
131
+ self.imgToObject(node, args);
132
+ }
133
+ });
134
+ });
135
+
136
+ ed.onInit.add(function() {
137
+ // Display "media" instead of "img" in element path
138
+ if (ed.theme && ed.theme.onResolveName) {
139
+ ed.theme.onResolveName.add(function(theme, path_object) {
140
+ if (path_object.name === 'img' && ed.dom.hasClass(path_object.node, 'mceItemMedia'))
141
+ path_object.name = 'media';
142
+ });
143
+ }
144
+
145
+ // Add contect menu if it's loaded
146
+ if (ed && ed.plugins.contextmenu) {
147
+ ed.plugins.contextmenu.onContextMenu.add(function(plugin, menu, element) {
148
+ if (element.nodeName === 'IMG' && element.className.indexOf('mceItemMedia') !== -1)
149
+ menu.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'});
150
+ });
151
+ }
152
+ });
153
+
154
+ // Register commands
155
+ ed.addCommand('mceMedia', function() {
156
+ var data, img;
157
+
158
+ img = ed.selection.getNode();
159
+ if (isMediaImg(img)) {
160
+ data = ed.dom.getAttrib(img, 'data-mce-json');
161
+ if (data) {
162
+ data = JSON.parse(data);
163
+
164
+ // Add some extra properties to the data object
165
+ tinymce.each(rootAttributes, function(name) {
166
+ var value = ed.dom.getAttrib(img, name);
167
+
168
+ if (value)
169
+ data[name] = value;
170
+ });
171
+
172
+ data.type = self.getType(img.className).name.toLowerCase();
173
+ }
174
+ }
175
+
176
+ if (!data) {
177
+ data = {
178
+ type : 'flash',
179
+ video: {sources:[]},
180
+ params: {}
181
+ };
182
+ }
183
+
184
+ ed.windowManager.open({
185
+ file : url + '/media.htm',
186
+ width : 430 + parseInt(ed.getLang('media.delta_width', 0)),
187
+ height : 500 + parseInt(ed.getLang('media.delta_height', 0)),
188
+ inline : 1
189
+ }, {
190
+ plugin_url : url,
191
+ data : data
192
+ });
193
+ });
194
+
195
+ // Register buttons
196
+ ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'});
197
+
198
+ // Update media selection status
199
+ ed.onNodeChange.add(function(ed, cm, node) {
200
+ cm.setActive('media', isMediaImg(node));
201
+ });
202
+ },
203
+
204
+ convertUrl : function(url, force_absolute) {
205
+ var self = this, editor = self.editor, settings = editor.settings,
206
+ urlConverter = settings.url_converter,
207
+ urlConverterScope = settings.url_converter_scope || self;
208
+
209
+ if (!url)
210
+ return url;
211
+
212
+ if (force_absolute)
213
+ return editor.documentBaseURI.toAbsolute(url);
214
+
215
+ return urlConverter.call(urlConverterScope, url, 'src', 'object');
216
+ },
217
+
218
+ getInfo : function() {
219
+ return {
220
+ longname : 'Media',
221
+ author : 'Moxiecode Systems AB',
222
+ authorurl : 'http://tinymce.moxiecode.com',
223
+ infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',
224
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
225
+ };
226
+ },
227
+
228
+ /**
229
+ * Converts the JSON data object to an img node.
230
+ */
231
+ dataToImg : function(data, force_absolute) {
232
+ var self = this, editor = self.editor, baseUri = editor.documentBaseURI, sources, attrs, img, i;
233
+
234
+ data.params.src = self.convertUrl(data.params.src, force_absolute);
235
+
236
+ attrs = data.video.attrs;
237
+ if (attrs)
238
+ attrs.src = self.convertUrl(attrs.src, force_absolute);
239
+
240
+ if (attrs)
241
+ attrs.poster = self.convertUrl(attrs.poster, force_absolute);
242
+
243
+ sources = toArray(data.video.sources);
244
+ if (sources) {
245
+ for (i = 0; i < sources.length; i++)
246
+ sources[i].src = self.convertUrl(sources[i].src, force_absolute);
247
+ }
248
+
249
+ img = self.editor.dom.create('img', {
250
+ id : data.id,
251
+ style : data.style,
252
+ align : data.align,
253
+ src : self.editor.theme.url + '/img/trans.gif',
254
+ 'class' : 'mceItemMedia mceItem' + self.getType(data.type).name,
255
+ 'data-mce-json' : JSON.serialize(data, "'")
256
+ });
257
+
258
+ img.width = data.width || (data.type == 'audio' ? "300" : "320");
259
+ img.height = data.height || (data.type == 'audio' ? "32" : "240");
260
+
261
+ return img;
262
+ },
263
+
264
+ /**
265
+ * Converts the JSON data object to a HTML string.
266
+ */
267
+ dataToHtml : function(data, force_absolute) {
268
+ return this.editor.serializer.serialize(this.dataToImg(data, force_absolute), {forced_root_block : '', force_absolute : force_absolute});
269
+ },
270
+
271
+ /**
272
+ * Converts the JSON data object to a HTML string.
273
+ */
274
+ htmlToData : function(html) {
275
+ var fragment, img, data;
276
+
277
+ data = {
278
+ type : 'flash',
279
+ video: {sources:[]},
280
+ params: {}
281
+ };
282
+
283
+ fragment = this.editor.parser.parse(html);
284
+ img = fragment.getAll('img')[0];
285
+
286
+ if (img) {
287
+ data = JSON.parse(img.attr('data-mce-json'));
288
+ data.type = this.getType(img.attr('class')).name.toLowerCase();
289
+
290
+ // Add some extra properties to the data object
291
+ tinymce.each(rootAttributes, function(name) {
292
+ var value = img.attr(name);
293
+
294
+ if (value)
295
+ data[name] = value;
296
+ });
297
+ }
298
+
299
+ return data;
300
+ },
301
+
302
+ /**
303
+ * Get type item by extension, class, clsid or mime type.
304
+ *
305
+ * @method getType
306
+ * @param {String} value Value to get type item by.
307
+ * @return {Object} Type item object or undefined.
308
+ */
309
+ getType : function(value) {
310
+ var i, values, typeItem;
311
+
312
+ // Find type by checking the classes
313
+ values = tinymce.explode(value, ' ');
314
+ for (i = 0; i < values.length; i++) {
315
+ typeItem = this.lookup[values[i]];
316
+
317
+ if (typeItem)
318
+ return typeItem;
319
+ }
320
+ },
321
+
322
+ /**
323
+ * Converts a tinymce.html.Node image element to video/object/embed.
324
+ */
325
+ imgToObject : function(node, args) {
326
+ var self = this, editor = self.editor, video, object, embed, iframe, name, value, data,
327
+ source, sources, params, param, typeItem, i, item, mp4Source, replacement,
328
+ posterSrc, style, audio;
329
+
330
+ // Adds the flash player
331
+ function addPlayer(video_src, poster_src) {
332
+ var baseUri, flashVars, flashVarsOutput, params, flashPlayer;
333
+
334
+ flashPlayer = editor.getParam('flash_video_player_url', self.convertUrl(self.url + '/moxieplayer.swf'));
335
+ if (flashPlayer) {
336
+ baseUri = editor.documentBaseURI;
337
+ data.params.src = flashPlayer;
338
+
339
+ // Convert the movie url to absolute urls
340
+ if (editor.getParam('flash_video_player_absvideourl', true)) {
341
+ video_src = baseUri.toAbsolute(video_src || '', true);
342
+ poster_src = baseUri.toAbsolute(poster_src || '', true);
343
+ }
344
+
345
+ // Generate flash vars
346
+ flashVarsOutput = '';
347
+ flashVars = editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'});
348
+ tinymce.each(flashVars, function(value, name) {
349
+ // Replace $url and $poster variables in flashvars value
350
+ value = value.replace(/\$url/, video_src || '');
351
+ value = value.replace(/\$poster/, poster_src || '');
352
+
353
+ if (value.length > 0)
354
+ flashVarsOutput += (flashVarsOutput ? '&' : '') + name + '=' + escape(value);
355
+ });
356
+
357
+ if (flashVarsOutput.length)
358
+ data.params.flashvars = flashVarsOutput;
359
+
360
+ params = editor.getParam('flash_video_player_params', {
361
+ allowfullscreen: true,
362
+ allowscriptaccess: true
363
+ });
364
+
365
+ tinymce.each(params, function(value, name) {
366
+ data.params[name] = "" + value;
367
+ });
368
+ }
369
+ };
370
+
371
+ data = node.attr('data-mce-json');
372
+ if (!data)
373
+ return;
374
+
375
+ data = JSON.parse(data);
376
+ typeItem = this.getType(node.attr('class'));
377
+
378
+ style = node.attr('data-mce-style')
379
+ if (!style) {
380
+ style = node.attr('style');
381
+
382
+ if (style)
383
+ style = editor.dom.serializeStyle(editor.dom.parseStyle(style, 'img'));
384
+ }
385
+
386
+ // Handle iframe
387
+ if (typeItem.name === 'Iframe') {
388
+ replacement = new Node('iframe', 1);
389
+
390
+ tinymce.each(rootAttributes, function(name) {
391
+ var value = node.attr(name);
392
+
393
+ if (name == 'class' && value)
394
+ value = value.replace(/mceItem.+ ?/g, '');
395
+
396
+ if (value && value.length > 0)
397
+ replacement.attr(name, value);
398
+ });
399
+
400
+ for (name in data.params)
401
+ replacement.attr(name, data.params[name]);
402
+
403
+ replacement.attr({
404
+ style: style,
405
+ src: data.params.src
406
+ });
407
+
408
+ node.replace(replacement);
409
+
410
+ return;
411
+ }
412
+
413
+ // Handle scripts
414
+ if (this.editor.settings.media_use_script) {
415
+ replacement = new Node('script', 1).attr('type', 'text/javascript');
416
+
417
+ value = new Node('#text', 3);
418
+ value.value = 'write' + typeItem.name + '(' + JSON.serialize(tinymce.extend(data.params, {
419
+ width: node.attr('width'),
420
+ height: node.attr('height')
421
+ })) + ');';
422
+
423
+ replacement.append(value);
424
+ node.replace(replacement);
425
+
426
+ return;
427
+ }
428
+
429
+ // Add HTML5 video element
430
+ if (typeItem.name === 'Video' && data.video.sources[0]) {
431
+ // Create new object element
432
+ video = new Node('video', 1).attr(tinymce.extend({
433
+ id : node.attr('id'),
434
+ width: node.attr('width'),
435
+ height: node.attr('height'),
436
+ style : style
437
+ }, data.video.attrs));
438
+
439
+ // Get poster source and use that for flash fallback
440
+ if (data.video.attrs)
441
+ posterSrc = data.video.attrs.poster;
442
+
443
+ sources = data.video.sources = toArray(data.video.sources);
444
+ for (i = 0; i < sources.length; i++) {
445
+ if (/\.mp4$/.test(sources[i].src))
446
+ mp4Source = sources[i].src;
447
+ }
448
+
449
+ if (!sources[0].type) {
450
+ video.attr('src', sources[0].src);
451
+ sources.splice(0, 1);
452
+ }
453
+
454
+ for (i = 0; i < sources.length; i++) {
455
+ source = new Node('source', 1).attr(sources[i]);
456
+ source.shortEnded = true;
457
+ video.append(source);
458
+ }
459
+
460
+ // Create flash fallback for video if we have a mp4 source
461
+ if (mp4Source) {
462
+ addPlayer(mp4Source, posterSrc);
463
+ typeItem = self.getType('flash');
464
+ } else
465
+ data.params.src = '';
466
+ }
467
+
468
+ // Add HTML5 audio element
469
+ if (typeItem.name === 'Audio' && data.video.sources[0]) {
470
+ // Create new object element
471
+ audio = new Node('audio', 1).attr(tinymce.extend({
472
+ id : node.attr('id'),
473
+ width: node.attr('width'),
474
+ height: node.attr('height'),
475
+ style : style
476
+ }, data.video.attrs));
477
+
478
+ // Get poster source and use that for flash fallback
479
+ if (data.video.attrs)
480
+ posterSrc = data.video.attrs.poster;
481
+
482
+ sources = data.video.sources = toArray(data.video.sources);
483
+ if (!sources[0].type) {
484
+ audio.attr('src', sources[0].src);
485
+ sources.splice(0, 1);
486
+ }
487
+
488
+ for (i = 0; i < sources.length; i++) {
489
+ source = new Node('source', 1).attr(sources[i]);
490
+ source.shortEnded = true;
491
+ audio.append(source);
492
+ }
493
+
494
+ data.params.src = '';
495
+ }
496
+
497
+ // Do we have a params src then we can generate object
498
+ if (data.params.src) {
499
+ // Is flv movie add player for it
500
+ if (/\.flv$/i.test(data.params.src))
501
+ addPlayer(data.params.src, '');
502
+
503
+ if (args && args.force_absolute)
504
+ data.params.src = editor.documentBaseURI.toAbsolute(data.params.src);
505
+
506
+ // Create new object element
507
+ object = new Node('object', 1).attr({
508
+ id : node.attr('id'),
509
+ width: node.attr('width'),
510
+ height: node.attr('height'),
511
+ style : style
512
+ });
513
+
514
+ tinymce.each(rootAttributes, function(name) {
515
+ if (data[name] && name != 'type')
516
+ object.attr(name, data[name]);
517
+ });
518
+
519
+ // Add params
520
+ for (name in data.params) {
521
+ param = new Node('param', 1);
522
+ param.shortEnded = true;
523
+ value = data.params[name];
524
+
525
+ // Windows media needs to use url instead of src for the media URL
526
+ if (name === 'src' && typeItem.name === 'WindowsMedia')
527
+ name = 'url';
528
+
529
+ param.attr({name: name, value: value});
530
+ object.append(param);
531
+ }
532
+
533
+ // Setup add type and classid if strict is disabled
534
+ if (this.editor.getParam('media_strict', true)) {
535
+ object.attr({
536
+ data: data.params.src,
537
+ type: typeItem.mimes[0]
538
+ });
539
+ } else {
540
+ object.attr({
541
+ classid: "clsid:" + typeItem.clsids[0],
542
+ codebase: typeItem.codebase
543
+ });
544
+
545
+ embed = new Node('embed', 1);
546
+ embed.shortEnded = true;
547
+ embed.attr({
548
+ id: node.attr('id'),
549
+ width: node.attr('width'),
550
+ height: node.attr('height'),
551
+ style : style,
552
+ type: typeItem.mimes[0]
553
+ });
554
+
555
+ for (name in data.params)
556
+ embed.attr(name, data.params[name]);
557
+
558
+ tinymce.each(rootAttributes, function(name) {
559
+ if (data[name] && name != 'type')
560
+ embed.attr(name, data[name]);
561
+ });
562
+
563
+ object.append(embed);
564
+ }
565
+
566
+ // Insert raw HTML
567
+ if (data.object_html) {
568
+ value = new Node('#text', 3);
569
+ value.raw = true;
570
+ value.value = data.object_html;
571
+ object.append(value);
572
+ }
573
+
574
+ // Append object to video element if it exists
575
+ if (video)
576
+ video.append(object);
577
+ }
578
+
579
+ if (video) {
580
+ // Insert raw HTML
581
+ if (data.video_html) {
582
+ value = new Node('#text', 3);
583
+ value.raw = true;
584
+ value.value = data.video_html;
585
+ video.append(value);
586
+ }
587
+ }
588
+
589
+ if (audio) {
590
+ // Insert raw HTML
591
+ if (data.video_html) {
592
+ value = new Node('#text', 3);
593
+ value.raw = true;
594
+ value.value = data.video_html;
595
+ audio.append(value);
596
+ }
597
+ }
598
+
599
+ if (video || audio || object)
600
+ node.replace(video || audio || object);
601
+ else
602
+ node.remove();
603
+ },
604
+
605
+ /**
606
+ * Converts a tinymce.html.Node video/object/embed to an img element.
607
+ *
608
+ * The video/object/embed will be converted into an image placeholder with a JSON data attribute like this:
609
+ * <img class="mceItemMedia mceItemFlash" width="100" height="100" data-mce-json="{..}" />
610
+ *
611
+ * The JSON structure will be like this:
612
+ * {'params':{'flashvars':'something','quality':'high','src':'someurl'}, 'video':{'sources':[{src: 'someurl', type: 'video/mp4'}]}}
613
+ */
614
+ objectToImg : function(node) {
615
+ var object, embed, video, iframe, img, name, id, width, height, style, i, html,
616
+ param, params, source, sources, data, type, lookup = this.lookup,
617
+ matches, attrs, urlConverter = this.editor.settings.url_converter,
618
+ urlConverterScope = this.editor.settings.url_converter_scope;
619
+
620
+ function getInnerHTML(node) {
621
+ return new tinymce.html.Serializer({
622
+ inner: true,
623
+ validate: false
624
+ }).serialize(node);
625
+ };
626
+
627
+ // If node isn't in document
628
+ if (!node.parent)
629
+ return;
630
+
631
+ // Handle media scripts
632
+ if (node.name === 'script') {
633
+ if (node.firstChild)
634
+ matches = scriptRegExp.exec(node.firstChild.value);
635
+
636
+ if (!matches)
637
+ return;
638
+
639
+ type = matches[1];
640
+ data = {video : {}, params : JSON.parse(matches[2])};
641
+ width = data.params.width;
642
+ height = data.params.height;
643
+ }
644
+
645
+ // Setup data objects
646
+ data = data || {
647
+ video : {},
648
+ params : {}
649
+ };
650
+
651
+ // Setup new image object
652
+ img = new Node('img', 1);
653
+ img.attr({
654
+ src : this.editor.theme.url + '/img/trans.gif'
655
+ });
656
+
657
+ // Video element
658
+ name = node.name;
659
+ if (name === 'video' || name == 'audio') {
660
+ video = node;
661
+ object = node.getAll('object')[0];
662
+ embed = node.getAll('embed')[0];
663
+ width = video.attr('width');
664
+ height = video.attr('height');
665
+ id = video.attr('id');
666
+ data.video = {attrs : {}, sources : []};
667
+
668
+ // Get all video attributes
669
+ attrs = data.video.attrs;
670
+ for (name in video.attributes.map)
671
+ attrs[name] = video.attributes.map[name];
672
+
673
+ source = node.attr('src');
674
+ if (source)
675
+ data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', node.name)});
676
+
677
+ // Get all sources
678
+ sources = video.getAll("source");
679
+ for (i = 0; i < sources.length; i++) {
680
+ source = sources[i].remove();
681
+
682
+ data.video.sources.push({
683
+ src: urlConverter.call(urlConverterScope, source.attr('src'), 'src', 'source'),
684
+ type: source.attr('type'),
685
+ media: source.attr('media')
686
+ });
687
+ }
688
+
689
+ // Convert the poster URL
690
+ if (attrs.poster)
691
+ attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', node.name);
692
+ }
693
+
694
+ // Object element
695
+ if (node.name === 'object') {
696
+ object = node;
697
+ embed = node.getAll('embed')[0];
698
+ }
699
+
700
+ // Embed element
701
+ if (node.name === 'embed')
702
+ embed = node;
703
+
704
+ // Iframe element
705
+ if (node.name === 'iframe') {
706
+ iframe = node;
707
+ type = 'Iframe';
708
+ }
709
+
710
+ if (object) {
711
+ // Get width/height
712
+ width = width || object.attr('width');
713
+ height = height || object.attr('height');
714
+ style = style || object.attr('style');
715
+ id = id || object.attr('id');
716
+
717
+ // Get all object params
718
+ params = object.getAll("param");
719
+ for (i = 0; i < params.length; i++) {
720
+ param = params[i];
721
+ name = param.remove().attr('name');
722
+
723
+ if (!excludedAttrs[name])
724
+ data.params[name] = param.attr('value');
725
+ }
726
+
727
+ data.params.src = data.params.src || object.attr('data');
728
+ }
729
+
730
+ if (embed) {
731
+ // Get width/height
732
+ width = width || embed.attr('width');
733
+ height = height || embed.attr('height');
734
+ style = style || embed.attr('style');
735
+ id = id || embed.attr('id');
736
+
737
+ // Get all embed attributes
738
+ for (name in embed.attributes.map) {
739
+ if (!excludedAttrs[name] && !data.params[name])
740
+ data.params[name] = embed.attributes.map[name];
741
+ }
742
+ }
743
+
744
+ if (iframe) {
745
+ // Get width/height
746
+ width = iframe.attr('width');
747
+ height = iframe.attr('height');
748
+ style = style || iframe.attr('style');
749
+ id = iframe.attr('id');
750
+
751
+ tinymce.each(rootAttributes, function(name) {
752
+ img.attr(name, iframe.attr(name));
753
+ });
754
+
755
+ // Get all iframe attributes
756
+ for (name in iframe.attributes.map) {
757
+ if (!excludedAttrs[name] && !data.params[name])
758
+ data.params[name] = iframe.attributes.map[name];
759
+ }
760
+ }
761
+
762
+ // Use src not movie
763
+ if (data.params.movie) {
764
+ data.params.src = data.params.src || data.params.movie;
765
+ delete data.params.movie;
766
+ }
767
+
768
+ // Convert the URL to relative/absolute depending on configuration
769
+ if (data.params.src)
770
+ data.params.src = urlConverter.call(urlConverterScope, data.params.src, 'src', 'object');
771
+
772
+ if (video) {
773
+ if (node.name === 'video')
774
+ type = lookup.video.name;
775
+ else if (node.name === 'audio')
776
+ type = lookup.audio.name;
777
+ }
778
+
779
+ if (object && !type)
780
+ type = (lookup[(object.attr('clsid') || '').toLowerCase()] || lookup[(object.attr('type') || '').toLowerCase()] || {}).name;
781
+
782
+ if (embed && !type)
783
+ type = (lookup[(embed.attr('type') || '').toLowerCase()] || {}).name;
784
+
785
+ // Replace the video/object/embed element with a placeholder image containing the data
786
+ node.replace(img);
787
+
788
+ // Remove embed
789
+ if (embed)
790
+ embed.remove();
791
+
792
+ // Serialize the inner HTML of the object element
793
+ if (object) {
794
+ html = getInnerHTML(object.remove());
795
+
796
+ if (html)
797
+ data.object_html = html;
798
+ }
799
+
800
+ // Serialize the inner HTML of the video element
801
+ if (video) {
802
+ html = getInnerHTML(video.remove());
803
+
804
+ if (html)
805
+ data.video_html = html;
806
+ }
807
+
808
+ // Set width/height of placeholder
809
+ img.attr({
810
+ id : id,
811
+ 'class' : 'mceItemMedia mceItem' + (type || 'Flash'),
812
+ style : style,
813
+ width : width || (node.name == 'audio' ? "300" : "320"),
814
+ height : height || (node.name == 'audio' ? "32" : "240"),
815
+ "data-mce-json" : JSON.serialize(data, "'")
816
+ });
817
+ }
818
+ });
819
+
820
+ // Register plugin
821
+ tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin);
822
+ })();