tb_core 1.1.10 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (259) hide show
  1. checksums.yaml +6 -14
  2. data/README.md +50 -2
  3. data/app/assets/javascripts/admin/core/application.js +2 -2
  4. data/app/assets/javascripts/admin/core/editor.js +1 -0
  5. data/app/assets/javascripts/admin/core/preinit.js +1 -1
  6. data/app/assets/javascripts/admin/core/split_pane.js +4 -0
  7. data/app/assets/javascripts/admin/core/users.js +59 -12
  8. data/app/assets/libs/bootstrap/css/{bootstrap.css → bootstrap.css.scss} +11 -11
  9. data/app/assets/libs/{tiny_mce → tinymce}/plugins/tableDropdown/editor_plugin.js +0 -0
  10. data/app/controllers/admin/application_controller.rb +0 -1
  11. data/app/controllers/admin/roles_controller.rb +10 -4
  12. data/app/controllers/admin/settings_controller.rb +10 -2
  13. data/app/controllers/admin/setup_controller.rb +7 -1
  14. data/app/controllers/admin/users_controller.rb +8 -2
  15. data/app/controllers/sitemaps_controller.rb +0 -1
  16. data/app/controllers/spud/application_controller.rb +9 -2
  17. data/app/helpers/spud/application_helper.rb +21 -0
  18. data/app/models/spud/spud_user_model.rb +79 -0
  19. data/app/models/spud_role.rb +0 -1
  20. data/app/models/spud_role_permission.rb +0 -1
  21. data/app/models/spud_user.rb +2 -80
  22. data/app/views/admin/roles/index.html.erb +4 -2
  23. data/app/views/admin/users/_form.html.erb +3 -0
  24. data/app/views/admin/users/_form_additions.html.erb +1 -0
  25. data/app/views/admin/users/_show_additions.html.erb +1 -0
  26. data/app/views/admin/users/show.html.erb +1 -0
  27. data/config/routes.rb +3 -3
  28. data/lib/generators/spud/module_generator.rb +5 -1
  29. data/lib/generators/spud/templates/admin_controller.rb.erb +6 -2
  30. data/lib/generators/spud/templates/views/admin/index.html.erb +5 -7
  31. data/lib/spud_core/engine.rb +2 -24
  32. data/lib/spud_core/version.rb +1 -1
  33. data/spec/controllers/admin/settings_controller_spec.rb +2 -2
  34. data/spec/controllers/sitemap_controllers_spec.rb +4 -3
  35. data/spec/dummy/config/application.rb +1 -0
  36. data/spec/dummy/config/environments/test.rb +9 -2
  37. data/spec/dummy/config/initializers/secret_token.rb +1 -0
  38. data/spec/dummy/log/test.log +12429 -0
  39. data/spec/dummy/tmp/cache/assets/test/sass/05388b0d18737541b44c9082e3fa19afa6bf3826/application.css.scssc +0 -0
  40. data/spec/dummy/tmp/cache/assets/test/sass/05388b0d18737541b44c9082e3fa19afa6bf3826/login.css.scssc +0 -0
  41. data/spec/dummy/tmp/cache/assets/test/sass/05388b0d18737541b44c9082e3fa19afa6bf3826/split_pane.css.scssc +0 -0
  42. data/spec/dummy/tmp/cache/assets/test/sass/05388b0d18737541b44c9082e3fa19afa6bf3826/users.css.scssc +0 -0
  43. data/spec/dummy/tmp/cache/assets/test/sass/e99c58815a3ff18987eada90ba5c7e95383074f2/bootstrap.css.scssc +0 -0
  44. data/spec/dummy/tmp/cache/assets/test/sprockets/0075c6e170e8012f220c7ed9fb5dc88b +0 -0
  45. data/spec/dummy/tmp/cache/assets/test/sprockets/01666d6af504317dcf63364a37ce60f4 +0 -0
  46. data/spec/dummy/tmp/cache/assets/test/sprockets/03dcdc877f0257624872c73967d201c6 +0 -0
  47. data/spec/dummy/tmp/cache/assets/test/sprockets/06d52af2fa483161bb27dd39c3b34ee3 +0 -0
  48. data/spec/dummy/tmp/cache/assets/test/sprockets/098869073bd11dbc41fcaa47716a0ce7 +0 -0
  49. data/spec/dummy/tmp/cache/assets/test/sprockets/0cabf8a5146f359edd424e4f820e07f1 +0 -0
  50. data/spec/dummy/tmp/cache/assets/test/sprockets/0f971f36ba87298fbaf46154fa8a5d30 +0 -0
  51. data/spec/dummy/tmp/cache/assets/test/sprockets/13809885160329b0a1a4e7885fb75ca4 +0 -0
  52. data/spec/dummy/tmp/cache/assets/test/sprockets/16243b3ad44c2997ad70996b58c56a2a +0 -0
  53. data/spec/dummy/tmp/cache/assets/test/sprockets/169b221054fadd95f44252a232a5f053 +0 -0
  54. data/spec/dummy/tmp/cache/assets/test/sprockets/1816341e15110810c4647824cc81d1aa +0 -0
  55. data/spec/dummy/tmp/cache/assets/test/sprockets/18d440ef7bcf78056d346ac1ff2a6793 +0 -0
  56. data/spec/dummy/tmp/cache/assets/test/sprockets/1c06ad369cba88ec3ff5afc06e982d7c +0 -0
  57. data/spec/dummy/tmp/cache/assets/test/sprockets/1fa18bd231ff77b2af93913518487967 +0 -0
  58. data/spec/dummy/tmp/cache/assets/test/sprockets/21e6a044a925c5f44f5a9d9b9e2d164a +0 -0
  59. data/spec/dummy/tmp/cache/assets/test/sprockets/2393e42173c512eb5171116ee479ab7e +0 -0
  60. data/spec/dummy/tmp/cache/assets/test/sprockets/2b94b5653a1151795fb999b3e98fd1d8 +0 -0
  61. data/spec/dummy/tmp/cache/assets/test/sprockets/2fe2bffc50d1c3cd5c0a896a5528e23b +0 -0
  62. data/spec/dummy/tmp/cache/assets/test/sprockets/3024a96b82ffd6a5f68295a953231c92 +0 -0
  63. data/spec/dummy/tmp/cache/assets/test/sprockets/3123e8917685babc03cb0c8aeccac695 +0 -0
  64. data/spec/dummy/tmp/cache/assets/test/sprockets/353180d0c9fd2a3ccef3718d7e6ace6c +0 -0
  65. data/spec/dummy/tmp/cache/assets/test/sprockets/37539a535fefc75cd61aa9438d821846 +0 -0
  66. data/spec/dummy/tmp/cache/assets/test/sprockets/38eabf5ce9c4dda42d09332aee816d3e +0 -0
  67. data/spec/dummy/tmp/cache/assets/test/sprockets/39efa102c753ebe9defd90062785a8aa +0 -0
  68. data/spec/dummy/tmp/cache/assets/test/sprockets/3cc30d9fb936455c063d7a950c46bb32 +0 -0
  69. data/spec/dummy/tmp/cache/assets/test/sprockets/4546971591261f8a01d0837f5a31af35 +0 -0
  70. data/spec/dummy/tmp/cache/assets/test/sprockets/45b53d5ab2cac60703cd9d2cf52c14eb +0 -0
  71. data/spec/dummy/tmp/cache/assets/test/sprockets/49d27d2d81616b48039efe15075da4f2 +0 -0
  72. data/spec/dummy/tmp/cache/assets/test/sprockets/4a689e727abc31a4f93798253a176295 +0 -0
  73. data/spec/dummy/tmp/cache/assets/test/sprockets/55d4fc42707dc9a3400faf92bed0360a +0 -0
  74. data/spec/dummy/tmp/cache/assets/test/sprockets/5759e8cff07b97209ca7ea6a93b3ed1a +0 -0
  75. data/spec/dummy/tmp/cache/assets/test/sprockets/5c4e1741d24424c6947eaff78829d41f +0 -0
  76. data/spec/dummy/tmp/cache/assets/test/sprockets/5cdaff8b68930bd29868b3d0fcb33766 +0 -0
  77. data/spec/dummy/tmp/cache/assets/test/sprockets/5de67e95811f3524bac96ba237505ae6 +0 -0
  78. data/spec/dummy/tmp/cache/assets/test/sprockets/5fe538b2e33228dd92d36cfce50cf4b7 +0 -0
  79. data/spec/dummy/tmp/cache/assets/test/sprockets/6671fad14ea054e577e2dfbcd98e571c +0 -0
  80. data/spec/dummy/tmp/cache/assets/test/sprockets/6d7103090b0047c9b8d5746d75e8fac9 +0 -0
  81. data/spec/dummy/tmp/cache/assets/test/sprockets/705426de92785d4afa88b06757d25f7d +0 -0
  82. data/spec/dummy/tmp/cache/assets/test/sprockets/71e715ef316e725981280e9bfe9d0527 +0 -0
  83. data/spec/dummy/tmp/cache/assets/test/sprockets/7391889bc52e8664fd5d590d58a7ec8f +0 -0
  84. data/spec/dummy/tmp/cache/assets/test/sprockets/7828cb89eaa43959329e301a04ef10a6 +0 -0
  85. data/spec/dummy/tmp/cache/assets/test/sprockets/80dda53c03df39ae9ed8c2400f05990a +0 -0
  86. data/spec/dummy/tmp/cache/assets/test/sprockets/8121614a686088a7f27165baf5d63da3 +0 -0
  87. data/spec/dummy/tmp/cache/assets/test/sprockets/85af4404353b8373764b166027ce78a4 +0 -0
  88. data/spec/dummy/tmp/cache/assets/test/sprockets/85cdc3810a743722e618b949199320ec +0 -0
  89. data/spec/dummy/tmp/cache/assets/test/sprockets/88099ac9106f32ee56c2cdde301f4aeb +0 -0
  90. data/spec/dummy/tmp/cache/assets/test/sprockets/89fbb1e40182037e0eec01e0d3bab067 +0 -0
  91. data/spec/dummy/tmp/cache/assets/test/sprockets/8bb56cbae5a8a5b5f1cf04183a746966 +0 -0
  92. data/spec/dummy/tmp/cache/assets/test/sprockets/8fb7066c091dc8956fadaa0c316fb808 +0 -0
  93. data/spec/dummy/tmp/cache/assets/test/sprockets/9214ad2c4fc7c0298ec351e00379a706 +0 -0
  94. data/spec/dummy/tmp/cache/assets/test/sprockets/9313c3ae5de2dc96635bfa4e6957a149 +0 -0
  95. data/spec/dummy/tmp/cache/assets/test/sprockets/940374cda01486d892775b6f65986599 +0 -0
  96. data/spec/dummy/tmp/cache/assets/test/sprockets/966f020d24b19c1d685c51c240d1923a +0 -0
  97. data/spec/dummy/tmp/cache/assets/test/sprockets/a444109f6d82fec9d3e8224e0508abc9 +0 -0
  98. data/spec/dummy/tmp/cache/assets/test/sprockets/a4adceeb24e0e96b3cd701b06c7b53d2 +0 -0
  99. data/spec/dummy/tmp/cache/assets/test/sprockets/a4c8d8c64ed3eca5b07e3c1478b00a81 +0 -0
  100. data/spec/dummy/tmp/cache/assets/test/sprockets/a7305f76eab9ded7ce734cea8967a8ee +0 -0
  101. data/spec/dummy/tmp/cache/assets/test/sprockets/aa893fde36bb6d9e2184bba8385ce160 +0 -0
  102. data/spec/dummy/tmp/cache/assets/test/sprockets/b26e8bc7c7c32058397f892cd9d046d8 +0 -0
  103. data/spec/dummy/tmp/cache/assets/test/sprockets/b8d4b4de990b07fda478ecb232a3b76f +0 -0
  104. data/spec/dummy/tmp/cache/assets/test/sprockets/ba173160d353bfb6e1f0f284bac8b9de +0 -0
  105. data/spec/dummy/tmp/cache/assets/test/sprockets/bc750b216ba26d779bcf79fac037b36b +0 -0
  106. data/spec/dummy/tmp/cache/assets/test/sprockets/bef9d4af2f246671b5c9d21c40b49545 +0 -0
  107. data/spec/dummy/tmp/cache/assets/test/sprockets/c0eaf65fe0db1674c49ba2ae6cccb410 +0 -0
  108. data/spec/dummy/tmp/cache/assets/test/sprockets/c4fa3869fe96ebf26a17b08d5b45d5fb +0 -0
  109. data/spec/dummy/tmp/cache/assets/test/sprockets/c666b756412f64241236e1112b2e403d +0 -0
  110. data/spec/dummy/tmp/cache/assets/test/sprockets/c7301f1b1c7ee199b8b8487f43ce78c8 +0 -0
  111. data/spec/dummy/tmp/cache/assets/test/sprockets/cb96d7509d3c2b2f16d6d3a1eaac2b79 +0 -0
  112. data/spec/dummy/tmp/cache/assets/test/sprockets/d02977fa67cf6643e31bb4c063a6d205 +0 -0
  113. data/spec/dummy/tmp/cache/assets/test/sprockets/d5b4ee9436615cb36bb22b9ba87791cf +0 -0
  114. data/spec/dummy/tmp/cache/assets/test/sprockets/daec02064da70ae5def8a75a5c36e58d +0 -0
  115. data/spec/dummy/tmp/cache/assets/test/sprockets/dd32919d4bcd591d7aa6937ba4b39ddb +0 -0
  116. data/spec/dummy/tmp/cache/assets/test/sprockets/e12ec2fd151046a8235cb53a379b3151 +0 -0
  117. data/spec/dummy/tmp/cache/assets/test/sprockets/e232a62130dade197fcabdd428cf737c +0 -0
  118. data/spec/dummy/tmp/cache/assets/test/sprockets/e7d7a71fa09119e96e640cba43763911 +0 -0
  119. data/spec/dummy/tmp/cache/assets/test/sprockets/f165c137fabbacd60c1bc9fbb6878ae9 +0 -0
  120. data/spec/dummy/tmp/cache/assets/test/sprockets/f365efd4df73b42e492cd479032636ca +0 -0
  121. data/spec/dummy/tmp/cache/assets/test/sprockets/f81f473be9c249d9ff823b35ba6c7130 +0 -0
  122. data/spec/dummy/tmp/cache/assets/test/sprockets/fda81067bc547bd67ac35e1bc4a7c167 +0 -0
  123. data/spec/dummy/tmp/cache/assets/test/sprockets/fde0dc66d618f90500842b827a11d83b +0 -0
  124. data/spec/dummy/tmp/cache/assets/test/sprockets/fe35aa99166bfe64fdab2f5f5373a80d +0 -0
  125. data/spec/dummy/tmp/cache/assets/test/sprockets/ff91e57c48a0748be0394a67cd555438 +0 -0
  126. metadata +240 -182
  127. data/app/assets/libs/tiny_mce/jquery.tinymce.js +0 -1
  128. data/app/assets/libs/tiny_mce/langs/en.js +0 -1
  129. data/app/assets/libs/tiny_mce/license.txt +0 -504
  130. data/app/assets/libs/tiny_mce/plugins/advhr/css/advhr.css +0 -5
  131. data/app/assets/libs/tiny_mce/plugins/advhr/editor_plugin.js +0 -1
  132. data/app/assets/libs/tiny_mce/plugins/advhr/editor_plugin_src.js +0 -57
  133. data/app/assets/libs/tiny_mce/plugins/advhr/js/rule.js +0 -43
  134. data/app/assets/libs/tiny_mce/plugins/advhr/langs/en_dlg.js +0 -1
  135. data/app/assets/libs/tiny_mce/plugins/advhr/rule.htm +0 -58
  136. data/app/assets/libs/tiny_mce/plugins/advimage/css/advimage.css +0 -13
  137. data/app/assets/libs/tiny_mce/plugins/advimage/editor_plugin.js +0 -1
  138. data/app/assets/libs/tiny_mce/plugins/advimage/editor_plugin_src.js +0 -50
  139. data/app/assets/libs/tiny_mce/plugins/advimage/image.htm +0 -235
  140. data/app/assets/libs/tiny_mce/plugins/advimage/img/sample.gif +0 -0
  141. data/app/assets/libs/tiny_mce/plugins/advimage/js/image.js +0 -462
  142. data/app/assets/libs/tiny_mce/plugins/advimage/langs/en_dlg.js +0 -1
  143. data/app/assets/libs/tiny_mce/plugins/advlink/css/advlink.css +0 -8
  144. data/app/assets/libs/tiny_mce/plugins/advlink/editor_plugin.js +0 -1
  145. data/app/assets/libs/tiny_mce/plugins/advlink/editor_plugin_src.js +0 -61
  146. data/app/assets/libs/tiny_mce/plugins/advlink/js/advlink.js +0 -539
  147. data/app/assets/libs/tiny_mce/plugins/advlink/langs/en_dlg.js +0 -1
  148. data/app/assets/libs/tiny_mce/plugins/advlink/link.htm +0 -338
  149. data/app/assets/libs/tiny_mce/plugins/autolink/editor_plugin.js +0 -1
  150. data/app/assets/libs/tiny_mce/plugins/autolink/editor_plugin_src.js +0 -174
  151. data/app/assets/libs/tiny_mce/plugins/inlinepopups/editor_plugin.js +0 -1
  152. data/app/assets/libs/tiny_mce/plugins/inlinepopups/editor_plugin_src.js +0 -699
  153. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif +0 -0
  154. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/button.gif +0 -0
  155. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif +0 -0
  156. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif +0 -0
  157. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif +0 -0
  158. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif +0 -0
  159. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif +0 -0
  160. data/app/assets/libs/tiny_mce/plugins/inlinepopups/skins/clearlooks2/window.css +0 -90
  161. data/app/assets/libs/tiny_mce/plugins/inlinepopups/template.htm +0 -387
  162. data/app/assets/libs/tiny_mce/plugins/lists/editor_plugin.js +0 -1
  163. data/app/assets/libs/tiny_mce/plugins/lists/editor_plugin_src.js +0 -951
  164. data/app/assets/libs/tiny_mce/plugins/media/css/media.css +0 -17
  165. data/app/assets/libs/tiny_mce/plugins/media/editor_plugin.js +0 -1
  166. data/app/assets/libs/tiny_mce/plugins/media/editor_plugin_src.js +0 -890
  167. data/app/assets/libs/tiny_mce/plugins/media/js/embed.js +0 -73
  168. data/app/assets/libs/tiny_mce/plugins/media/js/media.js +0 -470
  169. data/app/assets/libs/tiny_mce/plugins/media/langs/en_dlg.js +0 -1
  170. data/app/assets/libs/tiny_mce/plugins/media/media.htm +0 -922
  171. data/app/assets/libs/tiny_mce/plugins/media/moxieplayer.swf +0 -0
  172. data/app/assets/libs/tiny_mce/plugins/paste/editor_plugin.js +0 -1
  173. data/app/assets/libs/tiny_mce/plugins/paste/editor_plugin_src.js +0 -871
  174. data/app/assets/libs/tiny_mce/plugins/paste/js/pastetext.js +0 -36
  175. data/app/assets/libs/tiny_mce/plugins/paste/js/pasteword.js +0 -51
  176. data/app/assets/libs/tiny_mce/plugins/paste/langs/en_dlg.js +0 -1
  177. data/app/assets/libs/tiny_mce/plugins/paste/pastetext.htm +0 -27
  178. data/app/assets/libs/tiny_mce/plugins/paste/pasteword.htm +0 -21
  179. data/app/assets/libs/tiny_mce/plugins/table/cell.htm +0 -180
  180. data/app/assets/libs/tiny_mce/plugins/table/css/cell.css +0 -17
  181. data/app/assets/libs/tiny_mce/plugins/table/css/row.css +0 -25
  182. data/app/assets/libs/tiny_mce/plugins/table/css/table.css +0 -13
  183. data/app/assets/libs/tiny_mce/plugins/table/editor_plugin.js +0 -1
  184. data/app/assets/libs/tiny_mce/plugins/table/editor_plugin_src.js +0 -1428
  185. data/app/assets/libs/tiny_mce/plugins/table/js/cell.js +0 -319
  186. data/app/assets/libs/tiny_mce/plugins/table/js/merge_cells.js +0 -27
  187. data/app/assets/libs/tiny_mce/plugins/table/js/row.js +0 -237
  188. data/app/assets/libs/tiny_mce/plugins/table/js/table.js +0 -489
  189. data/app/assets/libs/tiny_mce/plugins/table/langs/en_dlg.js +0 -1
  190. data/app/assets/libs/tiny_mce/plugins/table/merge_cells.htm +0 -32
  191. data/app/assets/libs/tiny_mce/plugins/table/row.htm +0 -158
  192. data/app/assets/libs/tiny_mce/plugins/table/table.htm +0 -188
  193. data/app/assets/libs/tiny_mce/themes/advanced/about.htm +0 -52
  194. data/app/assets/libs/tiny_mce/themes/advanced/anchor.htm +0 -26
  195. data/app/assets/libs/tiny_mce/themes/advanced/charmap.htm +0 -55
  196. data/app/assets/libs/tiny_mce/themes/advanced/color_picker.htm +0 -70
  197. data/app/assets/libs/tiny_mce/themes/advanced/editor_template.js +0 -1
  198. data/app/assets/libs/tiny_mce/themes/advanced/editor_template_src.js +0 -1467
  199. data/app/assets/libs/tiny_mce/themes/advanced/image.htm +0 -80
  200. data/app/assets/libs/tiny_mce/themes/advanced/img/colorpicker.jpg +0 -0
  201. data/app/assets/libs/tiny_mce/themes/advanced/img/flash.gif +0 -0
  202. data/app/assets/libs/tiny_mce/themes/advanced/img/icons.gif +0 -0
  203. data/app/assets/libs/tiny_mce/themes/advanced/img/iframe.gif +0 -0
  204. data/app/assets/libs/tiny_mce/themes/advanced/img/pagebreak.gif +0 -0
  205. data/app/assets/libs/tiny_mce/themes/advanced/img/quicktime.gif +0 -0
  206. data/app/assets/libs/tiny_mce/themes/advanced/img/realmedia.gif +0 -0
  207. data/app/assets/libs/tiny_mce/themes/advanced/img/shockwave.gif +0 -0
  208. data/app/assets/libs/tiny_mce/themes/advanced/img/trans.gif +0 -0
  209. data/app/assets/libs/tiny_mce/themes/advanced/img/video.gif +0 -0
  210. data/app/assets/libs/tiny_mce/themes/advanced/img/windowsmedia.gif +0 -0
  211. data/app/assets/libs/tiny_mce/themes/advanced/js/about.js +0 -73
  212. data/app/assets/libs/tiny_mce/themes/advanced/js/anchor.js +0 -44
  213. data/app/assets/libs/tiny_mce/themes/advanced/js/charmap.js +0 -363
  214. data/app/assets/libs/tiny_mce/themes/advanced/js/color_picker.js +0 -345
  215. data/app/assets/libs/tiny_mce/themes/advanced/js/image.js +0 -251
  216. data/app/assets/libs/tiny_mce/themes/advanced/js/link.js +0 -153
  217. data/app/assets/libs/tiny_mce/themes/advanced/js/source_editor.js +0 -78
  218. data/app/assets/libs/tiny_mce/themes/advanced/langs/en.js +0 -1
  219. data/app/assets/libs/tiny_mce/themes/advanced/langs/en_dlg.js +0 -1
  220. data/app/assets/libs/tiny_mce/themes/advanced/link.htm +0 -57
  221. data/app/assets/libs/tiny_mce/themes/advanced/shortcuts.htm +0 -47
  222. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/content.css +0 -51
  223. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/dialog.css +0 -118
  224. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/img/buttons.png +0 -0
  225. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/img/items.gif +0 -0
  226. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/img/menu_arrow.gif +0 -0
  227. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/img/menu_check.gif +0 -0
  228. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/img/progress.gif +0 -0
  229. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/img/tabs.gif +0 -0
  230. data/app/assets/libs/tiny_mce/themes/advanced/skins/default/ui.css +0 -215
  231. data/app/assets/libs/tiny_mce/themes/advanced/skins/highcontrast/content.css +0 -25
  232. data/app/assets/libs/tiny_mce/themes/advanced/skins/highcontrast/dialog.css +0 -106
  233. data/app/assets/libs/tiny_mce/themes/advanced/skins/highcontrast/ui.css +0 -102
  234. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/content.css +0 -49
  235. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/dialog.css +0 -118
  236. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/img/button_bg.png +0 -0
  237. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_black.png +0 -0
  238. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/img/button_bg_silver.png +0 -0
  239. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/ui.css +0 -218
  240. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/ui_black.css +0 -8
  241. data/app/assets/libs/tiny_mce/themes/advanced/skins/o2k7/ui_silver.css +0 -5
  242. data/app/assets/libs/tiny_mce/themes/advanced/source_editor.htm +0 -25
  243. data/app/assets/libs/tiny_mce/themes/simple/editor_template.js +0 -1
  244. data/app/assets/libs/tiny_mce/themes/simple/editor_template_src.js +0 -84
  245. data/app/assets/libs/tiny_mce/themes/simple/img/icons.gif +0 -0
  246. data/app/assets/libs/tiny_mce/themes/simple/langs/en.js +0 -1
  247. data/app/assets/libs/tiny_mce/themes/simple/skins/default/content.css +0 -25
  248. data/app/assets/libs/tiny_mce/themes/simple/skins/default/ui.css +0 -32
  249. data/app/assets/libs/tiny_mce/themes/simple/skins/o2k7/content.css +0 -17
  250. data/app/assets/libs/tiny_mce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
  251. data/app/assets/libs/tiny_mce/themes/simple/skins/o2k7/ui.css +0 -35
  252. data/app/assets/libs/tiny_mce/tiny_mce.js +0 -1
  253. data/app/assets/libs/tiny_mce/tiny_mce_popup.js +0 -5
  254. data/app/assets/libs/tiny_mce/tiny_mce_src.js +0 -16753
  255. data/app/assets/libs/tiny_mce/utils/editable_selects.js +0 -70
  256. data/app/assets/libs/tiny_mce/utils/form_utils.js +0 -210
  257. data/app/assets/libs/tiny_mce/utils/mctabs.js +0 -162
  258. data/app/assets/libs/tiny_mce/utils/validate.js +0 -252
  259. data/app/models/concerns/spud_authentication.rb +0 -10
@@ -1,890 +0,0 @@
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
- ["EmbeddedAudio"],
28
- ["Audio"]
29
- ];
30
-
31
- function toArray(obj) {
32
- var undef, out, i;
33
-
34
- if (obj && !obj.splice) {
35
- out = [];
36
-
37
- for (i = 0; true; i++) {
38
- if (obj[i])
39
- out[i] = obj[i];
40
- else
41
- break;
42
- }
43
-
44
- return out;
45
- }
46
-
47
- return obj;
48
- };
49
-
50
- tinymce.create('tinymce.plugins.MediaPlugin', {
51
- init : function(ed, url) {
52
- var self = this, lookup = {}, i, y, item, name;
53
-
54
- function isMediaImg(node) {
55
- return node && node.nodeName === 'IMG' && ed.dom.hasClass(node, 'mceItemMedia');
56
- };
57
-
58
- self.editor = ed;
59
- self.url = url;
60
-
61
- // Parse media types into a lookup table
62
- scriptRegExp = '';
63
- for (i = 0; i < mediaTypes.length; i++) {
64
- name = mediaTypes[i][0];
65
-
66
- item = {
67
- name : name,
68
- clsids : tinymce.explode(mediaTypes[i][1] || ''),
69
- mimes : tinymce.explode(mediaTypes[i][2] || ''),
70
- codebase : mediaTypes[i][3]
71
- };
72
-
73
- for (y = 0; y < item.clsids.length; y++)
74
- lookup['clsid:' + item.clsids[y]] = item;
75
-
76
- for (y = 0; y < item.mimes.length; y++)
77
- lookup[item.mimes[y]] = item;
78
-
79
- lookup['mceItem' + name] = item;
80
- lookup[name.toLowerCase()] = item;
81
-
82
- scriptRegExp += (scriptRegExp ? '|' : '') + name;
83
- }
84
-
85
- // Handle the media_types setting
86
- tinymce.each(ed.getParam("media_types",
87
- "video=mp4,m4v,ogv,webm;" +
88
- "silverlight=xap;" +
89
- "flash=swf,flv;" +
90
- "shockwave=dcr;" +
91
- "quicktime=mov,qt,mpg,mpeg;" +
92
- "shockwave=dcr;" +
93
- "windowsmedia=avi,wmv,wm,asf,asx,wmx,wvx;" +
94
- "realmedia=rm,ra,ram;" +
95
- "java=jar;" +
96
- "audio=mp3,ogg"
97
- ).split(';'), function(item) {
98
- var i, extensions, type;
99
-
100
- item = item.split(/=/);
101
- extensions = tinymce.explode(item[1].toLowerCase());
102
- for (i = 0; i < extensions.length; i++) {
103
- type = lookup[item[0].toLowerCase()];
104
-
105
- if (type)
106
- lookup[extensions[i]] = type;
107
- }
108
- });
109
-
110
- scriptRegExp = new RegExp('write(' + scriptRegExp + ')\\(([^)]+)\\)');
111
- self.lookup = lookup;
112
-
113
- ed.onPreInit.add(function() {
114
- // Allow video elements
115
- ed.schema.addValidElements('object[id|style|width|height|classid|codebase|*],param[name|value],embed[id|style|width|height|type|src|*],video[*],audio[*],source[*]');
116
-
117
- // Convert video elements to image placeholder
118
- ed.parser.addNodeFilter('object,embed,video,audio,script,iframe', function(nodes) {
119
- var i = nodes.length;
120
-
121
- while (i--)
122
- self.objectToImg(nodes[i]);
123
- });
124
-
125
- // Convert image placeholders to video elements
126
- ed.serializer.addNodeFilter('img', function(nodes, name, args) {
127
- var i = nodes.length, node;
128
-
129
- while (i--) {
130
- node = nodes[i];
131
- if ((node.attr('class') || '').indexOf('mceItemMedia') !== -1)
132
- self.imgToObject(node, args);
133
- }
134
- });
135
- });
136
-
137
- ed.onInit.add(function() {
138
- // Display "media" instead of "img" in element path
139
- if (ed.theme && ed.theme.onResolveName) {
140
- ed.theme.onResolveName.add(function(theme, path_object) {
141
- if (path_object.name === 'img' && ed.dom.hasClass(path_object.node, 'mceItemMedia'))
142
- path_object.name = 'media';
143
- });
144
- }
145
-
146
- // Add contect menu if it's loaded
147
- if (ed && ed.plugins.contextmenu) {
148
- ed.plugins.contextmenu.onContextMenu.add(function(plugin, menu, element) {
149
- if (element.nodeName === 'IMG' && element.className.indexOf('mceItemMedia') !== -1)
150
- menu.add({title : 'media.edit', icon : 'media', cmd : 'mceMedia'});
151
- });
152
- }
153
- });
154
-
155
- // Register commands
156
- ed.addCommand('mceMedia', function() {
157
- var data, img;
158
-
159
- img = ed.selection.getNode();
160
- if (isMediaImg(img)) {
161
- data = ed.dom.getAttrib(img, 'data-mce-json');
162
- if (data) {
163
- data = JSON.parse(data);
164
-
165
- // Add some extra properties to the data object
166
- tinymce.each(rootAttributes, function(name) {
167
- var value = ed.dom.getAttrib(img, name);
168
-
169
- if (value)
170
- data[name] = value;
171
- });
172
-
173
- data.type = self.getType(img.className).name.toLowerCase();
174
- }
175
- }
176
-
177
- if (!data) {
178
- data = {
179
- type : 'flash',
180
- video: {sources:[]},
181
- params: {}
182
- };
183
- }
184
-
185
- ed.windowManager.open({
186
- file : url + '/media.htm',
187
- width : 430 + parseInt(ed.getLang('media.delta_width', 0)),
188
- height : 500 + parseInt(ed.getLang('media.delta_height', 0)),
189
- inline : 1
190
- }, {
191
- plugin_url : url,
192
- data : data
193
- });
194
- });
195
-
196
- // Register buttons
197
- ed.addButton('media', {title : 'media.desc', cmd : 'mceMedia'});
198
-
199
- // Update media selection status
200
- ed.onNodeChange.add(function(ed, cm, node) {
201
- cm.setActive('media', isMediaImg(node));
202
- });
203
- },
204
-
205
- convertUrl : function(url, force_absolute) {
206
- var self = this, editor = self.editor, settings = editor.settings,
207
- urlConverter = settings.url_converter,
208
- urlConverterScope = settings.url_converter_scope || self;
209
-
210
- if (!url)
211
- return url;
212
-
213
- if (force_absolute)
214
- return editor.documentBaseURI.toAbsolute(url);
215
-
216
- return urlConverter.call(urlConverterScope, url, 'src', 'object');
217
- },
218
-
219
- getInfo : function() {
220
- return {
221
- longname : 'Media',
222
- author : 'Moxiecode Systems AB',
223
- authorurl : 'http://tinymce.moxiecode.com',
224
- infourl : 'http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/media',
225
- version : tinymce.majorVersion + "." + tinymce.minorVersion
226
- };
227
- },
228
-
229
- /**
230
- * Converts the JSON data object to an img node.
231
- */
232
- dataToImg : function(data, force_absolute) {
233
- var self = this, editor = self.editor, baseUri = editor.documentBaseURI, sources, attrs, img, i;
234
-
235
- data.params.src = self.convertUrl(data.params.src, force_absolute);
236
-
237
- attrs = data.video.attrs;
238
- if (attrs)
239
- attrs.src = self.convertUrl(attrs.src, force_absolute);
240
-
241
- if (attrs)
242
- attrs.poster = self.convertUrl(attrs.poster, force_absolute);
243
-
244
- sources = toArray(data.video.sources);
245
- if (sources) {
246
- for (i = 0; i < sources.length; i++)
247
- sources[i].src = self.convertUrl(sources[i].src, force_absolute);
248
- }
249
-
250
- img = self.editor.dom.create('img', {
251
- id : data.id,
252
- style : data.style,
253
- align : data.align,
254
- hspace : data.hspace,
255
- vspace : data.vspace,
256
- src : self.editor.theme.url + '/img/trans.gif',
257
- 'class' : 'mceItemMedia mceItem' + self.getType(data.type).name,
258
- 'data-mce-json' : JSON.serialize(data, "'")
259
- });
260
-
261
- img.width = data.width || (data.type == 'audio' ? "300" : "320");
262
- img.height = data.height || (data.type == 'audio' ? "32" : "240");
263
-
264
- return img;
265
- },
266
-
267
- /**
268
- * Converts the JSON data object to a HTML string.
269
- */
270
- dataToHtml : function(data, force_absolute) {
271
- return this.editor.serializer.serialize(this.dataToImg(data, force_absolute), {forced_root_block : '', force_absolute : force_absolute});
272
- },
273
-
274
- /**
275
- * Converts the JSON data object to a HTML string.
276
- */
277
- htmlToData : function(html) {
278
- var fragment, img, data;
279
-
280
- data = {
281
- type : 'flash',
282
- video: {sources:[]},
283
- params: {}
284
- };
285
-
286
- fragment = this.editor.parser.parse(html);
287
- img = fragment.getAll('img')[0];
288
-
289
- if (img) {
290
- data = JSON.parse(img.attr('data-mce-json'));
291
- data.type = this.getType(img.attr('class')).name.toLowerCase();
292
-
293
- // Add some extra properties to the data object
294
- tinymce.each(rootAttributes, function(name) {
295
- var value = img.attr(name);
296
-
297
- if (value)
298
- data[name] = value;
299
- });
300
- }
301
-
302
- return data;
303
- },
304
-
305
- /**
306
- * Get type item by extension, class, clsid or mime type.
307
- *
308
- * @method getType
309
- * @param {String} value Value to get type item by.
310
- * @return {Object} Type item object or undefined.
311
- */
312
- getType : function(value) {
313
- var i, values, typeItem;
314
-
315
- // Find type by checking the classes
316
- values = tinymce.explode(value, ' ');
317
- for (i = 0; i < values.length; i++) {
318
- typeItem = this.lookup[values[i]];
319
-
320
- if (typeItem)
321
- return typeItem;
322
- }
323
- },
324
-
325
- /**
326
- * Converts a tinymce.html.Node image element to video/object/embed.
327
- */
328
- imgToObject : function(node, args) {
329
- var self = this, editor = self.editor, video, object, embed, iframe, name, value, data,
330
- source, sources, params, param, typeItem, i, item, mp4Source, replacement,
331
- posterSrc, style, audio;
332
-
333
- // Adds the flash player
334
- function addPlayer(video_src, poster_src) {
335
- var baseUri, flashVars, flashVarsOutput, params, flashPlayer;
336
-
337
- flashPlayer = editor.getParam('flash_video_player_url', self.convertUrl(self.url + '/moxieplayer.swf'));
338
- if (flashPlayer) {
339
- baseUri = editor.documentBaseURI;
340
- data.params.src = flashPlayer;
341
-
342
- // Convert the movie url to absolute urls
343
- if (editor.getParam('flash_video_player_absvideourl', true)) {
344
- video_src = baseUri.toAbsolute(video_src || '', true);
345
- poster_src = baseUri.toAbsolute(poster_src || '', true);
346
- }
347
-
348
- // Generate flash vars
349
- flashVarsOutput = '';
350
- flashVars = editor.getParam('flash_video_player_flashvars', {url : '$url', poster : '$poster'});
351
- tinymce.each(flashVars, function(value, name) {
352
- // Replace $url and $poster variables in flashvars value
353
- value = value.replace(/\$url/, video_src || '');
354
- value = value.replace(/\$poster/, poster_src || '');
355
-
356
- if (value.length > 0)
357
- flashVarsOutput += (flashVarsOutput ? '&' : '') + name + '=' + escape(value);
358
- });
359
-
360
- if (flashVarsOutput.length)
361
- data.params.flashvars = flashVarsOutput;
362
-
363
- params = editor.getParam('flash_video_player_params', {
364
- allowfullscreen: true,
365
- allowscriptaccess: true
366
- });
367
-
368
- tinymce.each(params, function(value, name) {
369
- data.params[name] = "" + value;
370
- });
371
- }
372
- };
373
-
374
- data = node.attr('data-mce-json');
375
- if (!data)
376
- return;
377
-
378
- data = JSON.parse(data);
379
- typeItem = this.getType(node.attr('class'));
380
-
381
- style = node.attr('data-mce-style')
382
- if (!style) {
383
- style = node.attr('style');
384
-
385
- if (style)
386
- style = editor.dom.serializeStyle(editor.dom.parseStyle(style, 'img'));
387
- }
388
-
389
- // Handle iframe
390
- if (typeItem.name === 'Iframe') {
391
- replacement = new Node('iframe', 1);
392
-
393
- tinymce.each(rootAttributes, function(name) {
394
- var value = node.attr(name);
395
-
396
- if (name == 'class' && value)
397
- value = value.replace(/mceItem.+ ?/g, '');
398
-
399
- if (value && value.length > 0)
400
- replacement.attr(name, value);
401
- });
402
-
403
- for (name in data.params)
404
- replacement.attr(name, data.params[name]);
405
-
406
- replacement.attr({
407
- style: style,
408
- src: data.params.src
409
- });
410
-
411
- node.replace(replacement);
412
-
413
- return;
414
- }
415
-
416
- // Handle scripts
417
- if (this.editor.settings.media_use_script) {
418
- replacement = new Node('script', 1).attr('type', 'text/javascript');
419
-
420
- value = new Node('#text', 3);
421
- value.value = 'write' + typeItem.name + '(' + JSON.serialize(tinymce.extend(data.params, {
422
- width: node.attr('width'),
423
- height: node.attr('height')
424
- })) + ');';
425
-
426
- replacement.append(value);
427
- node.replace(replacement);
428
-
429
- return;
430
- }
431
-
432
- // Add HTML5 video element
433
- if (typeItem.name === 'Video' && data.video.sources[0]) {
434
- // Create new object element
435
- video = new Node('video', 1).attr(tinymce.extend({
436
- id : node.attr('id'),
437
- width: node.attr('width'),
438
- height: node.attr('height'),
439
- style : style
440
- }, data.video.attrs));
441
-
442
- // Get poster source and use that for flash fallback
443
- if (data.video.attrs)
444
- posterSrc = data.video.attrs.poster;
445
-
446
- sources = data.video.sources = toArray(data.video.sources);
447
- for (i = 0; i < sources.length; i++) {
448
- if (/\.mp4$/.test(sources[i].src))
449
- mp4Source = sources[i].src;
450
- }
451
-
452
- if (!sources[0].type) {
453
- video.attr('src', sources[0].src);
454
- sources.splice(0, 1);
455
- }
456
-
457
- for (i = 0; i < sources.length; i++) {
458
- source = new Node('source', 1).attr(sources[i]);
459
- source.shortEnded = true;
460
- video.append(source);
461
- }
462
-
463
- // Create flash fallback for video if we have a mp4 source
464
- if (mp4Source) {
465
- addPlayer(mp4Source, posterSrc);
466
- typeItem = self.getType('flash');
467
- } else
468
- data.params.src = '';
469
- }
470
-
471
- // Add HTML5 audio element
472
- if (typeItem.name === 'Audio' && data.video.sources[0]) {
473
- // Create new object element
474
- audio = new Node('audio', 1).attr(tinymce.extend({
475
- id : node.attr('id'),
476
- width: node.attr('width'),
477
- height: node.attr('height'),
478
- style : style
479
- }, data.video.attrs));
480
-
481
- // Get poster source and use that for flash fallback
482
- if (data.video.attrs)
483
- posterSrc = data.video.attrs.poster;
484
-
485
- sources = data.video.sources = toArray(data.video.sources);
486
- if (!sources[0].type) {
487
- audio.attr('src', sources[0].src);
488
- sources.splice(0, 1);
489
- }
490
-
491
- for (i = 0; i < sources.length; i++) {
492
- source = new Node('source', 1).attr(sources[i]);
493
- source.shortEnded = true;
494
- audio.append(source);
495
- }
496
-
497
- data.params.src = '';
498
- }
499
-
500
- if (typeItem.name === 'EmbeddedAudio') {
501
- embed = new Node('embed', 1);
502
- embed.shortEnded = true;
503
- embed.attr({
504
- id: node.attr('id'),
505
- width: node.attr('width'),
506
- height: node.attr('height'),
507
- style : style,
508
- type: node.attr('type')
509
- });
510
-
511
- for (name in data.params)
512
- embed.attr(name, data.params[name]);
513
-
514
- tinymce.each(rootAttributes, function(name) {
515
- if (data[name] && name != 'type')
516
- embed.attr(name, data[name]);
517
- });
518
-
519
- data.params.src = '';
520
- }
521
-
522
- // Do we have a params src then we can generate object
523
- if (data.params.src) {
524
- // Is flv movie add player for it
525
- if (/\.flv$/i.test(data.params.src))
526
- addPlayer(data.params.src, '');
527
-
528
- if (args && args.force_absolute)
529
- data.params.src = editor.documentBaseURI.toAbsolute(data.params.src);
530
-
531
- // Create new object element
532
- object = new Node('object', 1).attr({
533
- id : node.attr('id'),
534
- width: node.attr('width'),
535
- height: node.attr('height'),
536
- style : style
537
- });
538
-
539
- tinymce.each(rootAttributes, function(name) {
540
- var value = data[name];
541
-
542
- if (name == 'class' && value)
543
- value = value.replace(/mceItem.+ ?/g, '');
544
-
545
- if (value && name != 'type')
546
- object.attr(name, value);
547
- });
548
-
549
- // Add params
550
- for (name in data.params) {
551
- param = new Node('param', 1);
552
- param.shortEnded = true;
553
- value = data.params[name];
554
-
555
- // Windows media needs to use url instead of src for the media URL
556
- if (name === 'src' && typeItem.name === 'WindowsMedia')
557
- name = 'url';
558
-
559
- param.attr({name: name, value: value});
560
- object.append(param);
561
- }
562
-
563
- // Setup add type and classid if strict is disabled
564
- if (this.editor.getParam('media_strict', true)) {
565
- object.attr({
566
- data: data.params.src,
567
- type: typeItem.mimes[0]
568
- });
569
- } else {
570
- object.attr({
571
- classid: "clsid:" + typeItem.clsids[0],
572
- codebase: typeItem.codebase
573
- });
574
-
575
- embed = new Node('embed', 1);
576
- embed.shortEnded = true;
577
- embed.attr({
578
- id: node.attr('id'),
579
- width: node.attr('width'),
580
- height: node.attr('height'),
581
- style : style,
582
- type: typeItem.mimes[0]
583
- });
584
-
585
- for (name in data.params)
586
- embed.attr(name, data.params[name]);
587
-
588
- tinymce.each(rootAttributes, function(name) {
589
- if (data[name] && name != 'type')
590
- embed.attr(name, data[name]);
591
- });
592
-
593
- object.append(embed);
594
- }
595
-
596
- // Insert raw HTML
597
- if (data.object_html) {
598
- value = new Node('#text', 3);
599
- value.raw = true;
600
- value.value = data.object_html;
601
- object.append(value);
602
- }
603
-
604
- // Append object to video element if it exists
605
- if (video)
606
- video.append(object);
607
- }
608
-
609
- if (video) {
610
- // Insert raw HTML
611
- if (data.video_html) {
612
- value = new Node('#text', 3);
613
- value.raw = true;
614
- value.value = data.video_html;
615
- video.append(value);
616
- }
617
- }
618
-
619
- if (audio) {
620
- // Insert raw HTML
621
- if (data.video_html) {
622
- value = new Node('#text', 3);
623
- value.raw = true;
624
- value.value = data.video_html;
625
- audio.append(value);
626
- }
627
- }
628
-
629
- var n = video || audio || object || embed;
630
- if (n)
631
- node.replace(n);
632
- else
633
- node.remove();
634
- },
635
-
636
- /**
637
- * Converts a tinymce.html.Node video/object/embed to an img element.
638
- *
639
- * The video/object/embed will be converted into an image placeholder with a JSON data attribute like this:
640
- * <img class="mceItemMedia mceItemFlash" width="100" height="100" data-mce-json="{..}" />
641
- *
642
- * The JSON structure will be like this:
643
- * {'params':{'flashvars':'something','quality':'high','src':'someurl'}, 'video':{'sources':[{src: 'someurl', type: 'video/mp4'}]}}
644
- */
645
- objectToImg : function(node) {
646
- var object, embed, video, iframe, img, name, id, width, height, style, i, html,
647
- param, params, source, sources, data, type, lookup = this.lookup,
648
- matches, attrs, urlConverter = this.editor.settings.url_converter,
649
- urlConverterScope = this.editor.settings.url_converter_scope,
650
- hspace, vspace, align, bgcolor;
651
-
652
- function getInnerHTML(node) {
653
- return new tinymce.html.Serializer({
654
- inner: true,
655
- validate: false
656
- }).serialize(node);
657
- };
658
-
659
- function lookupAttribute(o, attr) {
660
- return lookup[(o.attr(attr) || '').toLowerCase()];
661
- }
662
-
663
- function lookupExtension(src) {
664
- var ext = src.replace(/^.*\.([^.]+)$/, '$1');
665
- return lookup[ext.toLowerCase() || ''];
666
- }
667
-
668
- // If node isn't in document
669
- if (!node.parent)
670
- return;
671
-
672
- // Handle media scripts
673
- if (node.name === 'script') {
674
- if (node.firstChild)
675
- matches = scriptRegExp.exec(node.firstChild.value);
676
-
677
- if (!matches)
678
- return;
679
-
680
- type = matches[1];
681
- data = {video : {}, params : JSON.parse(matches[2])};
682
- width = data.params.width;
683
- height = data.params.height;
684
- }
685
-
686
- // Setup data objects
687
- data = data || {
688
- video : {},
689
- params : {}
690
- };
691
-
692
- // Setup new image object
693
- img = new Node('img', 1);
694
- img.attr({
695
- src : this.editor.theme.url + '/img/trans.gif'
696
- });
697
-
698
- // Video element
699
- name = node.name;
700
- if (name === 'video' || name == 'audio') {
701
- video = node;
702
- object = node.getAll('object')[0];
703
- embed = node.getAll('embed')[0];
704
- width = video.attr('width');
705
- height = video.attr('height');
706
- id = video.attr('id');
707
- data.video = {attrs : {}, sources : []};
708
-
709
- // Get all video attributes
710
- attrs = data.video.attrs;
711
- for (name in video.attributes.map)
712
- attrs[name] = video.attributes.map[name];
713
-
714
- source = node.attr('src');
715
- if (source)
716
- data.video.sources.push({src : urlConverter.call(urlConverterScope, source, 'src', node.name)});
717
-
718
- // Get all sources
719
- sources = video.getAll("source");
720
- for (i = 0; i < sources.length; i++) {
721
- source = sources[i].remove();
722
-
723
- data.video.sources.push({
724
- src: urlConverter.call(urlConverterScope, source.attr('src'), 'src', 'source'),
725
- type: source.attr('type'),
726
- media: source.attr('media')
727
- });
728
- }
729
-
730
- // Convert the poster URL
731
- if (attrs.poster)
732
- attrs.poster = urlConverter.call(urlConverterScope, attrs.poster, 'poster', node.name);
733
- }
734
-
735
- // Object element
736
- if (node.name === 'object') {
737
- object = node;
738
- embed = node.getAll('embed')[0];
739
- }
740
-
741
- // Embed element
742
- if (node.name === 'embed')
743
- embed = node;
744
-
745
- // Iframe element
746
- if (node.name === 'iframe') {
747
- iframe = node;
748
- type = 'Iframe';
749
- }
750
-
751
- if (object) {
752
- // Get width/height
753
- width = width || object.attr('width');
754
- height = height || object.attr('height');
755
- style = style || object.attr('style');
756
- id = id || object.attr('id');
757
- hspace = hspace || object.attr('hspace');
758
- vspace = vspace || object.attr('vspace');
759
- align = align || object.attr('align');
760
- bgcolor = bgcolor || object.attr('bgcolor');
761
- data.name = object.attr('name');
762
-
763
- // Get all object params
764
- params = object.getAll("param");
765
- for (i = 0; i < params.length; i++) {
766
- param = params[i];
767
- name = param.remove().attr('name');
768
-
769
- if (!excludedAttrs[name])
770
- data.params[name] = param.attr('value');
771
- }
772
-
773
- data.params.src = data.params.src || object.attr('data');
774
- }
775
-
776
- if (embed) {
777
- // Get width/height
778
- width = width || embed.attr('width');
779
- height = height || embed.attr('height');
780
- style = style || embed.attr('style');
781
- id = id || embed.attr('id');
782
- hspace = hspace || embed.attr('hspace');
783
- vspace = vspace || embed.attr('vspace');
784
- align = align || embed.attr('align');
785
- bgcolor = bgcolor || embed.attr('bgcolor');
786
-
787
- // Get all embed attributes
788
- for (name in embed.attributes.map) {
789
- if (!excludedAttrs[name] && !data.params[name])
790
- data.params[name] = embed.attributes.map[name];
791
- }
792
- }
793
-
794
- if (iframe) {
795
- // Get width/height
796
- width = iframe.attr('width');
797
- height = iframe.attr('height');
798
- style = style || iframe.attr('style');
799
- id = iframe.attr('id');
800
- hspace = iframe.attr('hspace');
801
- vspace = iframe.attr('vspace');
802
- align = iframe.attr('align');
803
- bgcolor = iframe.attr('bgcolor');
804
-
805
- tinymce.each(rootAttributes, function(name) {
806
- img.attr(name, iframe.attr(name));
807
- });
808
-
809
- // Get all iframe attributes
810
- for (name in iframe.attributes.map) {
811
- if (!excludedAttrs[name] && !data.params[name])
812
- data.params[name] = iframe.attributes.map[name];
813
- }
814
- }
815
-
816
- // Use src not movie
817
- if (data.params.movie) {
818
- data.params.src = data.params.src || data.params.movie;
819
- delete data.params.movie;
820
- }
821
-
822
- // Convert the URL to relative/absolute depending on configuration
823
- if (data.params.src)
824
- data.params.src = urlConverter.call(urlConverterScope, data.params.src, 'src', 'object');
825
-
826
- if (video) {
827
- if (node.name === 'video')
828
- type = lookup.video.name;
829
- else if (node.name === 'audio')
830
- type = lookup.audio.name;
831
- }
832
-
833
- if (object && !type)
834
- type = (lookupAttribute(object, 'clsid') || lookupAttribute(object, 'classid') || lookupAttribute(object, 'type') || {}).name;
835
-
836
- if (embed && !type)
837
- type = (lookupAttribute(embed, 'type') || lookupExtension(data.params.src) || {}).name;
838
-
839
- // for embedded audio we preserve the original specified type
840
- if (embed && type == 'EmbeddedAudio') {
841
- data.params.type = embed.attr('type');
842
- }
843
-
844
- // Replace the video/object/embed element with a placeholder image containing the data
845
- node.replace(img);
846
-
847
- // Remove embed
848
- if (embed)
849
- embed.remove();
850
-
851
- // Serialize the inner HTML of the object element
852
- if (object) {
853
- html = getInnerHTML(object.remove());
854
-
855
- if (html)
856
- data.object_html = html;
857
- }
858
-
859
- // Serialize the inner HTML of the video element
860
- if (video) {
861
- html = getInnerHTML(video.remove());
862
-
863
- if (html)
864
- data.video_html = html;
865
- }
866
-
867
- data.hspace = hspace;
868
- data.vspace = vspace;
869
- data.align = align;
870
- data.bgcolor = bgcolor;
871
-
872
- // Set width/height of placeholder
873
- img.attr({
874
- id : id,
875
- 'class' : 'mceItemMedia mceItem' + (type || 'Flash'),
876
- style : style,
877
- width : width || (node.name == 'audio' ? "300" : "320"),
878
- height : height || (node.name == 'audio' ? "32" : "240"),
879
- hspace : hspace,
880
- vspace : vspace,
881
- align : align,
882
- bgcolor : bgcolor,
883
- "data-mce-json" : JSON.serialize(data, "'")
884
- });
885
- }
886
- });
887
-
888
- // Register plugin
889
- tinymce.PluginManager.add('media', tinymce.plugins.MediaPlugin);
890
- })();