typus 3.1.0.rc6 → 3.1.0.rc7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (812) hide show
  1. data/.gitignore +10 -0
  2. data/.gitmodules +6 -0
  3. data/.yardopts +6 -0
  4. data/Gemfile +1 -1
  5. data/README.md +7 -7
  6. data/Rakefile +14 -1
  7. data/app/assets/javascripts/typus/jquery.application.js +13 -2
  8. data/app/assets/stylesheets/typus/screen.css +4 -0
  9. data/app/controllers/admin/account_controller.rb +2 -3
  10. data/app/controllers/admin/resources_controller.rb +42 -32
  11. data/app/controllers/admin/session_controller.rb +1 -1
  12. data/app/helpers/admin/base_helper.rb +28 -33
  13. data/app/helpers/admin/dashboard_helper.rb +5 -7
  14. data/app/helpers/admin/resources/data_types/belongs_to_helper.rb +82 -0
  15. data/app/helpers/admin/resources/data_types/boolean_helper.rb +28 -0
  16. data/app/helpers/admin/resources/data_types/date_helper.rb +12 -0
  17. data/app/helpers/admin/resources/data_types/datetime_helper.rb +17 -0
  18. data/app/helpers/admin/resources/data_types/dragonfly_helper.rb +37 -0
  19. data/app/helpers/admin/resources/data_types/float_helper.rb +3 -0
  20. data/app/helpers/admin/resources/data_types/has_and_belongs_to_many_helper.rb +24 -0
  21. data/app/helpers/admin/resources/data_types/has_many_helper.rb +43 -0
  22. data/app/helpers/admin/resources/data_types/has_one_helper.rb +23 -0
  23. data/app/helpers/admin/resources/data_types/paperclip_helper.rb +38 -0
  24. data/app/helpers/admin/resources/data_types/position_helper.rb +22 -0
  25. data/app/helpers/admin/resources/data_types/selector_helper.rb +11 -0
  26. data/app/helpers/admin/resources/data_types/string_helper.rb +29 -0
  27. data/app/helpers/admin/resources/data_types/text_helper.rb +7 -0
  28. data/app/helpers/admin/resources/data_types/transversal_helper.rb +8 -0
  29. data/app/helpers/admin/resources/data_types/tree_helper.rb +25 -0
  30. data/app/helpers/admin/resources/display_helper.rb +26 -0
  31. data/app/helpers/admin/resources/filters_helper.rb +36 -0
  32. data/app/helpers/admin/resources/form_helper.rb +69 -0
  33. data/app/helpers/admin/resources/list_helper.rb +27 -0
  34. data/app/helpers/admin/resources/relationships_helper.rb +55 -0
  35. data/app/helpers/admin/resources/table_helper.rb +61 -0
  36. data/app/helpers/admin/resources_helper.rb +33 -34
  37. data/app/views/admin/resources/_form.html.erb +4 -5
  38. data/app/views/admin/resources/edit.html.erb +7 -2
  39. data/app/views/admin/resources/index.html.erb +11 -2
  40. data/app/views/admin/resources/new.html.erb +2 -7
  41. data/app/views/admin/templates/_belongs_to_with_autocomplete.html.erb +2 -6
  42. data/app/views/admin/templates/_dragonfly.html.erb +5 -0
  43. data/app/views/admin/{helpers/_file_preview.html.erb → templates/_dragonfly_preview.html.erb} +0 -0
  44. data/app/views/admin/templates/_has_n.html.erb +0 -2
  45. data/app/views/admin/templates/_paperclip.html.erb +5 -0
  46. data/app/views/admin/templates/_paperclip_preview.html.erb +3 -0
  47. data/app/views/admin/templates/_selector.html.erb +2 -2
  48. data/app/views/admin/templates/{_rich_text.html.erb → _text_with_ckeditor.html.erb} +2 -2
  49. data/app/views/admin/templates/_text_with_ckeditor_and_assets.html.erb +24 -0
  50. data/app/views/admin/templates/_tree.html.erb +6 -4
  51. data/app/views/{admin/helpers → helpers/admin}/base/_apps.html.erb +0 -0
  52. data/app/views/{admin/helpers → helpers/admin}/base/_flash_message.html.erb +0 -0
  53. data/app/views/{admin/helpers → helpers/admin}/base/_header.html.erb +0 -0
  54. data/app/views/{admin/helpers → helpers/admin}/base/_login_info.html.erb +0 -0
  55. data/app/views/{admin/helpers → helpers/admin}/dashboard/_resources.html.erb +0 -0
  56. data/app/views/helpers/admin/resources/_actions.html.erb +24 -0
  57. data/app/views/{admin/helpers → helpers/admin}/resources/_errors.html.erb +0 -0
  58. data/app/views/{admin/helpers/filters → helpers/admin/resources}/_filters.html.erb +0 -0
  59. data/app/views/{admin/helpers/search → helpers/admin/resources}/_search.html.erb +0 -0
  60. data/app/views/{admin/helpers/sidebar → helpers/admin/resources}/_sidebar.html.erb +0 -0
  61. data/app/views/helpers/admin/resources/_table.html.erb +45 -0
  62. data/config/routes.rb +1 -1
  63. data/doc/yard/handlers/configurable_attr_handler.rb +38 -0
  64. data/doc/yard/setup.rb +9 -0
  65. data/doc/yard/templates/default/fulldoc/html/css/common.css +109 -0
  66. data/doc/yard/templates/default/layout/html/layout.erb +126 -0
  67. data/doc/yard/templates/default/module/html/configuration_summary.erb +31 -0
  68. data/doc/yard/templates/default/module/setup.rb +17 -0
  69. data/lib/generators/templates/config/initializers/typus_resources.rb +0 -3
  70. data/lib/generators/templates/config/typus/README +0 -1
  71. data/lib/generators/templates/{controller.rb → controller.erb} +0 -0
  72. data/lib/generators/templates/{migration.rb → migration.erb} +0 -0
  73. data/lib/generators/typus/controller_generator.rb +1 -1
  74. data/lib/generators/typus/migration_generator.rb +1 -1
  75. data/lib/typus/authentication/session.rb +16 -19
  76. data/lib/typus/controller/actions.rb +14 -5
  77. data/lib/typus/controller/{acts_as.rb → acts_as_list.rb} +7 -6
  78. data/lib/typus/controller/associations.rb +11 -13
  79. data/lib/typus/controller/autocomplete.rb +1 -1
  80. data/lib/typus/controller/bulk.rb +70 -0
  81. data/lib/typus/controller/filters.rb +11 -3
  82. data/lib/typus/controller/headless.rb +22 -1
  83. data/lib/typus/controller/trash.rb +10 -6
  84. data/lib/typus/orm/active_record/admin_user_v1.rb +9 -20
  85. data/lib/typus/orm/active_record/admin_user_v2.rb +9 -13
  86. data/lib/typus/orm/active_record/class_methods.rb +7 -2
  87. data/lib/typus/orm/active_record/user/class_methods.rb +29 -0
  88. data/lib/typus/resources.rb +0 -3
  89. data/lib/typus/version.rb +1 -1
  90. data/lib/typus.rb +2 -1
  91. data/test/app/controllers/admin/account_controller_test.rb +12 -1
  92. data/test/app/controllers/admin/base_controller_test.rb +2 -2
  93. data/test/app/controllers/admin/dashboard_controller_test.rb +0 -8
  94. data/test/app/controllers/admin/{status_controller_test.rb → resource/status_controller_test.rb} +2 -2
  95. data/test/app/controllers/admin/resources/acts_as_list_test.rb +48 -0
  96. data/test/app/controllers/admin/{assets_controller_test.rb → resources/assets_controller_test.rb.old} +1 -20
  97. data/test/app/controllers/admin/resources/associations_test.rb +59 -0
  98. data/test/app/controllers/admin/{birds_controller_test.rb → resources/birds_controller_test.rb.old} +0 -0
  99. data/test/app/controllers/admin/resources/bulk_test.rb +36 -0
  100. data/test/app/controllers/admin/{cases_controller_test.rb → resources/cases_controller_test.rb.old} +0 -0
  101. data/test/app/controllers/admin/{comments_controller_test.rb → resources/comments_controller_test.rb.old} +9 -6
  102. data/test/app/controllers/admin/resources/image_holders_controller_test.rb.old +55 -0
  103. data/test/app/controllers/admin/{invoices_controller_test.rb → resources/invoices_controller_test.rb.old} +8 -14
  104. data/test/app/controllers/admin/{orders_controller_test.rb → resources/orders_controller_test.rb.old} +0 -0
  105. data/test/app/controllers/admin/{pages_controller_test.rb → resources/pages_controller_test.rb.old} +0 -5
  106. data/test/app/controllers/admin/{posts_controller_test.rb → resources/posts_controller_test.rb.old} +7 -122
  107. data/test/app/controllers/admin/{projects_controller_test.rb → resources/projects_controller_test.rb.old} +0 -0
  108. data/test/app/controllers/admin/resources/trash_test.rb +41 -0
  109. data/test/app/controllers/admin/{typus_users_controller_test.rb → resources/typus_users_controller_test.rb} +9 -7
  110. data/test/app/controllers/admin/{users_controller_test.rb → resources/users_controller_test.rb.old} +0 -0
  111. data/test/app/controllers/admin/{views_controller_test.rb → resources/views_controller_test.rb.old} +0 -4
  112. data/test/app/controllers/admin/resources_controller_test.rb +102 -0
  113. data/test/app/controllers/admin/session_controller_test.rb +9 -7
  114. data/test/app/helpers/admin/base_helper_test.rb +4 -4
  115. data/test/app/helpers/admin/dashboard_helper_test.rb +1 -1
  116. data/test/app/helpers/admin/filters_helper_test.rb +10 -14
  117. data/test/app/helpers/admin/form_helper_test.rb +1 -1
  118. data/test/app/helpers/admin/relationships_helper_test.rb +0 -1
  119. data/test/app/helpers/admin/search_helper_test.rb +7 -7
  120. data/test/app/models/admin_user_test.rb +8 -5
  121. data/test/app/models/typus_user_test.rb +8 -5
  122. data/test/app/models/user_test.rb +8 -5
  123. data/test/factories.rb +10 -0
  124. data/test/fixtures/rails_app/app/controllers/admin/assets_controller.rb +0 -49
  125. data/test/fixtures/rails_app/app/controllers/admin/categories_controller.rb +3 -0
  126. data/test/fixtures/rails_app/app/controllers/admin/entries_controller.rb +0 -3
  127. data/test/fixtures/rails_app/app/controllers/admin/entry_bulks_controller.rb +5 -0
  128. data/test/fixtures/rails_app/app/controllers/admin/entry_trashes_controller.rb +5 -0
  129. data/test/fixtures/rails_app/app/models/entry.rb +1 -0
  130. data/test/fixtures/rails_app/app/models/entry_bulk.rb +2 -0
  131. data/test/fixtures/rails_app/app/models/entry_trash.rb +2 -0
  132. data/test/fixtures/rails_app/app/views/admin/article/entries/_index.html.erb +3 -0
  133. data/test/fixtures/rails_app/app/views/admin/assets/_edit.html.erb +26 -0
  134. data/test/fixtures/rails_app/app/views/admin/cases/_index.html.erb +1 -1
  135. data/test/fixtures/rails_app/app/views/admin/categories/_index.html.erb +1 -1
  136. data/test/fixtures/rails_app/app/views/admin/dashboard/_sidebar.html.erb +1 -1
  137. data/test/fixtures/rails_app/app/views/admin/entry_bulks/_index.html.erb +3 -0
  138. data/test/fixtures/rails_app/app/views/admin/entry_trashes/_index.html.erb +3 -0
  139. data/test/fixtures/rails_app/app/views/admin/templates/_datepicker.html.erb +6 -1
  140. data/test/fixtures/rails_app/config/deploy.rb +1 -1
  141. data/test/fixtures/rails_app/config/typus/README +0 -1
  142. data/test/fixtures/rails_app/config/typus/admin.yml +1 -1
  143. data/test/fixtures/rails_app/config/typus/crud_extended.yml +16 -4
  144. data/test/fixtures/rails_app/config/typus/crud_extended_roles.yml +2 -3
  145. data/test/fixtures/rails_app/config/typus/extensions.yml +29 -0
  146. data/test/fixtures/rails_app/config/typus/extensions_roles.yml +4 -0
  147. data/test/fixtures/rails_app/public/vendor/ckeditor/.htaccess +24 -0
  148. data/test/fixtures/rails_app/public/vendor/ckeditor/CHANGES.html +1295 -0
  149. data/test/fixtures/rails_app/public/vendor/ckeditor/INSTALL.html +92 -0
  150. data/test/fixtures/rails_app/public/vendor/ckeditor/LICENSE.html +1334 -0
  151. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/adobeair/application.xml +32 -0
  152. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/adobeair/run.bat +9 -0
  153. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/adobeair/run.sh +8 -0
  154. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/adobeair/sample.html +45 -0
  155. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/ajax.html +98 -0
  156. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/api.html +192 -0
  157. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/api_dialog/my_dialog.js +28 -0
  158. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/api_dialog.html +198 -0
  159. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/asp/advanced.asp +105 -0
  160. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/asp/events.asp +136 -0
  161. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/asp/index.html +103 -0
  162. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/asp/replace.asp +72 -0
  163. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/asp/replaceall.asp +77 -0
  164. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/asp/sample_posteddata.asp +46 -0
  165. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/asp/standalone.asp +72 -0
  166. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/assets/_posteddata.php +59 -0
  167. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/assets/output_for_flash.fla +0 -0
  168. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/assets/output_for_flash.swf +0 -0
  169. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/assets/output_xhtml.css +204 -0
  170. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/assets/parsesample.css +70 -0
  171. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/assets/swfobject.js +18 -0
  172. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/autogrow.html +103 -0
  173. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/bbcode.html +136 -0
  174. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/devtools.html +94 -0
  175. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/divreplace.html +154 -0
  176. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/enterkey.html +115 -0
  177. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/fullpage.html +82 -0
  178. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/index.html +116 -0
  179. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/jqueryadapter.html +99 -0
  180. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/output_for_flash.html +275 -0
  181. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/output_html.html +285 -0
  182. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/output_xhtml.html +181 -0
  183. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/php/advanced.php +120 -0
  184. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/php/events.php +153 -0
  185. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/php/index.html +47 -0
  186. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/php/replace.php +87 -0
  187. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/php/replaceall.php +88 -0
  188. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/php/standalone.php +83 -0
  189. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/placeholder.html +81 -0
  190. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/readonly.html +91 -0
  191. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/replacebyclass.html +64 -0
  192. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/replacebycode.html +97 -0
  193. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/sample.css +163 -0
  194. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/sample.js +65 -0
  195. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/sample_posteddata.php +21 -0
  196. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/sharedspaces.html +153 -0
  197. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/skins.html +110 -0
  198. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/stylesheetparser.html +93 -0
  199. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/tableresize.html +115 -0
  200. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/ui_color.html +129 -0
  201. data/test/fixtures/rails_app/public/vendor/ckeditor/_samples/ui_languages.html +134 -0
  202. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/adapters/jquery.js +306 -0
  203. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/_bootstrap.js +87 -0
  204. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/ckeditor.js +141 -0
  205. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/ckeditor_base.js +227 -0
  206. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/ckeditor_basic.js +238 -0
  207. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/command.js +209 -0
  208. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/commanddefinition.js +129 -0
  209. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/config.js +431 -0
  210. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dataprocessor.js +65 -0
  211. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom/comment.js +32 -0
  212. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom/document.js +251 -0
  213. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom/documentfragment.js +49 -0
  214. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom/domobject.js +258 -0
  215. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom/element.js +1663 -0
  216. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom/elementpath.js +119 -0
  217. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom/event.js +142 -0
  218. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom/node.js +690 -0
  219. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom/nodelist.js +26 -0
  220. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom/range.js +2032 -0
  221. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom/rangelist.js +213 -0
  222. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom/text.js +128 -0
  223. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom/walker.js +462 -0
  224. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom/window.js +96 -0
  225. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dom.js +20 -0
  226. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/dtd.js +237 -0
  227. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/editor.js +1041 -0
  228. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/editor_basic.js +186 -0
  229. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/env.js +282 -0
  230. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/event.js +342 -0
  231. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/eventInfo.js +120 -0
  232. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/focusmanager.js +152 -0
  233. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/htmlparser/basicwriter.js +145 -0
  234. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/htmlparser/cdata.js +43 -0
  235. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/htmlparser/comment.js +60 -0
  236. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/htmlparser/element.js +249 -0
  237. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/htmlparser/filter.js +288 -0
  238. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/htmlparser/fragment.js +492 -0
  239. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/htmlparser/text.js +55 -0
  240. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/htmlparser.js +224 -0
  241. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/lang.js +157 -0
  242. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/loader.js +240 -0
  243. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/plugindefinition.js +83 -0
  244. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/plugins.js +103 -0
  245. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/resourcemanager.js +238 -0
  246. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/scriptloader.js +180 -0
  247. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/skins.js +184 -0
  248. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/themes.js +19 -0
  249. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/tools.js +734 -0
  250. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/core/ui.js +128 -0
  251. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/_languages.js +84 -0
  252. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/_translationstatus.txt +61 -0
  253. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/af.js +810 -0
  254. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/ar.js +810 -0
  255. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/bg.js +810 -0
  256. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/bn.js +810 -0
  257. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/bs.js +810 -0
  258. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/ca.js +810 -0
  259. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/cs.js +810 -0
  260. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/cy.js +810 -0
  261. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/da.js +810 -0
  262. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/de.js +810 -0
  263. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/el.js +810 -0
  264. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/en-au.js +810 -0
  265. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/en-ca.js +810 -0
  266. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/en-gb.js +810 -0
  267. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/en.js +810 -0
  268. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/eo.js +810 -0
  269. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/es.js +810 -0
  270. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/et.js +810 -0
  271. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/eu.js +810 -0
  272. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/fa.js +810 -0
  273. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/fi.js +810 -0
  274. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/fo.js +810 -0
  275. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/fr-ca.js +810 -0
  276. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/fr.js +810 -0
  277. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/gl.js +810 -0
  278. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/gu.js +810 -0
  279. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/he.js +810 -0
  280. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/hi.js +810 -0
  281. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/hr.js +810 -0
  282. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/hu.js +810 -0
  283. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/is.js +810 -0
  284. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/it.js +810 -0
  285. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/ja.js +810 -0
  286. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/ka.js +810 -0
  287. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/km.js +810 -0
  288. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/ko.js +810 -0
  289. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/lt.js +810 -0
  290. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/lv.js +810 -0
  291. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/mn.js +810 -0
  292. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/ms.js +810 -0
  293. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/nb.js +810 -0
  294. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/nl.js +810 -0
  295. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/no.js +810 -0
  296. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/pl.js +810 -0
  297. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/pt-br.js +809 -0
  298. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/pt.js +810 -0
  299. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/ro.js +810 -0
  300. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/ru.js +810 -0
  301. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/sk.js +810 -0
  302. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/sl.js +810 -0
  303. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/sr-latn.js +810 -0
  304. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/sr.js +810 -0
  305. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/sv.js +809 -0
  306. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/th.js +810 -0
  307. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/tr.js +809 -0
  308. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/uk.js +810 -0
  309. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/vi.js +810 -0
  310. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/zh-cn.js +810 -0
  311. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/lang/zh.js +810 -0
  312. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/a11yhelp/dialogs/a11yhelp.js +222 -0
  313. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/a11yhelp/lang/en.js +108 -0
  314. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/a11yhelp/lang/he.js +216 -0
  315. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/a11yhelp/plugin.js +47 -0
  316. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/about/dialogs/about.js +76 -0
  317. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/about/dialogs/logo_ckeditor.png +0 -0
  318. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/about/plugin.js +24 -0
  319. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/adobeair/plugin.js +228 -0
  320. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/ajax/plugin.js +152 -0
  321. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/autogrow/plugin.js +88 -0
  322. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/basicstyles/plugin.js +101 -0
  323. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/bbcode/plugin.js +924 -0
  324. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/bidi/plugin.js +331 -0
  325. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/blockquote/plugin.js +305 -0
  326. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/button/plugin.js +285 -0
  327. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/clipboard/dialogs/paste.js +223 -0
  328. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/clipboard/plugin.js +446 -0
  329. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/colorbutton/plugin.js +295 -0
  330. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/colordialog/dialogs/colordialog.js +340 -0
  331. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/colordialog/plugin.js +15 -0
  332. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/contextmenu/plugin.js +177 -0
  333. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/devtools/lang/en.js +16 -0
  334. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/devtools/plugin.js +173 -0
  335. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/dialog/dialogDefinition.js +1099 -0
  336. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/dialog/plugin.js +3235 -0
  337. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/dialogadvtab/plugin.js +205 -0
  338. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/dialogui/plugin.js +1537 -0
  339. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/div/dialogs/div.js +535 -0
  340. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/div/plugin.js +121 -0
  341. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/docprops/dialogs/docprops.js +686 -0
  342. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/docprops/plugin.js +22 -0
  343. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/domiterator/plugin.js +361 -0
  344. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/editingblock/plugin.js +269 -0
  345. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/elementspath/plugin.js +218 -0
  346. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/enterkey/plugin.js +399 -0
  347. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/entities/plugin.js +250 -0
  348. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/fakeobjects/plugin.js +126 -0
  349. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/filebrowser/plugin.js +524 -0
  350. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/find/dialogs/find.js +895 -0
  351. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/find/plugin.js +47 -0
  352. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/flash/dialogs/flash.js +698 -0
  353. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/flash/images/placeholder.png +0 -0
  354. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/flash/plugin.js +168 -0
  355. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/floatpanel/plugin.js +405 -0
  356. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/font/plugin.js +234 -0
  357. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/format/plugin.js +197 -0
  358. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/forms/dialogs/button.js +118 -0
  359. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/forms/dialogs/checkbox.js +153 -0
  360. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/forms/dialogs/form.js +177 -0
  361. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/forms/dialogs/hiddenfield.js +100 -0
  362. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/forms/dialogs/radio.js +135 -0
  363. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/forms/dialogs/select.js +562 -0
  364. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/forms/dialogs/textarea.js +114 -0
  365. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/forms/dialogs/textfield.js +199 -0
  366. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/forms/images/hiddenfield.gif +0 -0
  367. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/forms/plugin.js +288 -0
  368. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/horizontalrule/plugin.js +36 -0
  369. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/htmldataprocessor/plugin.js +595 -0
  370. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/htmlwriter/plugin.js +319 -0
  371. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/iframe/dialogs/iframe.js +257 -0
  372. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/iframe/images/placeholder.png +0 -0
  373. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/iframe/plugin.js +106 -0
  374. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/iframedialog/plugin.js +188 -0
  375. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/image/dialogs/image.js +1403 -0
  376. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/image/plugin.js +81 -0
  377. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/indent/plugin.js +461 -0
  378. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/justify/plugin.js +253 -0
  379. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/keystrokes/plugin.js +225 -0
  380. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/link/dialogs/anchor.js +144 -0
  381. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/link/dialogs/link.js +1400 -0
  382. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/link/images/anchor.gif +0 -0
  383. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/link/plugin.js +336 -0
  384. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/list/plugin.js +727 -0
  385. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/listblock/plugin.js +257 -0
  386. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/liststyle/dialogs/liststyle.js +204 -0
  387. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/liststyle/plugin.js +66 -0
  388. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/maximize/plugin.js +352 -0
  389. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/menu/plugin.js +505 -0
  390. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/menubutton/plugin.js +98 -0
  391. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/newpage/plugin.js +54 -0
  392. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/pagebreak/images/pagebreak.gif +0 -0
  393. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/pagebreak/plugin.js +164 -0
  394. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/panel/plugin.js +402 -0
  395. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/panelbutton/plugin.js +146 -0
  396. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/pastefromword/filter/default.js +1376 -0
  397. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/pastefromword/plugin.js +141 -0
  398. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/pastetext/dialogs/pastetext.js +67 -0
  399. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/pastetext/plugin.js +98 -0
  400. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/placeholder/dialogs/placeholder.js +71 -0
  401. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/placeholder/lang/en.js +16 -0
  402. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/placeholder/lang/he.js +16 -0
  403. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/placeholder/placeholder.gif +0 -0
  404. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/placeholder/plugin.js +171 -0
  405. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/popup/plugin.js +64 -0
  406. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/preview/plugin.js +109 -0
  407. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/print/plugin.js +42 -0
  408. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/removeformat/plugin.js +185 -0
  409. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/resize/plugin.js +168 -0
  410. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/richcombo/plugin.js +378 -0
  411. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/save/plugin.js +56 -0
  412. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/scayt/dialogs/options.js +537 -0
  413. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/scayt/dialogs/toolbar.css +71 -0
  414. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/scayt/plugin.js +964 -0
  415. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/selection/plugin.js +1563 -0
  416. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/showblocks/images/block_address.png +0 -0
  417. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/showblocks/images/block_blockquote.png +0 -0
  418. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/showblocks/images/block_div.png +0 -0
  419. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/showblocks/images/block_h1.png +0 -0
  420. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/showblocks/images/block_h2.png +0 -0
  421. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/showblocks/images/block_h3.png +0 -0
  422. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/showblocks/images/block_h4.png +0 -0
  423. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/showblocks/images/block_h5.png +0 -0
  424. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/showblocks/images/block_h6.png +0 -0
  425. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/showblocks/images/block_p.png +0 -0
  426. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/showblocks/images/block_pre.png +0 -0
  427. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/showblocks/plugin.js +160 -0
  428. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/showborders/plugin.js +207 -0
  429. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/dialogs/smiley.js +224 -0
  430. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/angel_smile.gif +0 -0
  431. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/angry_smile.gif +0 -0
  432. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/broken_heart.gif +0 -0
  433. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/confused_smile.gif +0 -0
  434. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/cry_smile.gif +0 -0
  435. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/devil_smile.gif +0 -0
  436. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/embaressed_smile.gif +0 -0
  437. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/envelope.gif +0 -0
  438. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/heart.gif +0 -0
  439. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/kiss.gif +0 -0
  440. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/lightbulb.gif +0 -0
  441. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/omg_smile.gif +0 -0
  442. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/regular_smile.gif +0 -0
  443. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/sad_smile.gif +0 -0
  444. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/shades_smile.gif +0 -0
  445. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/teeth_smile.gif +0 -0
  446. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/thumbs_down.gif +0 -0
  447. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/thumbs_up.gif +0 -0
  448. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/tounge_smile.gif +0 -0
  449. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
  450. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/images/wink_smile.gif +0 -0
  451. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/smiley/plugin.js +94 -0
  452. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/sourcearea/plugin.js +209 -0
  453. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/specialchar/dialogs/specialchar.js +350 -0
  454. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/specialchar/lang/en.js +89 -0
  455. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/specialchar/plugin.js +70 -0
  456. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/styles/plugin.js +1678 -0
  457. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/styles/styles/default.js +88 -0
  458. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/stylescombo/plugin.js +219 -0
  459. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/stylesheetparser/plugin.js +143 -0
  460. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/tab/plugin.js +367 -0
  461. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/table/dialogs/table.js +672 -0
  462. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/table/plugin.js +78 -0
  463. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/tableresize/plugin.js +450 -0
  464. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/tabletools/dialogs/tableCell.js +525 -0
  465. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/tabletools/plugin.js +1191 -0
  466. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/templates/dialogs/templates.js +234 -0
  467. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/templates/plugin.js +99 -0
  468. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/templates/templates/default.js +94 -0
  469. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/templates/templates/images/template1.gif +0 -0
  470. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/templates/templates/images/template2.gif +0 -0
  471. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/templates/templates/images/template3.gif +0 -0
  472. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/toolbar/plugin.js +545 -0
  473. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/uicolor/dialogs/uicolor.js +205 -0
  474. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/uicolor/lang/en.js +15 -0
  475. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/uicolor/lang/he.js +15 -0
  476. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/uicolor/plugin.js +37 -0
  477. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/uicolor/uicolor.gif +0 -0
  478. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/uicolor/yui/assets/hue_bg.png +0 -0
  479. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/uicolor/yui/assets/hue_thumb.png +0 -0
  480. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/uicolor/yui/assets/picker_mask.png +0 -0
  481. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/uicolor/yui/assets/picker_thumb.png +0 -0
  482. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/uicolor/yui/assets/yui.css +15 -0
  483. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/uicolor/yui/yui.js +71 -0
  484. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/undo/plugin.js +580 -0
  485. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/wsc/dialogs/ciframe.html +49 -0
  486. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/wsc/dialogs/tmpFrameset.html +52 -0
  487. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/wsc/dialogs/wsc.css +82 -0
  488. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/wsc/dialogs/wsc.js +192 -0
  489. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/wsc/plugin.js +33 -0
  490. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/wysiwygarea/plugin.js +1351 -0
  491. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/plugins/xml/plugin.js +170 -0
  492. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/dialog.css +920 -0
  493. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/editor.css +25 -0
  494. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/elementspath.css +73 -0
  495. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/icons.css +366 -0
  496. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/icons.png +0 -0
  497. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/icons_rtl.png +0 -0
  498. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/images/dialog_sides.gif +0 -0
  499. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/images/dialog_sides.png +0 -0
  500. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/images/dialog_sides_rtl.png +0 -0
  501. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/images/mini.gif +0 -0
  502. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/images/noimage.png +0 -0
  503. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/images/sprites.png +0 -0
  504. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/images/sprites_ie6.png +0 -0
  505. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/images/toolbar_start.gif +0 -0
  506. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/mainui.css +203 -0
  507. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/menu.css +232 -0
  508. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/panel.css +217 -0
  509. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/presets.css +49 -0
  510. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/reset.css +84 -0
  511. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/richcombo.css +287 -0
  512. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/skin.js +236 -0
  513. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/templates.css +88 -0
  514. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/kama/toolbar.css +407 -0
  515. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/dialog.css +826 -0
  516. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/editor.css +25 -0
  517. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/elementspath.css +74 -0
  518. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/icons.css +363 -0
  519. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/icons.png +0 -0
  520. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/icons_rtl.png +0 -0
  521. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/images/dialog_sides.gif +0 -0
  522. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/images/dialog_sides.png +0 -0
  523. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/images/dialog_sides_rtl.png +0 -0
  524. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/images/mini.gif +0 -0
  525. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/images/noimage.png +0 -0
  526. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/images/sprites.png +0 -0
  527. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/images/sprites_ie6.png +0 -0
  528. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/mainui.css +153 -0
  529. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/menu.css +229 -0
  530. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/panel.css +212 -0
  531. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/presets.css +49 -0
  532. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/reset.css +84 -0
  533. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/richcombo.css +309 -0
  534. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/skin.js +74 -0
  535. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/templates.css +87 -0
  536. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/office2003/toolbar.css +522 -0
  537. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/dialog.css +842 -0
  538. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/editor.css +25 -0
  539. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/elementspath.css +74 -0
  540. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/icons.css +363 -0
  541. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/icons.png +0 -0
  542. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/icons_rtl.png +0 -0
  543. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/images/dialog_sides.gif +0 -0
  544. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/images/dialog_sides.png +0 -0
  545. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/images/dialog_sides_rtl.png +0 -0
  546. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/images/mini.gif +0 -0
  547. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/images/noimage.png +0 -0
  548. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/images/sprites.png +0 -0
  549. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/images/sprites_ie6.png +0 -0
  550. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/images/toolbar_start.gif +0 -0
  551. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/mainui.css +162 -0
  552. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/menu.css +232 -0
  553. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/panel.css +212 -0
  554. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/presets.css +50 -0
  555. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/reset.css +84 -0
  556. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/richcombo.css +302 -0
  557. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/skin.js +70 -0
  558. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/templates.css +87 -0
  559. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/skins/v2/toolbar.css +465 -0
  560. data/test/fixtures/rails_app/public/vendor/ckeditor/_source/themes/default/theme.js +394 -0
  561. data/test/fixtures/rails_app/public/vendor/ckeditor/adapters/jquery.js +6 -0
  562. data/test/fixtures/rails_app/public/vendor/ckeditor/ckeditor.asp +955 -0
  563. data/test/fixtures/rails_app/public/vendor/ckeditor/ckeditor.js +145 -0
  564. data/test/fixtures/rails_app/public/vendor/ckeditor/ckeditor.pack +211 -0
  565. data/test/fixtures/rails_app/public/vendor/ckeditor/ckeditor.php +29 -0
  566. data/test/fixtures/rails_app/public/vendor/ckeditor/ckeditor_basic.js +8 -0
  567. data/test/fixtures/rails_app/public/vendor/ckeditor/ckeditor_basic_source.js +20 -0
  568. data/test/fixtures/rails_app/public/vendor/ckeditor/ckeditor_php4.php +566 -0
  569. data/test/fixtures/rails_app/public/vendor/ckeditor/ckeditor_php5.php +556 -0
  570. data/test/fixtures/rails_app/public/vendor/ckeditor/ckeditor_source.js +25 -0
  571. data/test/fixtures/rails_app/public/vendor/ckeditor/config.js +11 -0
  572. data/test/fixtures/rails_app/public/vendor/ckeditor/contents.css +23 -0
  573. data/test/fixtures/rails_app/public/vendor/ckeditor/images/spacer.gif +0 -0
  574. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/_languages.js +6 -0
  575. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/_translationstatus.txt +61 -0
  576. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/af.js +6 -0
  577. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/ar.js +6 -0
  578. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/bg.js +6 -0
  579. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/bn.js +6 -0
  580. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/bs.js +6 -0
  581. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/ca.js +6 -0
  582. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/cs.js +6 -0
  583. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/cy.js +6 -0
  584. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/da.js +6 -0
  585. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/de.js +6 -0
  586. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/el.js +6 -0
  587. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/en-au.js +6 -0
  588. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/en-ca.js +6 -0
  589. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/en-gb.js +6 -0
  590. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/en.js +6 -0
  591. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/eo.js +6 -0
  592. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/es.js +6 -0
  593. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/et.js +6 -0
  594. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/eu.js +6 -0
  595. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/fa.js +6 -0
  596. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/fi.js +6 -0
  597. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/fo.js +6 -0
  598. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/fr-ca.js +6 -0
  599. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/fr.js +6 -0
  600. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/gl.js +6 -0
  601. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/gu.js +6 -0
  602. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/he.js +6 -0
  603. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/hi.js +6 -0
  604. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/hr.js +6 -0
  605. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/hu.js +6 -0
  606. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/is.js +6 -0
  607. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/it.js +6 -0
  608. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/ja.js +6 -0
  609. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/ka.js +6 -0
  610. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/km.js +6 -0
  611. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/ko.js +6 -0
  612. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/lt.js +6 -0
  613. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/lv.js +6 -0
  614. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/mn.js +6 -0
  615. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/ms.js +6 -0
  616. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/nb.js +6 -0
  617. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/nl.js +6 -0
  618. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/no.js +6 -0
  619. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/pl.js +6 -0
  620. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/pt-br.js +6 -0
  621. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/pt.js +6 -0
  622. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/ro.js +6 -0
  623. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/ru.js +6 -0
  624. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/sk.js +6 -0
  625. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/sl.js +6 -0
  626. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/sr-latn.js +6 -0
  627. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/sr.js +6 -0
  628. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/sv.js +6 -0
  629. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/th.js +6 -0
  630. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/tr.js +6 -0
  631. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/uk.js +6 -0
  632. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/vi.js +6 -0
  633. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/zh-cn.js +6 -0
  634. data/test/fixtures/rails_app/public/vendor/ckeditor/lang/zh.js +6 -0
  635. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +7 -0
  636. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/a11yhelp/lang/en.js +6 -0
  637. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/a11yhelp/lang/he.js +6 -0
  638. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/about/dialogs/about.js +6 -0
  639. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/about/dialogs/logo_ckeditor.png +0 -0
  640. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/adobeair/plugin.js +6 -0
  641. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/ajax/plugin.js +6 -0
  642. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/autogrow/plugin.js +6 -0
  643. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/bbcode/plugin.js +9 -0
  644. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/clipboard/dialogs/paste.js +7 -0
  645. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/colordialog/dialogs/colordialog.js +7 -0
  646. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/devtools/lang/en.js +6 -0
  647. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/devtools/plugin.js +6 -0
  648. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/dialog/dialogDefinition.js +4 -0
  649. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/div/dialogs/div.js +8 -0
  650. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/docprops/dialogs/docprops.js +10 -0
  651. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/docprops/plugin.js +6 -0
  652. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/find/dialogs/find.js +9 -0
  653. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/flash/dialogs/flash.js +9 -0
  654. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/flash/images/placeholder.png +0 -0
  655. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/forms/dialogs/button.js +6 -0
  656. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/forms/dialogs/checkbox.js +6 -0
  657. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/forms/dialogs/form.js +6 -0
  658. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/forms/dialogs/hiddenfield.js +6 -0
  659. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/forms/dialogs/radio.js +6 -0
  660. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/forms/dialogs/select.js +9 -0
  661. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/forms/dialogs/textarea.js +6 -0
  662. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/forms/dialogs/textfield.js +6 -0
  663. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/forms/images/hiddenfield.gif +0 -0
  664. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/iframe/dialogs/iframe.js +7 -0
  665. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/iframe/images/placeholder.png +0 -0
  666. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/iframedialog/plugin.js +6 -0
  667. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/image/dialogs/image.js +13 -0
  668. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/link/dialogs/anchor.js +6 -0
  669. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/link/dialogs/link.js +11 -0
  670. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/link/images/anchor.gif +0 -0
  671. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/liststyle/dialogs/liststyle.js +6 -0
  672. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/pagebreak/images/pagebreak.gif +0 -0
  673. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/pastefromword/filter/default.js +11 -0
  674. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/pastetext/dialogs/pastetext.js +6 -0
  675. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/placeholder/dialogs/placeholder.js +6 -0
  676. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/placeholder/lang/en.js +6 -0
  677. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/placeholder/lang/he.js +6 -0
  678. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/placeholder/placeholder.gif +0 -0
  679. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/placeholder/plugin.js +6 -0
  680. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/scayt/dialogs/options.js +8 -0
  681. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/scayt/dialogs/toolbar.css +6 -0
  682. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/showblocks/images/block_address.png +0 -0
  683. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/showblocks/images/block_blockquote.png +0 -0
  684. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/showblocks/images/block_div.png +0 -0
  685. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/showblocks/images/block_h1.png +0 -0
  686. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/showblocks/images/block_h2.png +0 -0
  687. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/showblocks/images/block_h3.png +0 -0
  688. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/showblocks/images/block_h4.png +0 -0
  689. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/showblocks/images/block_h5.png +0 -0
  690. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/showblocks/images/block_h6.png +0 -0
  691. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/showblocks/images/block_p.png +0 -0
  692. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/showblocks/images/block_pre.png +0 -0
  693. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/dialogs/smiley.js +7 -0
  694. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/angel_smile.gif +0 -0
  695. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/angry_smile.gif +0 -0
  696. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/broken_heart.gif +0 -0
  697. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/confused_smile.gif +0 -0
  698. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/cry_smile.gif +0 -0
  699. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/devil_smile.gif +0 -0
  700. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/embaressed_smile.gif +0 -0
  701. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/envelope.gif +0 -0
  702. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/heart.gif +0 -0
  703. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/kiss.gif +0 -0
  704. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/lightbulb.gif +0 -0
  705. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/omg_smile.gif +0 -0
  706. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/regular_smile.gif +0 -0
  707. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/sad_smile.gif +0 -0
  708. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/shades_smile.gif +0 -0
  709. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/teeth_smile.gif +0 -0
  710. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/thumbs_down.gif +0 -0
  711. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/thumbs_up.gif +0 -0
  712. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/tounge_smile.gif +0 -0
  713. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/whatchutalkingabout_smile.gif +0 -0
  714. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/smiley/images/wink_smile.gif +0 -0
  715. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/specialchar/dialogs/specialchar.js +7 -0
  716. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/specialchar/lang/en.js +6 -0
  717. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/styles/styles/default.js +6 -0
  718. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/stylesheetparser/plugin.js +6 -0
  719. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/table/dialogs/table.js +9 -0
  720. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/tableresize/plugin.js +7 -0
  721. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/tabletools/dialogs/tableCell.js +8 -0
  722. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/templates/dialogs/templates.js +7 -0
  723. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/templates/templates/default.js +6 -0
  724. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/templates/templates/images/template1.gif +0 -0
  725. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/templates/templates/images/template2.gif +0 -0
  726. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/templates/templates/images/template3.gif +0 -0
  727. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/uicolor/dialogs/uicolor.js +7 -0
  728. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/uicolor/lang/en.js +6 -0
  729. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/uicolor/lang/he.js +6 -0
  730. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/uicolor/plugin.js +6 -0
  731. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/uicolor/uicolor.gif +0 -0
  732. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/uicolor/yui/assets/hue_bg.png +0 -0
  733. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/uicolor/yui/assets/hue_thumb.png +0 -0
  734. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/uicolor/yui/assets/picker_mask.png +0 -0
  735. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/uicolor/yui/assets/picker_thumb.png +0 -0
  736. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/uicolor/yui/assets/yui.css +6 -0
  737. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/uicolor/yui/yui.js +76 -0
  738. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/wsc/dialogs/ciframe.html +49 -0
  739. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +52 -0
  740. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/wsc/dialogs/wsc.css +6 -0
  741. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/wsc/dialogs/wsc.js +7 -0
  742. data/test/fixtures/rails_app/public/vendor/ckeditor/plugins/xml/plugin.js +6 -0
  743. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/kama/dialog.css +9 -0
  744. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/kama/editor.css +13 -0
  745. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/kama/icons.png +0 -0
  746. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/kama/icons_rtl.png +0 -0
  747. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/kama/images/dialog_sides.gif +0 -0
  748. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/kama/images/dialog_sides.png +0 -0
  749. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/kama/images/dialog_sides_rtl.png +0 -0
  750. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/kama/images/mini.gif +0 -0
  751. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/kama/images/noimage.png +0 -0
  752. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/kama/images/sprites.png +0 -0
  753. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/kama/images/sprites_ie6.png +0 -0
  754. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/kama/images/toolbar_start.gif +0 -0
  755. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/kama/skin.js +7 -0
  756. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/kama/templates.css +6 -0
  757. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/office2003/dialog.css +9 -0
  758. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/office2003/editor.css +14 -0
  759. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/office2003/icons.png +0 -0
  760. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/office2003/icons_rtl.png +0 -0
  761. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/office2003/images/dialog_sides.gif +0 -0
  762. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/office2003/images/dialog_sides.png +0 -0
  763. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/office2003/images/dialog_sides_rtl.png +0 -0
  764. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/office2003/images/mini.gif +0 -0
  765. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/office2003/images/noimage.png +0 -0
  766. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/office2003/images/sprites.png +0 -0
  767. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/office2003/images/sprites_ie6.png +0 -0
  768. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/office2003/skin.js +6 -0
  769. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/office2003/templates.css +6 -0
  770. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/v2/dialog.css +9 -0
  771. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/v2/editor.css +13 -0
  772. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/v2/icons.png +0 -0
  773. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/v2/icons_rtl.png +0 -0
  774. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/v2/images/dialog_sides.gif +0 -0
  775. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/v2/images/dialog_sides.png +0 -0
  776. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/v2/images/dialog_sides_rtl.png +0 -0
  777. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/v2/images/mini.gif +0 -0
  778. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/v2/images/noimage.png +0 -0
  779. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/v2/images/sprites.png +0 -0
  780. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/v2/images/sprites_ie6.png +0 -0
  781. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/v2/images/toolbar_start.gif +0 -0
  782. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/v2/skin.js +6 -0
  783. data/test/fixtures/rails_app/public/vendor/ckeditor/skins/v2/templates.css +6 -0
  784. data/test/fixtures/rails_app/public/vendor/ckeditor/themes/default/theme.js +8 -0
  785. data/test/lib/typus/orm/active_record/class_methods_test.rb +92 -175
  786. data/test/lib/typus/resources_test.rb +0 -4
  787. data/test/test_helper.rb +5 -0
  788. data/typus.gemspec +1 -1
  789. metadata +1390 -75
  790. data/app/helpers/admin/display_helper.rb +0 -51
  791. data/app/helpers/admin/file_preview_helper.rb +0 -80
  792. data/app/helpers/admin/filters_helper.rb +0 -94
  793. data/app/helpers/admin/form_helper.rb +0 -78
  794. data/app/helpers/admin/list_helper.rb +0 -29
  795. data/app/helpers/admin/relationships_helper.rb +0 -192
  796. data/app/helpers/admin/search_helper.rb +0 -16
  797. data/app/helpers/admin/sidebar_helper.rb +0 -36
  798. data/app/helpers/admin/table_helper.rb +0 -159
  799. data/app/views/admin/helpers/resources/_display_link_to_previous.html.erb +0 -3
  800. data/app/views/admin/helpers/table/_table.html.erb +0 -26
  801. data/app/views/admin/templates/_file.html.erb +0 -5
  802. data/app/views/admin/templates/_relate_form.html.erb +0 -5
  803. data/app/views/admin/templates/_relate_form_with_autocomplete.html.erb +0 -26
  804. data/doc/mongo_db.md +0 -10
  805. data/test/app/controllers/admin/categories_controller_test.rb +0 -134
  806. data/test/app/controllers/admin/image_holders_controller_test.rb +0 -74
  807. data/test/app/helpers/admin/file_preview_helper_test.rb +0 -90
  808. data/test/app/helpers/admin/resources_helper_test.rb +0 -46
  809. data/test/fixtures/rails_app/config/typus/crud_namespaced.yml +0 -10
  810. data/test/fixtures/rails_app/config/typus/crud_namespaced_roles.yml +0 -2
  811. data/test/fixtures/rails_app/config/typus/sti.yml +0 -5
  812. data/test/fixtures/rails_app/config/typus/sti_roles.yml +0 -2
@@ -0,0 +1,3235 @@
1
+ /*
2
+ Copyright (c) 2003-2011, CKSource - Frederico Knabben. All rights reserved.
3
+ For licensing, see LICENSE.html or http://ckeditor.com/license
4
+ */
5
+
6
+ /**
7
+ * @fileOverview The floating dialog plugin.
8
+ */
9
+
10
+ /**
11
+ * No resize for this dialog.
12
+ * @constant
13
+ */
14
+ CKEDITOR.DIALOG_RESIZE_NONE = 0;
15
+
16
+ /**
17
+ * Only allow horizontal resizing for this dialog, disable vertical resizing.
18
+ * @constant
19
+ */
20
+ CKEDITOR.DIALOG_RESIZE_WIDTH = 1;
21
+
22
+ /**
23
+ * Only allow vertical resizing for this dialog, disable horizontal resizing.
24
+ * @constant
25
+ */
26
+ CKEDITOR.DIALOG_RESIZE_HEIGHT = 2;
27
+
28
+ /*
29
+ * Allow the dialog to be resized in both directions.
30
+ * @constant
31
+ */
32
+ CKEDITOR.DIALOG_RESIZE_BOTH = 3;
33
+
34
+ (function()
35
+ {
36
+ var cssLength = CKEDITOR.tools.cssLength;
37
+ function isTabVisible( tabId )
38
+ {
39
+ return !!this._.tabs[ tabId ][ 0 ].$.offsetHeight;
40
+ }
41
+
42
+ function getPreviousVisibleTab()
43
+ {
44
+ var tabId = this._.currentTabId,
45
+ length = this._.tabIdList.length,
46
+ tabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, tabId ) + length;
47
+
48
+ for ( var i = tabIndex - 1 ; i > tabIndex - length ; i-- )
49
+ {
50
+ if ( isTabVisible.call( this, this._.tabIdList[ i % length ] ) )
51
+ return this._.tabIdList[ i % length ];
52
+ }
53
+
54
+ return null;
55
+ }
56
+
57
+ function getNextVisibleTab()
58
+ {
59
+ var tabId = this._.currentTabId,
60
+ length = this._.tabIdList.length,
61
+ tabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, tabId );
62
+
63
+ for ( var i = tabIndex + 1 ; i < tabIndex + length ; i++ )
64
+ {
65
+ if ( isTabVisible.call( this, this._.tabIdList[ i % length ] ) )
66
+ return this._.tabIdList[ i % length ];
67
+ }
68
+
69
+ return null;
70
+ }
71
+
72
+
73
+ function clearOrRecoverTextInputValue( container, isRecover )
74
+ {
75
+ var inputs = container.$.getElementsByTagName( 'input' );
76
+ for ( var i = 0, length = inputs.length; i < length ; i++ )
77
+ {
78
+ var item = new CKEDITOR.dom.element( inputs[ i ] );
79
+
80
+ if ( item.getAttribute( 'type' ).toLowerCase() == 'text' )
81
+ {
82
+ if ( isRecover )
83
+ {
84
+ item.setAttribute( 'value', item.getCustomData( 'fake_value' ) || '' );
85
+ item.removeCustomData( 'fake_value' );
86
+ }
87
+ else
88
+ {
89
+ item.setCustomData( 'fake_value', item.getAttribute( 'value' ) );
90
+ item.setAttribute( 'value', '' );
91
+ }
92
+ }
93
+ }
94
+ }
95
+
96
+ /**
97
+ * This is the base class for runtime dialog objects. An instance of this
98
+ * class represents a single named dialog for a single editor instance.
99
+ * @param {Object} editor The editor which created the dialog.
100
+ * @param {String} dialogName The dialog's registered name.
101
+ * @constructor
102
+ * @example
103
+ * var dialogObj = new CKEDITOR.dialog( editor, 'smiley' );
104
+ */
105
+ CKEDITOR.dialog = function( editor, dialogName )
106
+ {
107
+ // Load the dialog definition.
108
+ var definition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ],
109
+ defaultDefinition = CKEDITOR.tools.clone( defaultDialogDefinition ),
110
+ buttonsOrder = editor.config.dialog_buttonsOrder || 'OS',
111
+ dir = editor.lang.dir;
112
+
113
+ if ( ( buttonsOrder == 'OS' && CKEDITOR.env.mac ) || // The buttons in MacOS Apps are in reverse order (#4750)
114
+ ( buttonsOrder == 'rtl' && dir == 'ltr' ) ||
115
+ ( buttonsOrder == 'ltr' && dir == 'rtl' ) )
116
+ defaultDefinition.buttons.reverse();
117
+
118
+
119
+ // Completes the definition with the default values.
120
+ definition = CKEDITOR.tools.extend( definition( editor ), defaultDefinition );
121
+
122
+ // Clone a functionally independent copy for this dialog.
123
+ definition = CKEDITOR.tools.clone( definition );
124
+
125
+ // Create a complex definition object, extending it with the API
126
+ // functions.
127
+ definition = new definitionObject( this, definition );
128
+
129
+ var doc = CKEDITOR.document;
130
+
131
+ var themeBuilt = editor.theme.buildDialog( editor );
132
+
133
+ // Initialize some basic parameters.
134
+ this._ =
135
+ {
136
+ editor : editor,
137
+ element : themeBuilt.element,
138
+ name : dialogName,
139
+ contentSize : { width : 0, height : 0 },
140
+ size : { width : 0, height : 0 },
141
+ contents : {},
142
+ buttons : {},
143
+ accessKeyMap : {},
144
+
145
+ // Initialize the tab and page map.
146
+ tabs : {},
147
+ tabIdList : [],
148
+ currentTabId : null,
149
+ currentTabIndex : null,
150
+ pageCount : 0,
151
+ lastTab : null,
152
+ tabBarMode : false,
153
+
154
+ // Initialize the tab order array for input widgets.
155
+ focusList : [],
156
+ currentFocusIndex : 0,
157
+ hasFocus : false
158
+ };
159
+
160
+ this.parts = themeBuilt.parts;
161
+
162
+ CKEDITOR.tools.setTimeout( function()
163
+ {
164
+ editor.fire( 'ariaWidget', this.parts.contents );
165
+ },
166
+ 0, this );
167
+
168
+ // Set the startup styles for the dialog, avoiding it enlarging the
169
+ // page size on the dialog creation.
170
+ var startStyles = {
171
+ position : CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed',
172
+ top : 0,
173
+ visibility : 'hidden'
174
+ };
175
+
176
+ startStyles[ dir == 'rtl' ? 'right' : 'left' ] = 0;
177
+ this.parts.dialog.setStyles( startStyles );
178
+
179
+
180
+ // Call the CKEDITOR.event constructor to initialize this instance.
181
+ CKEDITOR.event.call( this );
182
+
183
+ // Fire the "dialogDefinition" event, making it possible to customize
184
+ // the dialog definition.
185
+ this.definition = definition = CKEDITOR.fire( 'dialogDefinition',
186
+ {
187
+ name : dialogName,
188
+ definition : definition
189
+ }
190
+ , editor ).definition;
191
+
192
+ var tabsToRemove = {};
193
+ // Cache tabs that should be removed.
194
+ if ( !( 'removeDialogTabs' in editor._ ) && editor.config.removeDialogTabs )
195
+ {
196
+ var removeContents = editor.config.removeDialogTabs.split( ';' );
197
+
198
+ for ( i = 0; i < removeContents.length; i++ )
199
+ {
200
+ var parts = removeContents[ i ].split( ':' );
201
+ if ( parts.length == 2 )
202
+ {
203
+ var removeDialogName = parts[ 0 ];
204
+ if ( !tabsToRemove[ removeDialogName ] )
205
+ tabsToRemove[ removeDialogName ] = [];
206
+ tabsToRemove[ removeDialogName ].push( parts[ 1 ] );
207
+ }
208
+ }
209
+ editor._.removeDialogTabs = tabsToRemove;
210
+ }
211
+
212
+ // Remove tabs of this dialog.
213
+ if ( editor._.removeDialogTabs && ( tabsToRemove = editor._.removeDialogTabs[ dialogName ] ) )
214
+ {
215
+ for ( i = 0; i < tabsToRemove.length; i++ )
216
+ definition.removeContents( tabsToRemove[ i ] );
217
+ }
218
+
219
+ // Initialize load, show, hide, ok and cancel events.
220
+ if ( definition.onLoad )
221
+ this.on( 'load', definition.onLoad );
222
+
223
+ if ( definition.onShow )
224
+ this.on( 'show', definition.onShow );
225
+
226
+ if ( definition.onHide )
227
+ this.on( 'hide', definition.onHide );
228
+
229
+ if ( definition.onOk )
230
+ {
231
+ this.on( 'ok', function( evt )
232
+ {
233
+ // Dialog confirm might probably introduce content changes (#5415).
234
+ editor.fire( 'saveSnapshot' );
235
+ setTimeout( function () { editor.fire( 'saveSnapshot' ); }, 0 );
236
+ if ( definition.onOk.call( this, evt ) === false )
237
+ evt.data.hide = false;
238
+ });
239
+ }
240
+
241
+ if ( definition.onCancel )
242
+ {
243
+ this.on( 'cancel', function( evt )
244
+ {
245
+ if ( definition.onCancel.call( this, evt ) === false )
246
+ evt.data.hide = false;
247
+ });
248
+ }
249
+
250
+ var me = this;
251
+
252
+ // Iterates over all items inside all content in the dialog, calling a
253
+ // function for each of them.
254
+ var iterContents = function( func )
255
+ {
256
+ var contents = me._.contents,
257
+ stop = false;
258
+
259
+ for ( var i in contents )
260
+ {
261
+ for ( var j in contents[i] )
262
+ {
263
+ stop = func.call( this, contents[i][j] );
264
+ if ( stop )
265
+ return;
266
+ }
267
+ }
268
+ };
269
+
270
+ this.on( 'ok', function( evt )
271
+ {
272
+ iterContents( function( item )
273
+ {
274
+ if ( item.validate )
275
+ {
276
+ var isValid = item.validate( this );
277
+
278
+ if ( typeof isValid == 'string' )
279
+ {
280
+ alert( isValid );
281
+ isValid = false;
282
+ }
283
+
284
+ if ( isValid === false )
285
+ {
286
+ if ( item.select )
287
+ item.select();
288
+ else
289
+ item.focus();
290
+
291
+ evt.data.hide = false;
292
+ evt.stop();
293
+ return true;
294
+ }
295
+ }
296
+ });
297
+ }, this, null, 0 );
298
+
299
+ this.on( 'cancel', function( evt )
300
+ {
301
+ iterContents( function( item )
302
+ {
303
+ if ( item.isChanged() )
304
+ {
305
+ if ( !confirm( editor.lang.common.confirmCancel ) )
306
+ evt.data.hide = false;
307
+ return true;
308
+ }
309
+ });
310
+ }, this, null, 0 );
311
+
312
+ this.parts.close.on( 'click', function( evt )
313
+ {
314
+ if ( this.fire( 'cancel', { hide : true } ).hide !== false )
315
+ this.hide();
316
+ evt.data.preventDefault();
317
+ }, this );
318
+
319
+ // Sort focus list according to tab order definitions.
320
+ function setupFocus()
321
+ {
322
+ var focusList = me._.focusList;
323
+ focusList.sort( function( a, b )
324
+ {
325
+ // Mimics browser tab order logics;
326
+ if ( a.tabIndex != b.tabIndex )
327
+ return b.tabIndex - a.tabIndex;
328
+ // Sort is not stable in some browsers,
329
+ // fall-back the comparator to 'focusIndex';
330
+ else
331
+ return a.focusIndex - b.focusIndex;
332
+ });
333
+
334
+ var size = focusList.length;
335
+ for ( var i = 0; i < size; i++ )
336
+ focusList[ i ].focusIndex = i;
337
+ }
338
+
339
+ function changeFocus( forward )
340
+ {
341
+ var focusList = me._.focusList,
342
+ offset = forward ? 1 : -1;
343
+ if ( focusList.length < 1 )
344
+ return;
345
+
346
+ var current = me._.currentFocusIndex;
347
+
348
+ // Trigger the 'blur' event of any input element before anything,
349
+ // since certain UI updates may depend on it.
350
+ try
351
+ {
352
+ focusList[ current ].getInputElement().$.blur();
353
+ }
354
+ catch( e ){}
355
+
356
+ var startIndex = ( current + offset + focusList.length ) % focusList.length,
357
+ currentIndex = startIndex;
358
+ while ( !focusList[ currentIndex ].isFocusable() )
359
+ {
360
+ currentIndex = ( currentIndex + offset + focusList.length ) % focusList.length;
361
+ if ( currentIndex == startIndex )
362
+ break;
363
+ }
364
+ focusList[ currentIndex ].focus();
365
+
366
+ // Select whole field content.
367
+ if ( focusList[ currentIndex ].type == 'text' )
368
+ focusList[ currentIndex ].select();
369
+ }
370
+
371
+ this.changeFocus = changeFocus;
372
+
373
+ var processed;
374
+
375
+ function focusKeydownHandler( evt )
376
+ {
377
+ // If I'm not the top dialog, ignore.
378
+ if ( me != CKEDITOR.dialog._.currentTop )
379
+ return;
380
+
381
+ var keystroke = evt.data.getKeystroke(),
382
+ rtl = editor.lang.dir == 'rtl';
383
+
384
+ processed = 0;
385
+ if ( keystroke == 9 || keystroke == CKEDITOR.SHIFT + 9 )
386
+ {
387
+ var shiftPressed = ( keystroke == CKEDITOR.SHIFT + 9 );
388
+
389
+ // Handling Tab and Shift-Tab.
390
+ if ( me._.tabBarMode )
391
+ {
392
+ // Change tabs.
393
+ var nextId = shiftPressed ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me );
394
+ me.selectPage( nextId );
395
+ me._.tabs[ nextId ][ 0 ].focus();
396
+ }
397
+ else
398
+ {
399
+ // Change the focus of inputs.
400
+ changeFocus( !shiftPressed );
401
+ }
402
+
403
+ processed = 1;
404
+ }
405
+ else if ( keystroke == CKEDITOR.ALT + 121 && !me._.tabBarMode && me.getPageCount() > 1 )
406
+ {
407
+ // Alt-F10 puts focus into the current tab item in the tab bar.
408
+ me._.tabBarMode = true;
409
+ me._.tabs[ me._.currentTabId ][ 0 ].focus();
410
+ processed = 1;
411
+ }
412
+ else if ( ( keystroke == 37 || keystroke == 39 ) && me._.tabBarMode )
413
+ {
414
+ // Arrow keys - used for changing tabs.
415
+ nextId = ( keystroke == ( rtl ? 39 : 37 ) ? getPreviousVisibleTab.call( me ) : getNextVisibleTab.call( me ) );
416
+ me.selectPage( nextId );
417
+ me._.tabs[ nextId ][ 0 ].focus();
418
+ processed = 1;
419
+ }
420
+ else if ( ( keystroke == 13 || keystroke == 32 ) && me._.tabBarMode )
421
+ {
422
+ this.selectPage( this._.currentTabId );
423
+ this._.tabBarMode = false;
424
+ this._.currentFocusIndex = -1;
425
+ changeFocus( true );
426
+ processed = 1;
427
+ }
428
+
429
+ if ( processed )
430
+ {
431
+ evt.stop();
432
+ evt.data.preventDefault();
433
+ }
434
+ }
435
+
436
+ function focusKeyPressHandler( evt )
437
+ {
438
+ processed && evt.data.preventDefault();
439
+ }
440
+
441
+ var dialogElement = this._.element;
442
+ // Add the dialog keyboard handlers.
443
+ this.on( 'show', function()
444
+ {
445
+ dialogElement.on( 'keydown', focusKeydownHandler, this, null, 0 );
446
+ // Some browsers instead, don't cancel key events in the keydown, but in the
447
+ // keypress. So we must do a longer trip in those cases. (#4531)
448
+ if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) )
449
+ dialogElement.on( 'keypress', focusKeyPressHandler, this );
450
+
451
+ } );
452
+ this.on( 'hide', function()
453
+ {
454
+ dialogElement.removeListener( 'keydown', focusKeydownHandler );
455
+ if ( CKEDITOR.env.opera || ( CKEDITOR.env.gecko && CKEDITOR.env.mac ) )
456
+ dialogElement.removeListener( 'keypress', focusKeyPressHandler );
457
+ } );
458
+ this.on( 'iframeAdded', function( evt )
459
+ {
460
+ var doc = new CKEDITOR.dom.document( evt.data.iframe.$.contentWindow.document );
461
+ doc.on( 'keydown', focusKeydownHandler, this, null, 0 );
462
+ } );
463
+
464
+ // Auto-focus logic in dialog.
465
+ this.on( 'show', function()
466
+ {
467
+ // Setup tabIndex on showing the dialog instead of on loading
468
+ // to allow dynamic tab order happen in dialog definition.
469
+ setupFocus();
470
+
471
+ if ( editor.config.dialog_startupFocusTab
472
+ && me._.pageCount > 1 )
473
+ {
474
+ me._.tabBarMode = true;
475
+ me._.tabs[ me._.currentTabId ][ 0 ].focus();
476
+ }
477
+ else if ( !this._.hasFocus )
478
+ {
479
+ this._.currentFocusIndex = -1;
480
+
481
+ // Decide where to put the initial focus.
482
+ if ( definition.onFocus )
483
+ {
484
+ var initialFocus = definition.onFocus.call( this );
485
+ // Focus the field that the user specified.
486
+ initialFocus && initialFocus.focus();
487
+ }
488
+ // Focus the first field in layout order.
489
+ else
490
+ changeFocus( true );
491
+
492
+ /*
493
+ * IE BUG: If the initial focus went into a non-text element (e.g. button),
494
+ * then IE would still leave the caret inside the editing area.
495
+ */
496
+ if ( this._.editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
497
+ {
498
+ var $selection = editor.document.$.selection,
499
+ $range = $selection.createRange();
500
+
501
+ if ( $range )
502
+ {
503
+ if ( $range.parentElement && $range.parentElement().ownerDocument == editor.document.$
504
+ || $range.item && $range.item( 0 ).ownerDocument == editor.document.$ )
505
+ {
506
+ var $myRange = document.body.createTextRange();
507
+ $myRange.moveToElementText( this.getElement().getFirst().$ );
508
+ $myRange.collapse( true );
509
+ $myRange.select();
510
+ }
511
+ }
512
+ }
513
+ }
514
+ }, this, null, 0xffffffff );
515
+
516
+ // IE6 BUG: Text fields and text areas are only half-rendered the first time the dialog appears in IE6 (#2661).
517
+ // This is still needed after [2708] and [2709] because text fields in hidden TR tags are still broken.
518
+ if ( CKEDITOR.env.ie6Compat )
519
+ {
520
+ this.on( 'load', function( evt )
521
+ {
522
+ var outer = this.getElement(),
523
+ inner = outer.getFirst();
524
+ inner.remove();
525
+ inner.appendTo( outer );
526
+ }, this );
527
+ }
528
+
529
+ initDragAndDrop( this );
530
+ initResizeHandles( this );
531
+
532
+ // Insert the title.
533
+ ( new CKEDITOR.dom.text( definition.title, CKEDITOR.document ) ).appendTo( this.parts.title );
534
+
535
+ // Insert the tabs and contents.
536
+ for ( var i = 0 ; i < definition.contents.length ; i++ )
537
+ {
538
+ var page = definition.contents[i];
539
+ page && this.addPage( page );
540
+ }
541
+
542
+ this.parts[ 'tabs' ].on( 'click', function( evt )
543
+ {
544
+ var target = evt.data.getTarget();
545
+ // If we aren't inside a tab, bail out.
546
+ if ( target.hasClass( 'cke_dialog_tab' ) )
547
+ {
548
+ // Get the ID of the tab, without the 'cke_' prefix and the unique number suffix.
549
+ var id = target.$.id;
550
+ this.selectPage( id.substring( 4, id.lastIndexOf( '_' ) ) );
551
+
552
+ if ( this._.tabBarMode )
553
+ {
554
+ this._.tabBarMode = false;
555
+ this._.currentFocusIndex = -1;
556
+ changeFocus( true );
557
+ }
558
+ evt.data.preventDefault();
559
+ }
560
+ }, this );
561
+
562
+ // Insert buttons.
563
+ var buttonsHtml = [],
564
+ buttons = CKEDITOR.dialog._.uiElementBuilders.hbox.build( this,
565
+ {
566
+ type : 'hbox',
567
+ className : 'cke_dialog_footer_buttons',
568
+ widths : [],
569
+ children : definition.buttons
570
+ }, buttonsHtml ).getChild();
571
+ this.parts.footer.setHtml( buttonsHtml.join( '' ) );
572
+
573
+ for ( i = 0 ; i < buttons.length ; i++ )
574
+ this._.buttons[ buttons[i].id ] = buttons[i];
575
+ };
576
+
577
+ // Focusable interface. Use it via dialog.addFocusable.
578
+ function Focusable( dialog, element, index )
579
+ {
580
+ this.element = element;
581
+ this.focusIndex = index;
582
+ // TODO: support tabIndex for focusables.
583
+ this.tabIndex = 0;
584
+ this.isFocusable = function()
585
+ {
586
+ return !element.getAttribute( 'disabled' ) && element.isVisible();
587
+ };
588
+ this.focus = function()
589
+ {
590
+ dialog._.currentFocusIndex = this.focusIndex;
591
+ this.element.focus();
592
+ };
593
+ // Bind events
594
+ element.on( 'keydown', function( e )
595
+ {
596
+ if ( e.data.getKeystroke() in { 32:1, 13:1 } )
597
+ this.fire( 'click' );
598
+ } );
599
+ element.on( 'focus', function()
600
+ {
601
+ this.fire( 'mouseover' );
602
+ } );
603
+ element.on( 'blur', function()
604
+ {
605
+ this.fire( 'mouseout' );
606
+ } );
607
+ }
608
+
609
+ CKEDITOR.dialog.prototype =
610
+ {
611
+ destroy : function()
612
+ {
613
+ this.hide();
614
+ this._.element.remove();
615
+ },
616
+
617
+ /**
618
+ * Resizes the dialog.
619
+ * @param {Number} width The width of the dialog in pixels.
620
+ * @param {Number} height The height of the dialog in pixels.
621
+ * @function
622
+ * @example
623
+ * dialogObj.resize( 800, 640 );
624
+ */
625
+ resize : (function()
626
+ {
627
+ return function( width, height )
628
+ {
629
+ if ( this._.contentSize && this._.contentSize.width == width && this._.contentSize.height == height )
630
+ return;
631
+
632
+ CKEDITOR.dialog.fire( 'resize',
633
+ {
634
+ dialog : this,
635
+ skin : this._.editor.skinName,
636
+ width : width,
637
+ height : height
638
+ }, this._.editor );
639
+
640
+ this.fire( 'resize',
641
+ {
642
+ skin : this._.editor.skinName,
643
+ width : width,
644
+ height : height
645
+ }, this._.editor );
646
+
647
+ // Update dialog position when dimension get changed in RTL.
648
+ if ( this._.editor.lang.dir == 'rtl' && this._.position )
649
+ this._.position.x = CKEDITOR.document.getWindow().getViewPaneSize().width -
650
+ this._.contentSize.width - parseInt( this._.element.getFirst().getStyle( 'right' ), 10 );
651
+
652
+ this._.contentSize = { width : width, height : height };
653
+ };
654
+ })(),
655
+
656
+ /**
657
+ * Gets the current size of the dialog in pixels.
658
+ * @returns {Object} An object with "width" and "height" properties.
659
+ * @example
660
+ * var width = dialogObj.getSize().width;
661
+ */
662
+ getSize : function()
663
+ {
664
+ var element = this._.element.getFirst();
665
+ return { width : element.$.offsetWidth || 0, height : element.$.offsetHeight || 0};
666
+ },
667
+
668
+ /**
669
+ * Moves the dialog to an (x, y) coordinate relative to the window.
670
+ * @function
671
+ * @param {Number} x The target x-coordinate.
672
+ * @param {Number} y The target y-coordinate.
673
+ * @param {Boolean} save Flag indicate whether the dialog position should be remembered on next open up.
674
+ * @example
675
+ * dialogObj.move( 10, 40 );
676
+ */
677
+ move : (function()
678
+ {
679
+ var isFixed;
680
+ return function( x, y, save )
681
+ {
682
+ // The dialog may be fixed positioned or absolute positioned. Ask the
683
+ // browser what is the current situation first.
684
+ var element = this._.element.getFirst(),
685
+ rtl = this._.editor.lang.dir == 'rtl';
686
+
687
+ if ( isFixed === undefined )
688
+ isFixed = element.getComputedStyle( 'position' ) == 'fixed';
689
+
690
+ if ( isFixed && this._.position && this._.position.x == x && this._.position.y == y )
691
+ return;
692
+
693
+ // Save the current position.
694
+ this._.position = { x : x, y : y };
695
+
696
+ // If not fixed positioned, add scroll position to the coordinates.
697
+ if ( !isFixed )
698
+ {
699
+ var scrollPosition = CKEDITOR.document.getWindow().getScrollPosition();
700
+ x += scrollPosition.x;
701
+ y += scrollPosition.y;
702
+ }
703
+
704
+ // Translate coordinate for RTL.
705
+ if ( rtl )
706
+ {
707
+ var dialogSize = this.getSize(),
708
+ viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize();
709
+ x = viewPaneSize.width - dialogSize.width - x;
710
+ }
711
+
712
+ var styles = { 'top' : ( y > 0 ? y : 0 ) + 'px' };
713
+ styles[ rtl ? 'right' : 'left' ] = ( x > 0 ? x : 0 ) + 'px';
714
+
715
+ element.setStyles( styles );
716
+
717
+ save && ( this._.moved = 1 );
718
+ };
719
+ })(),
720
+
721
+ /**
722
+ * Gets the dialog's position in the window.
723
+ * @returns {Object} An object with "x" and "y" properties.
724
+ * @example
725
+ * var dialogX = dialogObj.getPosition().x;
726
+ */
727
+ getPosition : function(){ return CKEDITOR.tools.extend( {}, this._.position ); },
728
+
729
+ /**
730
+ * Shows the dialog box.
731
+ * @example
732
+ * dialogObj.show();
733
+ */
734
+ show : function()
735
+ {
736
+ // Insert the dialog's element to the root document.
737
+ var element = this._.element;
738
+ var definition = this.definition;
739
+ if ( !( element.getParent() && element.getParent().equals( CKEDITOR.document.getBody() ) ) )
740
+ element.appendTo( CKEDITOR.document.getBody() );
741
+ else
742
+ element.setStyle( 'display', 'block' );
743
+
744
+ // FIREFOX BUG: Fix vanishing caret for Firefox 2 or Gecko 1.8.
745
+ if ( CKEDITOR.env.gecko && CKEDITOR.env.version < 10900 )
746
+ {
747
+ var dialogElement = this.parts.dialog;
748
+ dialogElement.setStyle( 'position', 'absolute' );
749
+ setTimeout( function()
750
+ {
751
+ dialogElement.setStyle( 'position', 'fixed' );
752
+ }, 0 );
753
+ }
754
+
755
+
756
+ // First, set the dialog to an appropriate size.
757
+ this.resize( this._.contentSize && this._.contentSize.width || definition.width || definition.minWidth,
758
+ this._.contentSize && this._.contentSize.height || definition.height || definition.minHeight );
759
+
760
+ // Reset all inputs back to their default value.
761
+ this.reset();
762
+
763
+ // Select the first tab by default.
764
+ this.selectPage( this.definition.contents[0].id );
765
+
766
+ // Set z-index.
767
+ if ( CKEDITOR.dialog._.currentZIndex === null )
768
+ CKEDITOR.dialog._.currentZIndex = this._.editor.config.baseFloatZIndex;
769
+ this._.element.getFirst().setStyle( 'z-index', CKEDITOR.dialog._.currentZIndex += 10 );
770
+
771
+ // Maintain the dialog ordering and dialog cover.
772
+ // Also register key handlers if first dialog.
773
+ if ( CKEDITOR.dialog._.currentTop === null )
774
+ {
775
+ CKEDITOR.dialog._.currentTop = this;
776
+ this._.parentDialog = null;
777
+ showCover( this._.editor );
778
+
779
+ element.on( 'keydown', accessKeyDownHandler );
780
+ element.on( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler );
781
+
782
+ // Prevent some keys from bubbling up. (#4269)
783
+ for ( var event in { keyup :1, keydown :1, keypress :1 } )
784
+ element.on( event, preventKeyBubbling );
785
+ }
786
+ else
787
+ {
788
+ this._.parentDialog = CKEDITOR.dialog._.currentTop;
789
+ var parentElement = this._.parentDialog.getElement().getFirst();
790
+ parentElement.$.style.zIndex -= Math.floor( this._.editor.config.baseFloatZIndex / 2 );
791
+ CKEDITOR.dialog._.currentTop = this;
792
+ }
793
+
794
+ // Register the Esc hotkeys.
795
+ registerAccessKey( this, this, '\x1b', null, function()
796
+ {
797
+ this.getButton( 'cancel' ) && this.getButton( 'cancel' ).click();
798
+ } );
799
+
800
+ // Reset the hasFocus state.
801
+ this._.hasFocus = false;
802
+
803
+ CKEDITOR.tools.setTimeout( function()
804
+ {
805
+ this.layout();
806
+ this.parts.dialog.setStyle( 'visibility', '' );
807
+
808
+ // Execute onLoad for the first show.
809
+ this.fireOnce( 'load', {} );
810
+ CKEDITOR.ui.fire( 'ready', this );
811
+
812
+ this.fire( 'show', {} );
813
+ this._.editor.fire( 'dialogShow', this );
814
+
815
+ // Save the initial values of the dialog.
816
+ this.foreach( function( contentObj ) { contentObj.setInitValue && contentObj.setInitValue(); } );
817
+
818
+ },
819
+ 100, this );
820
+ },
821
+
822
+ /**
823
+ * Rearrange the dialog to its previous position or the middle of the window.
824
+ * @since 3.5
825
+ */
826
+ layout : function()
827
+ {
828
+ var viewSize = CKEDITOR.document.getWindow().getViewPaneSize(),
829
+ dialogSize = this.getSize();
830
+
831
+ this.move( this._.moved ? this._.position.x : ( viewSize.width - dialogSize.width ) / 2,
832
+ this._.moved ? this._.position.y : ( viewSize.height - dialogSize.height ) / 2 );
833
+ },
834
+
835
+ /**
836
+ * Executes a function for each UI element.
837
+ * @param {Function} fn Function to execute for each UI element.
838
+ * @returns {CKEDITOR.dialog} The current dialog object.
839
+ */
840
+ foreach : function( fn )
841
+ {
842
+ for ( var i in this._.contents )
843
+ {
844
+ for ( var j in this._.contents[i] )
845
+ fn( this._.contents[i][j] );
846
+ }
847
+ return this;
848
+ },
849
+
850
+ /**
851
+ * Resets all input values in the dialog.
852
+ * @example
853
+ * dialogObj.reset();
854
+ * @returns {CKEDITOR.dialog} The current dialog object.
855
+ */
856
+ reset : (function()
857
+ {
858
+ var fn = function( widget ){ if ( widget.reset ) widget.reset( 1 ); };
859
+ return function(){ this.foreach( fn ); return this; };
860
+ })(),
861
+
862
+
863
+ /**
864
+ * Calls the {@link CKEDITOR.dialog.definition.uiElement#setup} method of each of the UI elements, with the arguments passed through it.
865
+ * It is usually being called when the dialog is opened, to put the initial value inside the field.
866
+ * @example
867
+ * dialogObj.setupContent();
868
+ * @example
869
+ * var timestamp = ( new Date() ).valueOf();
870
+ * dialogObj.setupContent( timestamp );
871
+ */
872
+ setupContent : function()
873
+ {
874
+ var args = arguments;
875
+ this.foreach( function( widget )
876
+ {
877
+ if ( widget.setup )
878
+ widget.setup.apply( widget, args );
879
+ });
880
+ },
881
+
882
+ /**
883
+ * Calls the {@link CKEDITOR.dialog.definition.uiElement#commit} method of each of the UI elements, with the arguments passed through it.
884
+ * It is usually being called when the user confirms the dialog, to process the values.
885
+ * @example
886
+ * dialogObj.commitContent();
887
+ * @example
888
+ * var timestamp = ( new Date() ).valueOf();
889
+ * dialogObj.commitContent( timestamp );
890
+ */
891
+ commitContent : function()
892
+ {
893
+ var args = arguments;
894
+ this.foreach( function( widget )
895
+ {
896
+ if ( widget.commit )
897
+ widget.commit.apply( widget, args );
898
+ });
899
+ },
900
+
901
+ /**
902
+ * Hides the dialog box.
903
+ * @example
904
+ * dialogObj.hide();
905
+ */
906
+ hide : function()
907
+ {
908
+ if ( !this.parts.dialog.isVisible() )
909
+ return;
910
+
911
+ this.fire( 'hide', {} );
912
+ this._.editor.fire( 'dialogHide', this );
913
+ var element = this._.element;
914
+ element.setStyle( 'display', 'none' );
915
+ this.parts.dialog.setStyle( 'visibility', 'hidden' );
916
+ // Unregister all access keys associated with this dialog.
917
+ unregisterAccessKey( this );
918
+
919
+ // Close any child(top) dialogs first.
920
+ while( CKEDITOR.dialog._.currentTop != this )
921
+ CKEDITOR.dialog._.currentTop.hide();
922
+
923
+ // Maintain dialog ordering and remove cover if needed.
924
+ if ( !this._.parentDialog )
925
+ hideCover();
926
+ else
927
+ {
928
+ var parentElement = this._.parentDialog.getElement().getFirst();
929
+ parentElement.setStyle( 'z-index', parseInt( parentElement.$.style.zIndex, 10 ) + Math.floor( this._.editor.config.baseFloatZIndex / 2 ) );
930
+ }
931
+ CKEDITOR.dialog._.currentTop = this._.parentDialog;
932
+
933
+ // Deduct or clear the z-index.
934
+ if ( !this._.parentDialog )
935
+ {
936
+ CKEDITOR.dialog._.currentZIndex = null;
937
+
938
+ // Remove access key handlers.
939
+ element.removeListener( 'keydown', accessKeyDownHandler );
940
+ element.removeListener( CKEDITOR.env.opera ? 'keypress' : 'keyup', accessKeyUpHandler );
941
+
942
+ // Remove bubbling-prevention handler. (#4269)
943
+ for ( var event in { keyup :1, keydown :1, keypress :1 } )
944
+ element.removeListener( event, preventKeyBubbling );
945
+
946
+ var editor = this._.editor;
947
+ editor.focus();
948
+
949
+ if ( editor.mode == 'wysiwyg' && CKEDITOR.env.ie )
950
+ {
951
+ var selection = editor.getSelection();
952
+ selection && selection.unlock( true );
953
+ }
954
+ }
955
+ else
956
+ CKEDITOR.dialog._.currentZIndex -= 10;
957
+
958
+ delete this._.parentDialog;
959
+ // Reset the initial values of the dialog.
960
+ this.foreach( function( contentObj ) { contentObj.resetInitValue && contentObj.resetInitValue(); } );
961
+ },
962
+
963
+ /**
964
+ * Adds a tabbed page into the dialog.
965
+ * @param {Object} contents Content definition.
966
+ * @example
967
+ */
968
+ addPage : function( contents )
969
+ {
970
+ var pageHtml = [],
971
+ titleHtml = contents.label ? ' title="' + CKEDITOR.tools.htmlEncode( contents.label ) + '"' : '',
972
+ elements = contents.elements,
973
+ vbox = CKEDITOR.dialog._.uiElementBuilders.vbox.build( this,
974
+ {
975
+ type : 'vbox',
976
+ className : 'cke_dialog_page_contents',
977
+ children : contents.elements,
978
+ expand : !!contents.expand,
979
+ padding : contents.padding,
980
+ style : contents.style || 'width: 100%;height:100%'
981
+ }, pageHtml );
982
+
983
+ // Create the HTML for the tab and the content block.
984
+ var page = CKEDITOR.dom.element.createFromHtml( pageHtml.join( '' ) );
985
+ page.setAttribute( 'role', 'tabpanel' );
986
+
987
+ var env = CKEDITOR.env;
988
+ var tabId = 'cke_' + contents.id + '_' + CKEDITOR.tools.getNextNumber(),
989
+ tab = CKEDITOR.dom.element.createFromHtml( [
990
+ '<a class="cke_dialog_tab"',
991
+ ( this._.pageCount > 0 ? ' cke_last' : 'cke_first' ),
992
+ titleHtml,
993
+ ( !!contents.hidden ? ' style="display:none"' : '' ),
994
+ ' id="', tabId, '"',
995
+ env.gecko && env.version >= 10900 && !env.hc ? '' : ' href="javascript:void(0)"',
996
+ ' tabIndex="-1"',
997
+ ' hidefocus="true"',
998
+ ' role="tab">',
999
+ contents.label,
1000
+ '</a>'
1001
+ ].join( '' ) );
1002
+
1003
+ page.setAttribute( 'aria-labelledby', tabId );
1004
+
1005
+ // Take records for the tabs and elements created.
1006
+ this._.tabs[ contents.id ] = [ tab, page ];
1007
+ this._.tabIdList.push( contents.id );
1008
+ !contents.hidden && this._.pageCount++;
1009
+ this._.lastTab = tab;
1010
+ this.updateStyle();
1011
+
1012
+ var contentMap = this._.contents[ contents.id ] = {},
1013
+ cursor,
1014
+ children = vbox.getChild();
1015
+
1016
+ while ( ( cursor = children.shift() ) )
1017
+ {
1018
+ contentMap[ cursor.id ] = cursor;
1019
+ if ( typeof( cursor.getChild ) == 'function' )
1020
+ children.push.apply( children, cursor.getChild() );
1021
+ }
1022
+
1023
+ // Attach the DOM nodes.
1024
+
1025
+ page.setAttribute( 'name', contents.id );
1026
+ page.appendTo( this.parts.contents );
1027
+
1028
+ tab.unselectable();
1029
+ this.parts.tabs.append( tab );
1030
+
1031
+ // Add access key handlers if access key is defined.
1032
+ if ( contents.accessKey )
1033
+ {
1034
+ registerAccessKey( this, this, 'CTRL+' + contents.accessKey,
1035
+ tabAccessKeyDown, tabAccessKeyUp );
1036
+ this._.accessKeyMap[ 'CTRL+' + contents.accessKey ] = contents.id;
1037
+ }
1038
+ },
1039
+
1040
+ /**
1041
+ * Activates a tab page in the dialog by its id.
1042
+ * @param {String} id The id of the dialog tab to be activated.
1043
+ * @example
1044
+ * dialogObj.selectPage( 'tab_1' );
1045
+ */
1046
+ selectPage : function( id )
1047
+ {
1048
+ if ( this._.currentTabId == id )
1049
+ return;
1050
+
1051
+ // Returning true means that the event has been canceled
1052
+ if ( this.fire( 'selectPage', { page : id, currentPage : this._.currentTabId } ) === true )
1053
+ return;
1054
+
1055
+ // Hide the non-selected tabs and pages.
1056
+ for ( var i in this._.tabs )
1057
+ {
1058
+ var tab = this._.tabs[i][0],
1059
+ page = this._.tabs[i][1];
1060
+ if ( i != id )
1061
+ {
1062
+ tab.removeClass( 'cke_dialog_tab_selected' );
1063
+ page.hide();
1064
+ }
1065
+ page.setAttribute( 'aria-hidden', i != id );
1066
+ }
1067
+
1068
+ var selected = this._.tabs[ id ];
1069
+ selected[ 0 ].addClass( 'cke_dialog_tab_selected' );
1070
+
1071
+ // [IE] an invisible input[type='text'] will enlarge it's width
1072
+ // if it's value is long when it shows, so we clear it's value
1073
+ // before it shows and then recover it (#5649)
1074
+ if ( CKEDITOR.env.ie6Compat || CKEDITOR.env.ie7Compat )
1075
+ {
1076
+ clearOrRecoverTextInputValue( selected[ 1 ] );
1077
+ selected[ 1 ].show();
1078
+ setTimeout( function()
1079
+ {
1080
+ clearOrRecoverTextInputValue( selected[ 1 ], 1 );
1081
+ }, 0 );
1082
+ }
1083
+ else
1084
+ selected[ 1 ].show();
1085
+
1086
+ this._.currentTabId = id;
1087
+ this._.currentTabIndex = CKEDITOR.tools.indexOf( this._.tabIdList, id );
1088
+ },
1089
+
1090
+ // Dialog state-specific style updates.
1091
+ updateStyle : function()
1092
+ {
1093
+ // If only a single page shown, a different style is used in the central pane.
1094
+ this.parts.dialog[ ( this._.pageCount === 1 ? 'add' : 'remove' ) + 'Class' ]( 'cke_single_page' );
1095
+ },
1096
+
1097
+ /**
1098
+ * Hides a page's tab away from the dialog.
1099
+ * @param {String} id The page's Id.
1100
+ * @example
1101
+ * dialog.hidePage( 'tab_3' );
1102
+ */
1103
+ hidePage : function( id )
1104
+ {
1105
+ var tab = this._.tabs[id] && this._.tabs[id][0];
1106
+ if ( !tab || this._.pageCount == 1 || !tab.isVisible() )
1107
+ return;
1108
+ // Switch to other tab first when we're hiding the active tab.
1109
+ else if ( id == this._.currentTabId )
1110
+ this.selectPage( getPreviousVisibleTab.call( this ) );
1111
+
1112
+ tab.hide();
1113
+ this._.pageCount--;
1114
+ this.updateStyle();
1115
+ },
1116
+
1117
+ /**
1118
+ * Unhides a page's tab.
1119
+ * @param {String} id The page's Id.
1120
+ * @example
1121
+ * dialog.showPage( 'tab_2' );
1122
+ */
1123
+ showPage : function( id )
1124
+ {
1125
+ var tab = this._.tabs[id] && this._.tabs[id][0];
1126
+ if ( !tab )
1127
+ return;
1128
+ tab.show();
1129
+ this._.pageCount++;
1130
+ this.updateStyle();
1131
+ },
1132
+
1133
+ /**
1134
+ * Gets the root DOM element of the dialog.
1135
+ * @returns {CKEDITOR.dom.element} The &lt;span&gt; element containing this dialog.
1136
+ * @example
1137
+ * var dialogElement = dialogObj.getElement().getFirst();
1138
+ * dialogElement.setStyle( 'padding', '5px' );
1139
+ */
1140
+ getElement : function()
1141
+ {
1142
+ return this._.element;
1143
+ },
1144
+
1145
+ /**
1146
+ * Gets the name of the dialog.
1147
+ * @returns {String} The name of this dialog.
1148
+ * @example
1149
+ * var dialogName = dialogObj.getName();
1150
+ */
1151
+ getName : function()
1152
+ {
1153
+ return this._.name;
1154
+ },
1155
+
1156
+ /**
1157
+ * Gets a dialog UI element object from a dialog page.
1158
+ * @param {String} pageId id of dialog page.
1159
+ * @param {String} elementId id of UI element.
1160
+ * @example
1161
+ * dialogObj.getContentElement( 'tabId', 'elementId' ).setValue( 'Example' );
1162
+ * @returns {CKEDITOR.ui.dialog.uiElement} The dialog UI element.
1163
+ */
1164
+ getContentElement : function( pageId, elementId )
1165
+ {
1166
+ var page = this._.contents[ pageId ];
1167
+ return page && page[ elementId ];
1168
+ },
1169
+
1170
+ /**
1171
+ * Gets the value of a dialog UI element.
1172
+ * @param {String} pageId id of dialog page.
1173
+ * @param {String} elementId id of UI element.
1174
+ * @example
1175
+ * alert( dialogObj.getValueOf( 'tabId', 'elementId' ) );
1176
+ * @returns {Object} The value of the UI element.
1177
+ */
1178
+ getValueOf : function( pageId, elementId )
1179
+ {
1180
+ return this.getContentElement( pageId, elementId ).getValue();
1181
+ },
1182
+
1183
+ /**
1184
+ * Sets the value of a dialog UI element.
1185
+ * @param {String} pageId id of the dialog page.
1186
+ * @param {String} elementId id of the UI element.
1187
+ * @param {Object} value The new value of the UI element.
1188
+ * @example
1189
+ * dialogObj.setValueOf( 'tabId', 'elementId', 'Example' );
1190
+ */
1191
+ setValueOf : function( pageId, elementId, value )
1192
+ {
1193
+ return this.getContentElement( pageId, elementId ).setValue( value );
1194
+ },
1195
+
1196
+ /**
1197
+ * Gets the UI element of a button in the dialog's button row.
1198
+ * @param {String} id The id of the button.
1199
+ * @example
1200
+ * @returns {CKEDITOR.ui.dialog.button} The button object.
1201
+ */
1202
+ getButton : function( id )
1203
+ {
1204
+ return this._.buttons[ id ];
1205
+ },
1206
+
1207
+ /**
1208
+ * Simulates a click to a dialog button in the dialog's button row.
1209
+ * @param {String} id The id of the button.
1210
+ * @example
1211
+ * @returns The return value of the dialog's "click" event.
1212
+ */
1213
+ click : function( id )
1214
+ {
1215
+ return this._.buttons[ id ].click();
1216
+ },
1217
+
1218
+ /**
1219
+ * Disables a dialog button.
1220
+ * @param {String} id The id of the button.
1221
+ * @example
1222
+ */
1223
+ disableButton : function( id )
1224
+ {
1225
+ return this._.buttons[ id ].disable();
1226
+ },
1227
+
1228
+ /**
1229
+ * Enables a dialog button.
1230
+ * @param {String} id The id of the button.
1231
+ * @example
1232
+ */
1233
+ enableButton : function( id )
1234
+ {
1235
+ return this._.buttons[ id ].enable();
1236
+ },
1237
+
1238
+ /**
1239
+ * Gets the number of pages in the dialog.
1240
+ * @returns {Number} Page count.
1241
+ */
1242
+ getPageCount : function()
1243
+ {
1244
+ return this._.pageCount;
1245
+ },
1246
+
1247
+ /**
1248
+ * Gets the editor instance which opened this dialog.
1249
+ * @returns {CKEDITOR.editor} Parent editor instances.
1250
+ */
1251
+ getParentEditor : function()
1252
+ {
1253
+ return this._.editor;
1254
+ },
1255
+
1256
+ /**
1257
+ * Gets the element that was selected when opening the dialog, if any.
1258
+ * @returns {CKEDITOR.dom.element} The element that was selected, or null.
1259
+ */
1260
+ getSelectedElement : function()
1261
+ {
1262
+ return this.getParentEditor().getSelection().getSelectedElement();
1263
+ },
1264
+
1265
+ /**
1266
+ * Adds element to dialog's focusable list.
1267
+ *
1268
+ * @param {CKEDITOR.dom.element} element
1269
+ * @param {Number} [index]
1270
+ */
1271
+ addFocusable: function( element, index ) {
1272
+ if ( typeof index == 'undefined' )
1273
+ {
1274
+ index = this._.focusList.length;
1275
+ this._.focusList.push( new Focusable( this, element, index ) );
1276
+ }
1277
+ else
1278
+ {
1279
+ this._.focusList.splice( index, 0, new Focusable( this, element, index ) );
1280
+ for ( var i = index + 1 ; i < this._.focusList.length ; i++ )
1281
+ this._.focusList[ i ].focusIndex++;
1282
+ }
1283
+ }
1284
+ };
1285
+
1286
+ CKEDITOR.tools.extend( CKEDITOR.dialog,
1287
+ /**
1288
+ * @lends CKEDITOR.dialog
1289
+ */
1290
+ {
1291
+ /**
1292
+ * Registers a dialog.
1293
+ * @param {String} name The dialog's name.
1294
+ * @param {Function|String} dialogDefinition
1295
+ * A function returning the dialog's definition, or the URL to the .js file holding the function.
1296
+ * The function should accept an argument "editor" which is the current editor instance, and
1297
+ * return an object conforming to {@link CKEDITOR.dialog.definition}.
1298
+ * @see CKEDITOR.dialog.definition
1299
+ * @example
1300
+ * // Full sample plugin, which does not only register a dialog window but also adds an item to the context menu.
1301
+ * // To open the dialog window, choose "Open dialog" in the context menu.
1302
+ * CKEDITOR.plugins.add( 'myplugin',
1303
+ * {
1304
+ * init: function( editor )
1305
+ * {
1306
+ * editor.addCommand( 'mydialog',new CKEDITOR.dialogCommand( 'mydialog' ) );
1307
+ *
1308
+ * if ( editor.contextMenu )
1309
+ * {
1310
+ * editor.addMenuGroup( 'mygroup', 10 );
1311
+ * editor.addMenuItem( 'My Dialog',
1312
+ * {
1313
+ * label : 'Open dialog',
1314
+ * command : 'mydialog',
1315
+ * group : 'mygroup'
1316
+ * });
1317
+ * editor.contextMenu.addListener( function( element )
1318
+ * {
1319
+ * return { 'My Dialog' : CKEDITOR.TRISTATE_OFF };
1320
+ * });
1321
+ * }
1322
+ *
1323
+ * <strong>CKEDITOR.dialog.add</strong>( 'mydialog', function( api )
1324
+ * {
1325
+ * // CKEDITOR.dialog.definition
1326
+ * var <strong>dialogDefinition</strong> =
1327
+ * {
1328
+ * title : 'Sample dialog',
1329
+ * minWidth : 390,
1330
+ * minHeight : 130,
1331
+ * contents : [
1332
+ * {
1333
+ * id : 'tab1',
1334
+ * label : 'Label',
1335
+ * title : 'Title',
1336
+ * expand : true,
1337
+ * padding : 0,
1338
+ * elements :
1339
+ * [
1340
+ * {
1341
+ * type : 'html',
1342
+ * html : '&lt;p&gt;This is some sample HTML content.&lt;/p&gt;'
1343
+ * },
1344
+ * {
1345
+ * type : 'textarea',
1346
+ * id : 'textareaId',
1347
+ * rows : 4,
1348
+ * cols : 40
1349
+ * }
1350
+ * ]
1351
+ * }
1352
+ * ],
1353
+ * buttons : [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ],
1354
+ * onOk : function() {
1355
+ * // "this" is now a CKEDITOR.dialog object.
1356
+ * // Accessing dialog elements:
1357
+ * var textareaObj = this.<strong>getContentElement</strong>( 'tab1', 'textareaId' );
1358
+ * alert( "You have entered: " + textareaObj.getValue() );
1359
+ * }
1360
+ * };
1361
+ *
1362
+ * return dialogDefinition;
1363
+ * } );
1364
+ * }
1365
+ * } );
1366
+ *
1367
+ * CKEDITOR.replace( 'editor1', { extraPlugins : 'myplugin' } );
1368
+ */
1369
+ add : function( name, dialogDefinition )
1370
+ {
1371
+ // Avoid path registration from multiple instances override definition.
1372
+ if ( !this._.dialogDefinitions[name]
1373
+ || typeof dialogDefinition == 'function' )
1374
+ this._.dialogDefinitions[name] = dialogDefinition;
1375
+ },
1376
+
1377
+ exists : function( name )
1378
+ {
1379
+ return !!this._.dialogDefinitions[ name ];
1380
+ },
1381
+
1382
+ getCurrent : function()
1383
+ {
1384
+ return CKEDITOR.dialog._.currentTop;
1385
+ },
1386
+
1387
+ /**
1388
+ * The default OK button for dialogs. Fires the "ok" event and closes the dialog if the event succeeds.
1389
+ * @static
1390
+ * @field
1391
+ * @example
1392
+ * @type Function
1393
+ */
1394
+ okButton : (function()
1395
+ {
1396
+ var retval = function( editor, override )
1397
+ {
1398
+ override = override || {};
1399
+ return CKEDITOR.tools.extend( {
1400
+ id : 'ok',
1401
+ type : 'button',
1402
+ label : editor.lang.common.ok,
1403
+ 'class' : 'cke_dialog_ui_button_ok',
1404
+ onClick : function( evt )
1405
+ {
1406
+ var dialog = evt.data.dialog;
1407
+ if ( dialog.fire( 'ok', { hide : true } ).hide !== false )
1408
+ dialog.hide();
1409
+ }
1410
+ }, override, true );
1411
+ };
1412
+ retval.type = 'button';
1413
+ retval.override = function( override )
1414
+ {
1415
+ return CKEDITOR.tools.extend( function( editor ){ return retval( editor, override ); },
1416
+ { type : 'button' }, true );
1417
+ };
1418
+ return retval;
1419
+ })(),
1420
+
1421
+ /**
1422
+ * The default cancel button for dialogs. Fires the "cancel" event and closes the dialog if no UI element value changed.
1423
+ * @static
1424
+ * @field
1425
+ * @example
1426
+ * @type Function
1427
+ */
1428
+ cancelButton : (function()
1429
+ {
1430
+ var retval = function( editor, override )
1431
+ {
1432
+ override = override || {};
1433
+ return CKEDITOR.tools.extend( {
1434
+ id : 'cancel',
1435
+ type : 'button',
1436
+ label : editor.lang.common.cancel,
1437
+ 'class' : 'cke_dialog_ui_button_cancel',
1438
+ onClick : function( evt )
1439
+ {
1440
+ var dialog = evt.data.dialog;
1441
+ if ( dialog.fire( 'cancel', { hide : true } ).hide !== false )
1442
+ dialog.hide();
1443
+ }
1444
+ }, override, true );
1445
+ };
1446
+ retval.type = 'button';
1447
+ retval.override = function( override )
1448
+ {
1449
+ return CKEDITOR.tools.extend( function( editor ){ return retval( editor, override ); },
1450
+ { type : 'button' }, true );
1451
+ };
1452
+ return retval;
1453
+ })(),
1454
+
1455
+ /**
1456
+ * Registers a dialog UI element.
1457
+ * @param {String} typeName The name of the UI element.
1458
+ * @param {Function} builder The function to build the UI element.
1459
+ * @example
1460
+ */
1461
+ addUIElement : function( typeName, builder )
1462
+ {
1463
+ this._.uiElementBuilders[ typeName ] = builder;
1464
+ }
1465
+ });
1466
+
1467
+ CKEDITOR.dialog._ =
1468
+ {
1469
+ uiElementBuilders : {},
1470
+
1471
+ dialogDefinitions : {},
1472
+
1473
+ currentTop : null,
1474
+
1475
+ currentZIndex : null
1476
+ };
1477
+
1478
+ // "Inherit" (copy actually) from CKEDITOR.event.
1479
+ CKEDITOR.event.implementOn( CKEDITOR.dialog );
1480
+ CKEDITOR.event.implementOn( CKEDITOR.dialog.prototype, true );
1481
+
1482
+ var defaultDialogDefinition =
1483
+ {
1484
+ resizable : CKEDITOR.DIALOG_RESIZE_BOTH,
1485
+ minWidth : 600,
1486
+ minHeight : 400,
1487
+ buttons : [ CKEDITOR.dialog.okButton, CKEDITOR.dialog.cancelButton ]
1488
+ };
1489
+
1490
+ // Tool function used to return an item from an array based on its id
1491
+ // property.
1492
+ var getById = function( array, id, recurse )
1493
+ {
1494
+ for ( var i = 0, item ; ( item = array[ i ] ) ; i++ )
1495
+ {
1496
+ if ( item.id == id )
1497
+ return item;
1498
+ if ( recurse && item[ recurse ] )
1499
+ {
1500
+ var retval = getById( item[ recurse ], id, recurse ) ;
1501
+ if ( retval )
1502
+ return retval;
1503
+ }
1504
+ }
1505
+ return null;
1506
+ };
1507
+
1508
+ // Tool function used to add an item into an array.
1509
+ var addById = function( array, newItem, nextSiblingId, recurse, nullIfNotFound )
1510
+ {
1511
+ if ( nextSiblingId )
1512
+ {
1513
+ for ( var i = 0, item ; ( item = array[ i ] ) ; i++ )
1514
+ {
1515
+ if ( item.id == nextSiblingId )
1516
+ {
1517
+ array.splice( i, 0, newItem );
1518
+ return newItem;
1519
+ }
1520
+
1521
+ if ( recurse && item[ recurse ] )
1522
+ {
1523
+ var retval = addById( item[ recurse ], newItem, nextSiblingId, recurse, true );
1524
+ if ( retval )
1525
+ return retval;
1526
+ }
1527
+ }
1528
+
1529
+ if ( nullIfNotFound )
1530
+ return null;
1531
+ }
1532
+
1533
+ array.push( newItem );
1534
+ return newItem;
1535
+ };
1536
+
1537
+ // Tool function used to remove an item from an array based on its id.
1538
+ var removeById = function( array, id, recurse )
1539
+ {
1540
+ for ( var i = 0, item ; ( item = array[ i ] ) ; i++ )
1541
+ {
1542
+ if ( item.id == id )
1543
+ return array.splice( i, 1 );
1544
+ if ( recurse && item[ recurse ] )
1545
+ {
1546
+ var retval = removeById( item[ recurse ], id, recurse );
1547
+ if ( retval )
1548
+ return retval;
1549
+ }
1550
+ }
1551
+ return null;
1552
+ };
1553
+
1554
+ /**
1555
+ * This class is not really part of the API. It is the "definition" property value
1556
+ * passed to "dialogDefinition" event handlers.
1557
+ * @constructor
1558
+ * @name CKEDITOR.dialog.definitionObject
1559
+ * @extends CKEDITOR.dialog.definition
1560
+ * @example
1561
+ * CKEDITOR.on( 'dialogDefinition', function( evt )
1562
+ * {
1563
+ * var definition = evt.data.definition;
1564
+ * var content = definition.getContents( 'page1' );
1565
+ * ...
1566
+ * } );
1567
+ */
1568
+ var definitionObject = function( dialog, dialogDefinition )
1569
+ {
1570
+ // TODO : Check if needed.
1571
+ this.dialog = dialog;
1572
+
1573
+ // Transform the contents entries in contentObjects.
1574
+ var contents = dialogDefinition.contents;
1575
+ for ( var i = 0, content ; ( content = contents[i] ) ; i++ )
1576
+ contents[ i ] = content && new contentObject( dialog, content );
1577
+
1578
+ CKEDITOR.tools.extend( this, dialogDefinition );
1579
+ };
1580
+
1581
+ definitionObject.prototype =
1582
+ /** @lends CKEDITOR.dialog.definitionObject.prototype */
1583
+ {
1584
+ /**
1585
+ * Gets a content definition.
1586
+ * @param {String} id The id of the content definition.
1587
+ * @returns {CKEDITOR.dialog.definition.content} The content definition
1588
+ * matching id.
1589
+ */
1590
+ getContents : function( id )
1591
+ {
1592
+ return getById( this.contents, id );
1593
+ },
1594
+
1595
+ /**
1596
+ * Gets a button definition.
1597
+ * @param {String} id The id of the button definition.
1598
+ * @returns {CKEDITOR.dialog.definition.button} The button definition
1599
+ * matching id.
1600
+ */
1601
+ getButton : function( id )
1602
+ {
1603
+ return getById( this.buttons, id );
1604
+ },
1605
+
1606
+ /**
1607
+ * Adds a content definition object under this dialog definition.
1608
+ * @param {CKEDITOR.dialog.definition.content} contentDefinition The
1609
+ * content definition.
1610
+ * @param {String} [nextSiblingId] The id of an existing content
1611
+ * definition which the new content definition will be inserted
1612
+ * before. Omit if the new content definition is to be inserted as
1613
+ * the last item.
1614
+ * @returns {CKEDITOR.dialog.definition.content} The inserted content
1615
+ * definition.
1616
+ */
1617
+ addContents : function( contentDefinition, nextSiblingId )
1618
+ {
1619
+ return addById( this.contents, contentDefinition, nextSiblingId );
1620
+ },
1621
+
1622
+ /**
1623
+ * Adds a button definition object under this dialog definition.
1624
+ * @param {CKEDITOR.dialog.definition.button} buttonDefinition The
1625
+ * button definition.
1626
+ * @param {String} [nextSiblingId] The id of an existing button
1627
+ * definition which the new button definition will be inserted
1628
+ * before. Omit if the new button definition is to be inserted as
1629
+ * the last item.
1630
+ * @returns {CKEDITOR.dialog.definition.button} The inserted button
1631
+ * definition.
1632
+ */
1633
+ addButton : function( buttonDefinition, nextSiblingId )
1634
+ {
1635
+ return addById( this.buttons, buttonDefinition, nextSiblingId );
1636
+ },
1637
+
1638
+ /**
1639
+ * Removes a content definition from this dialog definition.
1640
+ * @param {String} id The id of the content definition to be removed.
1641
+ * @returns {CKEDITOR.dialog.definition.content} The removed content
1642
+ * definition.
1643
+ */
1644
+ removeContents : function( id )
1645
+ {
1646
+ removeById( this.contents, id );
1647
+ },
1648
+
1649
+ /**
1650
+ * Removes a button definition from the dialog definition.
1651
+ * @param {String} id The id of the button definition to be removed.
1652
+ * @returns {CKEDITOR.dialog.definition.button} The removed button
1653
+ * definition.
1654
+ */
1655
+ removeButton : function( id )
1656
+ {
1657
+ removeById( this.buttons, id );
1658
+ }
1659
+ };
1660
+
1661
+ /**
1662
+ * This class is not really part of the API. It is the template of the
1663
+ * objects representing content pages inside the
1664
+ * CKEDITOR.dialog.definitionObject.
1665
+ * @constructor
1666
+ * @name CKEDITOR.dialog.definition.contentObject
1667
+ * @example
1668
+ * CKEDITOR.on( 'dialogDefinition', function( evt )
1669
+ * {
1670
+ * var definition = evt.data.definition;
1671
+ * var content = definition.getContents( 'page1' );
1672
+ * content.remove( 'textInput1' );
1673
+ * ...
1674
+ * } );
1675
+ */
1676
+ function contentObject( dialog, contentDefinition )
1677
+ {
1678
+ this._ =
1679
+ {
1680
+ dialog : dialog
1681
+ };
1682
+
1683
+ CKEDITOR.tools.extend( this, contentDefinition );
1684
+ }
1685
+
1686
+ contentObject.prototype =
1687
+ /** @lends CKEDITOR.dialog.definition.contentObject.prototype */
1688
+ {
1689
+ /**
1690
+ * Gets a UI element definition under the content definition.
1691
+ * @param {String} id The id of the UI element definition.
1692
+ * @returns {CKEDITOR.dialog.definition.uiElement}
1693
+ */
1694
+ get : function( id )
1695
+ {
1696
+ return getById( this.elements, id, 'children' );
1697
+ },
1698
+
1699
+ /**
1700
+ * Adds a UI element definition to the content definition.
1701
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition The
1702
+ * UI elemnet definition to be added.
1703
+ * @param {String} nextSiblingId The id of an existing UI element
1704
+ * definition which the new UI element definition will be inserted
1705
+ * before. Omit if the new button definition is to be inserted as
1706
+ * the last item.
1707
+ * @returns {CKEDITOR.dialog.definition.uiElement} The element
1708
+ * definition inserted.
1709
+ */
1710
+ add : function( elementDefinition, nextSiblingId )
1711
+ {
1712
+ return addById( this.elements, elementDefinition, nextSiblingId, 'children' );
1713
+ },
1714
+
1715
+ /**
1716
+ * Removes a UI element definition from the content definition.
1717
+ * @param {String} id The id of the UI element definition to be
1718
+ * removed.
1719
+ * @returns {CKEDITOR.dialog.definition.uiElement} The element
1720
+ * definition removed.
1721
+ * @example
1722
+ */
1723
+ remove : function( id )
1724
+ {
1725
+ removeById( this.elements, id, 'children' );
1726
+ }
1727
+ };
1728
+
1729
+ function initDragAndDrop( dialog )
1730
+ {
1731
+ var lastCoords = null,
1732
+ abstractDialogCoords = null,
1733
+ element = dialog.getElement().getFirst(),
1734
+ editor = dialog.getParentEditor(),
1735
+ magnetDistance = editor.config.dialog_magnetDistance,
1736
+ margins = editor.skin.margins || [ 0, 0, 0, 0 ];
1737
+
1738
+ if ( typeof magnetDistance == 'undefined' )
1739
+ magnetDistance = 20;
1740
+
1741
+ function mouseMoveHandler( evt )
1742
+ {
1743
+ var dialogSize = dialog.getSize(),
1744
+ viewPaneSize = CKEDITOR.document.getWindow().getViewPaneSize(),
1745
+ x = evt.data.$.screenX,
1746
+ y = evt.data.$.screenY,
1747
+ dx = x - lastCoords.x,
1748
+ dy = y - lastCoords.y,
1749
+ realX, realY;
1750
+
1751
+ lastCoords = { x : x, y : y };
1752
+ abstractDialogCoords.x += dx;
1753
+ abstractDialogCoords.y += dy;
1754
+
1755
+ if ( abstractDialogCoords.x + margins[3] < magnetDistance )
1756
+ realX = - margins[3];
1757
+ else if ( abstractDialogCoords.x - margins[1] > viewPaneSize.width - dialogSize.width - magnetDistance )
1758
+ realX = viewPaneSize.width - dialogSize.width + ( editor.lang.dir == 'rtl' ? 0 : margins[1] );
1759
+ else
1760
+ realX = abstractDialogCoords.x;
1761
+
1762
+ if ( abstractDialogCoords.y + margins[0] < magnetDistance )
1763
+ realY = - margins[0];
1764
+ else if ( abstractDialogCoords.y - margins[2] > viewPaneSize.height - dialogSize.height - magnetDistance )
1765
+ realY = viewPaneSize.height - dialogSize.height + margins[2];
1766
+ else
1767
+ realY = abstractDialogCoords.y;
1768
+
1769
+ dialog.move( realX, realY, 1 );
1770
+
1771
+ evt.data.preventDefault();
1772
+ }
1773
+
1774
+ function mouseUpHandler( evt )
1775
+ {
1776
+ CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler );
1777
+ CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler );
1778
+
1779
+ if ( CKEDITOR.env.ie6Compat )
1780
+ {
1781
+ var coverDoc = currentCover.getChild( 0 ).getFrameDocument();
1782
+ coverDoc.removeListener( 'mousemove', mouseMoveHandler );
1783
+ coverDoc.removeListener( 'mouseup', mouseUpHandler );
1784
+ }
1785
+ }
1786
+
1787
+ dialog.parts.title.on( 'mousedown', function( evt )
1788
+ {
1789
+ lastCoords = { x : evt.data.$.screenX, y : evt.data.$.screenY };
1790
+
1791
+ CKEDITOR.document.on( 'mousemove', mouseMoveHandler );
1792
+ CKEDITOR.document.on( 'mouseup', mouseUpHandler );
1793
+ abstractDialogCoords = dialog.getPosition();
1794
+
1795
+ if ( CKEDITOR.env.ie6Compat )
1796
+ {
1797
+ var coverDoc = currentCover.getChild( 0 ).getFrameDocument();
1798
+ coverDoc.on( 'mousemove', mouseMoveHandler );
1799
+ coverDoc.on( 'mouseup', mouseUpHandler );
1800
+ }
1801
+
1802
+ evt.data.preventDefault();
1803
+ }, dialog );
1804
+ }
1805
+
1806
+ function initResizeHandles( dialog )
1807
+ {
1808
+ var def = dialog.definition,
1809
+ resizable = def.resizable;
1810
+
1811
+ if ( resizable == CKEDITOR.DIALOG_RESIZE_NONE )
1812
+ return;
1813
+
1814
+ var editor = dialog.getParentEditor();
1815
+ var wrapperWidth, wrapperHeight,
1816
+ viewSize, origin, startSize,
1817
+ dialogCover;
1818
+
1819
+ var mouseDownFn = CKEDITOR.tools.addFunction( function( $event )
1820
+ {
1821
+ startSize = dialog.getSize();
1822
+
1823
+ var content = dialog.parts.contents,
1824
+ iframeDialog = content.$.getElementsByTagName( 'iframe' ).length;
1825
+
1826
+ // Shim to help capturing "mousemove" over iframe.
1827
+ if ( iframeDialog )
1828
+ {
1829
+ dialogCover = CKEDITOR.dom.element.createFromHtml( '<div class="cke_dialog_resize_cover" style="height: 100%; position: absolute; width: 100%;"></div>' );
1830
+ content.append( dialogCover );
1831
+ }
1832
+
1833
+ // Calculate the offset between content and chrome size.
1834
+ wrapperHeight = startSize.height - dialog.parts.contents.getSize( 'height', ! ( CKEDITOR.env.gecko || CKEDITOR.env.opera || CKEDITOR.env.ie && CKEDITOR.env.quirks ) );
1835
+ wrapperWidth = startSize.width - dialog.parts.contents.getSize( 'width', 1 );
1836
+
1837
+ origin = { x : $event.screenX, y : $event.screenY };
1838
+
1839
+ viewSize = CKEDITOR.document.getWindow().getViewPaneSize();
1840
+
1841
+ CKEDITOR.document.on( 'mousemove', mouseMoveHandler );
1842
+ CKEDITOR.document.on( 'mouseup', mouseUpHandler );
1843
+
1844
+ if ( CKEDITOR.env.ie6Compat )
1845
+ {
1846
+ var coverDoc = currentCover.getChild( 0 ).getFrameDocument();
1847
+ coverDoc.on( 'mousemove', mouseMoveHandler );
1848
+ coverDoc.on( 'mouseup', mouseUpHandler );
1849
+ }
1850
+
1851
+ $event.preventDefault && $event.preventDefault();
1852
+ });
1853
+
1854
+ // Prepend the grip to the dialog.
1855
+ dialog.on( 'load', function()
1856
+ {
1857
+ var direction = '';
1858
+ if ( resizable == CKEDITOR.DIALOG_RESIZE_WIDTH )
1859
+ direction = ' cke_resizer_horizontal';
1860
+ else if ( resizable == CKEDITOR.DIALOG_RESIZE_HEIGHT )
1861
+ direction = ' cke_resizer_vertical';
1862
+ var resizer = CKEDITOR.dom.element.createFromHtml( '<div' +
1863
+ ' class="cke_resizer' + direction + ' cke_resizer_' + editor.lang.dir + '"' +
1864
+ ' title="' + CKEDITOR.tools.htmlEncode( editor.lang.resize ) + '"' +
1865
+ ' onmousedown="CKEDITOR.tools.callFunction(' + mouseDownFn + ', event )"></div>' );
1866
+ dialog.parts.footer.append( resizer, 1 );
1867
+ });
1868
+ editor.on( 'destroy', function() { CKEDITOR.tools.removeFunction( mouseDownFn ); } );
1869
+
1870
+ function mouseMoveHandler( evt )
1871
+ {
1872
+ var rtl = editor.lang.dir == 'rtl',
1873
+ dx = ( evt.data.$.screenX - origin.x ) * ( rtl ? -1 : 1 ),
1874
+ dy = evt.data.$.screenY - origin.y,
1875
+ width = startSize.width,
1876
+ height = startSize.height,
1877
+ internalWidth = width + dx * ( dialog._.moved ? 1 : 2 ),
1878
+ internalHeight = height + dy * ( dialog._.moved ? 1 : 2 ),
1879
+ element = dialog._.element.getFirst(),
1880
+ right = rtl && element.getComputedStyle( 'right' ),
1881
+ position = dialog.getPosition();
1882
+
1883
+ if ( position.y + internalHeight > viewSize.height )
1884
+ internalHeight = viewSize.height - position.y;
1885
+
1886
+ if ( ( rtl ? right : position.x ) + internalWidth > viewSize.width )
1887
+ internalWidth = viewSize.width - ( rtl ? right : position.x );
1888
+
1889
+ // Make sure the dialog will not be resized to the wrong side when it's in the leftmost position for RTL.
1890
+ if ( ( resizable == CKEDITOR.DIALOG_RESIZE_WIDTH || resizable == CKEDITOR.DIALOG_RESIZE_BOTH ) )
1891
+ width = Math.max( def.minWidth || 0, internalWidth - wrapperWidth );
1892
+
1893
+ if ( resizable == CKEDITOR.DIALOG_RESIZE_HEIGHT || resizable == CKEDITOR.DIALOG_RESIZE_BOTH )
1894
+ height = Math.max( def.minHeight || 0, internalHeight - wrapperHeight );
1895
+
1896
+ dialog.resize( width, height );
1897
+
1898
+ if ( !dialog._.moved )
1899
+ dialog.layout();
1900
+
1901
+ evt.data.preventDefault();
1902
+ }
1903
+
1904
+ function mouseUpHandler()
1905
+ {
1906
+ CKEDITOR.document.removeListener( 'mouseup', mouseUpHandler );
1907
+ CKEDITOR.document.removeListener( 'mousemove', mouseMoveHandler );
1908
+
1909
+ if ( dialogCover )
1910
+ {
1911
+ dialogCover.remove();
1912
+ dialogCover = null;
1913
+ }
1914
+
1915
+ if ( CKEDITOR.env.ie6Compat )
1916
+ {
1917
+ var coverDoc = currentCover.getChild( 0 ).getFrameDocument();
1918
+ coverDoc.removeListener( 'mouseup', mouseUpHandler );
1919
+ coverDoc.removeListener( 'mousemove', mouseMoveHandler );
1920
+ }
1921
+ }
1922
+ }
1923
+
1924
+ var resizeCover;
1925
+ // Caching resuable covers and allowing only one cover
1926
+ // on screen.
1927
+ var covers = {},
1928
+ currentCover;
1929
+
1930
+ function cancelEvent( ev )
1931
+ {
1932
+ ev.data.preventDefault(1);
1933
+ }
1934
+
1935
+ function showCover( editor )
1936
+ {
1937
+ var win = CKEDITOR.document.getWindow();
1938
+ var config = editor.config,
1939
+ backgroundColorStyle = config.dialog_backgroundCoverColor || 'white',
1940
+ backgroundCoverOpacity = config.dialog_backgroundCoverOpacity,
1941
+ baseFloatZIndex = config.baseFloatZIndex,
1942
+ coverKey = CKEDITOR.tools.genKey(
1943
+ backgroundColorStyle,
1944
+ backgroundCoverOpacity,
1945
+ baseFloatZIndex ),
1946
+ coverElement = covers[ coverKey ];
1947
+
1948
+ if ( !coverElement )
1949
+ {
1950
+ var html = [
1951
+ '<div tabIndex="-1" style="position: ', ( CKEDITOR.env.ie6Compat ? 'absolute' : 'fixed' ),
1952
+ '; z-index: ', baseFloatZIndex,
1953
+ '; top: 0px; left: 0px; ',
1954
+ ( !CKEDITOR.env.ie6Compat ? 'background-color: ' + backgroundColorStyle : '' ),
1955
+ '" class="cke_dialog_background_cover">'
1956
+ ];
1957
+
1958
+ if ( CKEDITOR.env.ie6Compat )
1959
+ {
1960
+ // Support for custom document.domain in IE.
1961
+ var isCustomDomain = CKEDITOR.env.isCustomDomain(),
1962
+ iframeHtml = '<html><body style=\\\'background-color:' + backgroundColorStyle + ';\\\'></body></html>';
1963
+
1964
+ html.push(
1965
+ '<iframe' +
1966
+ ' hidefocus="true"' +
1967
+ ' frameborder="0"' +
1968
+ ' id="cke_dialog_background_iframe"' +
1969
+ ' src="javascript:' );
1970
+
1971
+ html.push( 'void((function(){' +
1972
+ 'document.open();' +
1973
+ ( isCustomDomain ? 'document.domain=\'' + document.domain + '\';' : '' ) +
1974
+ 'document.write( \'' + iframeHtml + '\' );' +
1975
+ 'document.close();' +
1976
+ '})())' );
1977
+
1978
+ html.push(
1979
+ '"' +
1980
+ ' style="' +
1981
+ 'position:absolute;' +
1982
+ 'left:0;' +
1983
+ 'top:0;' +
1984
+ 'width:100%;' +
1985
+ 'height: 100%;' +
1986
+ 'progid:DXImageTransform.Microsoft.Alpha(opacity=0)">' +
1987
+ '</iframe>' );
1988
+ }
1989
+
1990
+ html.push( '</div>' );
1991
+
1992
+ coverElement = CKEDITOR.dom.element.createFromHtml( html.join( '' ) );
1993
+ coverElement.setOpacity( backgroundCoverOpacity != undefined ? backgroundCoverOpacity : 0.5 );
1994
+
1995
+ coverElement.on( 'keydown', cancelEvent );
1996
+ coverElement.on( 'keypress', cancelEvent );
1997
+ coverElement.on( 'keyup', cancelEvent );
1998
+
1999
+ coverElement.appendTo( CKEDITOR.document.getBody() );
2000
+ covers[ coverKey ] = coverElement;
2001
+ }
2002
+ else
2003
+ coverElement. show();
2004
+
2005
+ currentCover = coverElement;
2006
+ var resizeFunc = function()
2007
+ {
2008
+ var size = win.getViewPaneSize();
2009
+ coverElement.setStyles(
2010
+ {
2011
+ width : size.width + 'px',
2012
+ height : size.height + 'px'
2013
+ } );
2014
+ };
2015
+
2016
+ var scrollFunc = function()
2017
+ {
2018
+ var pos = win.getScrollPosition(),
2019
+ cursor = CKEDITOR.dialog._.currentTop;
2020
+ coverElement.setStyles(
2021
+ {
2022
+ left : pos.x + 'px',
2023
+ top : pos.y + 'px'
2024
+ });
2025
+
2026
+ if ( cursor )
2027
+ {
2028
+ do
2029
+ {
2030
+ var dialogPos = cursor.getPosition();
2031
+ cursor.move( dialogPos.x, dialogPos.y );
2032
+ } while ( ( cursor = cursor._.parentDialog ) );
2033
+ }
2034
+ };
2035
+
2036
+ resizeCover = resizeFunc;
2037
+ win.on( 'resize', resizeFunc );
2038
+ resizeFunc();
2039
+ // Using Safari/Mac, focus must be kept where it is (#7027)
2040
+ if ( !( CKEDITOR.env.mac && CKEDITOR.env.webkit ) )
2041
+ coverElement.focus();
2042
+
2043
+ if ( CKEDITOR.env.ie6Compat )
2044
+ {
2045
+ // IE BUG: win.$.onscroll assignment doesn't work.. it must be window.onscroll.
2046
+ // So we need to invent a really funny way to make it work.
2047
+ var myScrollHandler = function()
2048
+ {
2049
+ scrollFunc();
2050
+ arguments.callee.prevScrollHandler.apply( this, arguments );
2051
+ };
2052
+ win.$.setTimeout( function()
2053
+ {
2054
+ myScrollHandler.prevScrollHandler = window.onscroll || function(){};
2055
+ window.onscroll = myScrollHandler;
2056
+ }, 0 );
2057
+ scrollFunc();
2058
+ }
2059
+ }
2060
+
2061
+ function hideCover()
2062
+ {
2063
+ if ( !currentCover )
2064
+ return;
2065
+
2066
+ var win = CKEDITOR.document.getWindow();
2067
+ currentCover.hide();
2068
+ win.removeListener( 'resize', resizeCover );
2069
+
2070
+ if ( CKEDITOR.env.ie6Compat )
2071
+ {
2072
+ win.$.setTimeout( function()
2073
+ {
2074
+ var prevScrollHandler = window.onscroll && window.onscroll.prevScrollHandler;
2075
+ window.onscroll = prevScrollHandler || null;
2076
+ }, 0 );
2077
+ }
2078
+ resizeCover = null;
2079
+ }
2080
+
2081
+ function removeCovers()
2082
+ {
2083
+ for ( var coverId in covers )
2084
+ covers[ coverId ].remove();
2085
+ covers = {};
2086
+ }
2087
+
2088
+ var accessKeyProcessors = {};
2089
+
2090
+ var accessKeyDownHandler = function( evt )
2091
+ {
2092
+ var ctrl = evt.data.$.ctrlKey || evt.data.$.metaKey,
2093
+ alt = evt.data.$.altKey,
2094
+ shift = evt.data.$.shiftKey,
2095
+ key = String.fromCharCode( evt.data.$.keyCode ),
2096
+ keyProcessor = accessKeyProcessors[( ctrl ? 'CTRL+' : '' ) + ( alt ? 'ALT+' : '') + ( shift ? 'SHIFT+' : '' ) + key];
2097
+
2098
+ if ( !keyProcessor || !keyProcessor.length )
2099
+ return;
2100
+
2101
+ keyProcessor = keyProcessor[keyProcessor.length - 1];
2102
+ keyProcessor.keydown && keyProcessor.keydown.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key );
2103
+ evt.data.preventDefault();
2104
+ };
2105
+
2106
+ var accessKeyUpHandler = function( evt )
2107
+ {
2108
+ var ctrl = evt.data.$.ctrlKey || evt.data.$.metaKey,
2109
+ alt = evt.data.$.altKey,
2110
+ shift = evt.data.$.shiftKey,
2111
+ key = String.fromCharCode( evt.data.$.keyCode ),
2112
+ keyProcessor = accessKeyProcessors[( ctrl ? 'CTRL+' : '' ) + ( alt ? 'ALT+' : '') + ( shift ? 'SHIFT+' : '' ) + key];
2113
+
2114
+ if ( !keyProcessor || !keyProcessor.length )
2115
+ return;
2116
+
2117
+ keyProcessor = keyProcessor[keyProcessor.length - 1];
2118
+ if ( keyProcessor.keyup )
2119
+ {
2120
+ keyProcessor.keyup.call( keyProcessor.uiElement, keyProcessor.dialog, keyProcessor.key );
2121
+ evt.data.preventDefault();
2122
+ }
2123
+ };
2124
+
2125
+ var registerAccessKey = function( uiElement, dialog, key, downFunc, upFunc )
2126
+ {
2127
+ var procList = accessKeyProcessors[key] || ( accessKeyProcessors[key] = [] );
2128
+ procList.push( {
2129
+ uiElement : uiElement,
2130
+ dialog : dialog,
2131
+ key : key,
2132
+ keyup : upFunc || uiElement.accessKeyUp,
2133
+ keydown : downFunc || uiElement.accessKeyDown
2134
+ } );
2135
+ };
2136
+
2137
+ var unregisterAccessKey = function( obj )
2138
+ {
2139
+ for ( var i in accessKeyProcessors )
2140
+ {
2141
+ var list = accessKeyProcessors[i];
2142
+ for ( var j = list.length - 1 ; j >= 0 ; j-- )
2143
+ {
2144
+ if ( list[j].dialog == obj || list[j].uiElement == obj )
2145
+ list.splice( j, 1 );
2146
+ }
2147
+ if ( list.length === 0 )
2148
+ delete accessKeyProcessors[i];
2149
+ }
2150
+ };
2151
+
2152
+ var tabAccessKeyUp = function( dialog, key )
2153
+ {
2154
+ if ( dialog._.accessKeyMap[key] )
2155
+ dialog.selectPage( dialog._.accessKeyMap[key] );
2156
+ };
2157
+
2158
+ var tabAccessKeyDown = function( dialog, key )
2159
+ {
2160
+ };
2161
+
2162
+ // ESC, ENTER
2163
+ var preventKeyBubblingKeys = { 27 :1, 13 :1 };
2164
+ var preventKeyBubbling = function( e )
2165
+ {
2166
+ if ( e.data.getKeystroke() in preventKeyBubblingKeys )
2167
+ e.data.stopPropagation();
2168
+ };
2169
+
2170
+ (function()
2171
+ {
2172
+ CKEDITOR.ui.dialog =
2173
+ {
2174
+ /**
2175
+ * The base class of all dialog UI elements.
2176
+ * @constructor
2177
+ * @param {CKEDITOR.dialog} dialog Parent dialog object.
2178
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition Element
2179
+ * definition. Accepted fields:
2180
+ * <ul>
2181
+ * <li><strong>id</strong> (Required) The id of the UI element. See {@link
2182
+ * CKEDITOR.dialog#getContentElement}</li>
2183
+ * <li><strong>type</strong> (Required) The type of the UI element. The
2184
+ * value to this field specifies which UI element class will be used to
2185
+ * generate the final widget.</li>
2186
+ * <li><strong>title</strong> (Optional) The popup tooltip for the UI
2187
+ * element.</li>
2188
+ * <li><strong>hidden</strong> (Optional) A flag that tells if the element
2189
+ * should be initially visible.</li>
2190
+ * <li><strong>className</strong> (Optional) Additional CSS class names
2191
+ * to add to the UI element. Separated by space.</li>
2192
+ * <li><strong>style</strong> (Optional) Additional CSS inline styles
2193
+ * to add to the UI element. A semicolon (;) is required after the last
2194
+ * style declaration.</li>
2195
+ * <li><strong>accessKey</strong> (Optional) The alphanumeric access key
2196
+ * for this element. Access keys are automatically prefixed by CTRL.</li>
2197
+ * <li><strong>on*</strong> (Optional) Any UI element definition field that
2198
+ * starts with <em>on</em> followed immediately by a capital letter and
2199
+ * probably more letters is an event handler. Event handlers may be further
2200
+ * divided into registered event handlers and DOM event handlers. Please
2201
+ * refer to {@link CKEDITOR.ui.dialog.uiElement#registerEvents} and
2202
+ * {@link CKEDITOR.ui.dialog.uiElement#eventProcessors} for more
2203
+ * information.</li>
2204
+ * </ul>
2205
+ * @param {Array} htmlList
2206
+ * List of HTML code to be added to the dialog's content area.
2207
+ * @param {Function|String} nodeNameArg
2208
+ * A function returning a string, or a simple string for the node name for
2209
+ * the root DOM node. Default is 'div'.
2210
+ * @param {Function|Object} stylesArg
2211
+ * A function returning an object, or a simple object for CSS styles applied
2212
+ * to the DOM node. Default is empty object.
2213
+ * @param {Function|Object} attributesArg
2214
+ * A fucntion returning an object, or a simple object for attributes applied
2215
+ * to the DOM node. Default is empty object.
2216
+ * @param {Function|String} contentsArg
2217
+ * A function returning a string, or a simple string for the HTML code inside
2218
+ * the root DOM node. Default is empty string.
2219
+ * @example
2220
+ */
2221
+ uiElement : function( dialog, elementDefinition, htmlList, nodeNameArg, stylesArg, attributesArg, contentsArg )
2222
+ {
2223
+ if ( arguments.length < 4 )
2224
+ return;
2225
+
2226
+ var nodeName = ( nodeNameArg.call ? nodeNameArg( elementDefinition ) : nodeNameArg ) || 'div',
2227
+ html = [ '<', nodeName, ' ' ],
2228
+ styles = ( stylesArg && stylesArg.call ? stylesArg( elementDefinition ) : stylesArg ) || {},
2229
+ attributes = ( attributesArg && attributesArg.call ? attributesArg( elementDefinition ) : attributesArg ) || {},
2230
+ innerHTML = ( contentsArg && contentsArg.call ? contentsArg.call( this, dialog, elementDefinition ) : contentsArg ) || '',
2231
+ domId = this.domId = attributes.id || CKEDITOR.tools.getNextId() + '_uiElement',
2232
+ id = this.id = elementDefinition.id,
2233
+ i;
2234
+
2235
+ // Set the id, a unique id is required for getElement() to work.
2236
+ attributes.id = domId;
2237
+
2238
+ // Set the type and definition CSS class names.
2239
+ var classes = {};
2240
+ if ( elementDefinition.type )
2241
+ classes[ 'cke_dialog_ui_' + elementDefinition.type ] = 1;
2242
+ if ( elementDefinition.className )
2243
+ classes[ elementDefinition.className ] = 1;
2244
+ if ( elementDefinition.disabled )
2245
+ classes[ 'cke_disabled' ] = 1;
2246
+
2247
+ var attributeClasses = ( attributes['class'] && attributes['class'].split ) ? attributes['class'].split( ' ' ) : [];
2248
+ for ( i = 0 ; i < attributeClasses.length ; i++ )
2249
+ {
2250
+ if ( attributeClasses[i] )
2251
+ classes[ attributeClasses[i] ] = 1;
2252
+ }
2253
+ var finalClasses = [];
2254
+ for ( i in classes )
2255
+ finalClasses.push( i );
2256
+ attributes['class'] = finalClasses.join( ' ' );
2257
+
2258
+ // Set the popup tooltop.
2259
+ if ( elementDefinition.title )
2260
+ attributes.title = elementDefinition.title;
2261
+
2262
+ // Write the inline CSS styles.
2263
+ var styleStr = ( elementDefinition.style || '' ).split( ';' );
2264
+ for ( i in styles )
2265
+ styleStr.push( i + ':' + styles[i] );
2266
+ if ( elementDefinition.hidden )
2267
+ styleStr.push( 'display:none' );
2268
+ for ( i = styleStr.length - 1 ; i >= 0 ; i-- )
2269
+ {
2270
+ if ( styleStr[i] === '' )
2271
+ styleStr.splice( i, 1 );
2272
+ }
2273
+ if ( styleStr.length > 0 )
2274
+ attributes.style = ( attributes.style ? ( attributes.style + '; ' ) : '' ) + styleStr.join( '; ' );
2275
+
2276
+ // Write the attributes.
2277
+ for ( i in attributes )
2278
+ html.push( i + '="' + CKEDITOR.tools.htmlEncode( attributes[i] ) + '" ');
2279
+
2280
+ // Write the content HTML.
2281
+ html.push( '>', innerHTML, '</', nodeName, '>' );
2282
+
2283
+ // Add contents to the parent HTML array.
2284
+ htmlList.push( html.join( '' ) );
2285
+
2286
+ ( this._ || ( this._ = {} ) ).dialog = dialog;
2287
+
2288
+ // Override isChanged if it is defined in element definition.
2289
+ if ( typeof( elementDefinition.isChanged ) == 'boolean' )
2290
+ this.isChanged = function(){ return elementDefinition.isChanged; };
2291
+ if ( typeof( elementDefinition.isChanged ) == 'function' )
2292
+ this.isChanged = elementDefinition.isChanged;
2293
+
2294
+ // Add events.
2295
+ CKEDITOR.event.implementOn( this );
2296
+
2297
+ this.registerEvents( elementDefinition );
2298
+ if ( this.accessKeyUp && this.accessKeyDown && elementDefinition.accessKey )
2299
+ registerAccessKey( this, dialog, 'CTRL+' + elementDefinition.accessKey );
2300
+
2301
+ var me = this;
2302
+ dialog.on( 'load', function()
2303
+ {
2304
+ if ( me.getInputElement() )
2305
+ {
2306
+ me.getInputElement().on( 'focus', function()
2307
+ {
2308
+ dialog._.tabBarMode = false;
2309
+ dialog._.hasFocus = true;
2310
+ me.fire( 'focus' );
2311
+ }, me );
2312
+ }
2313
+ } );
2314
+
2315
+ // Register the object as a tab focus if it can be included.
2316
+ if ( this.keyboardFocusable )
2317
+ {
2318
+ this.tabIndex = elementDefinition.tabIndex || 0;
2319
+
2320
+ this.focusIndex = dialog._.focusList.push( this ) - 1;
2321
+ this.on( 'focus', function()
2322
+ {
2323
+ dialog._.currentFocusIndex = me.focusIndex;
2324
+ } );
2325
+ }
2326
+
2327
+ // Completes this object with everything we have in the
2328
+ // definition.
2329
+ CKEDITOR.tools.extend( this, elementDefinition );
2330
+ },
2331
+
2332
+ /**
2333
+ * Horizontal layout box for dialog UI elements, auto-expends to available width of container.
2334
+ * @constructor
2335
+ * @extends CKEDITOR.ui.dialog.uiElement
2336
+ * @param {CKEDITOR.dialog} dialog
2337
+ * Parent dialog object.
2338
+ * @param {Array} childObjList
2339
+ * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this
2340
+ * container.
2341
+ * @param {Array} childHtmlList
2342
+ * Array of HTML code that correspond to the HTML output of all the
2343
+ * objects in childObjList.
2344
+ * @param {Array} htmlList
2345
+ * Array of HTML code that this element will output to.
2346
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
2347
+ * The element definition. Accepted fields:
2348
+ * <ul>
2349
+ * <li><strong>widths</strong> (Optional) The widths of child cells.</li>
2350
+ * <li><strong>height</strong> (Optional) The height of the layout.</li>
2351
+ * <li><strong>padding</strong> (Optional) The padding width inside child
2352
+ * cells.</li>
2353
+ * <li><strong>align</strong> (Optional) The alignment of the whole layout
2354
+ * </li>
2355
+ * </ul>
2356
+ * @example
2357
+ */
2358
+ hbox : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition )
2359
+ {
2360
+ if ( arguments.length < 4 )
2361
+ return;
2362
+
2363
+ this._ || ( this._ = {} );
2364
+
2365
+ var children = this._.children = childObjList,
2366
+ widths = elementDefinition && elementDefinition.widths || null,
2367
+ height = elementDefinition && elementDefinition.height || null,
2368
+ styles = {},
2369
+ i;
2370
+ /** @ignore */
2371
+ var innerHTML = function()
2372
+ {
2373
+ var html = [ '<tbody><tr class="cke_dialog_ui_hbox">' ];
2374
+ for ( i = 0 ; i < childHtmlList.length ; i++ )
2375
+ {
2376
+ var className = 'cke_dialog_ui_hbox_child',
2377
+ styles = [];
2378
+ if ( i === 0 )
2379
+ className = 'cke_dialog_ui_hbox_first';
2380
+ if ( i == childHtmlList.length - 1 )
2381
+ className = 'cke_dialog_ui_hbox_last';
2382
+ html.push( '<td class="', className, '" role="presentation" ' );
2383
+ if ( widths )
2384
+ {
2385
+ if ( widths[i] )
2386
+ styles.push( 'width:' + cssLength( widths[i] ) );
2387
+ }
2388
+ else
2389
+ styles.push( 'width:' + Math.floor( 100 / childHtmlList.length ) + '%' );
2390
+ if ( height )
2391
+ styles.push( 'height:' + cssLength( height ) );
2392
+ if ( elementDefinition && elementDefinition.padding != undefined )
2393
+ styles.push( 'padding:' + cssLength( elementDefinition.padding ) );
2394
+ if ( styles.length > 0 )
2395
+ html.push( 'style="' + styles.join('; ') + '" ' );
2396
+ html.push( '>', childHtmlList[i], '</td>' );
2397
+ }
2398
+ html.push( '</tr></tbody>' );
2399
+ return html.join( '' );
2400
+ };
2401
+
2402
+ var attribs = { role : 'presentation' };
2403
+ elementDefinition && elementDefinition.align && ( attribs.align = elementDefinition.align );
2404
+
2405
+ CKEDITOR.ui.dialog.uiElement.call(
2406
+ this,
2407
+ dialog,
2408
+ elementDefinition || { type : 'hbox' },
2409
+ htmlList,
2410
+ 'table',
2411
+ styles,
2412
+ attribs,
2413
+ innerHTML );
2414
+ },
2415
+
2416
+ /**
2417
+ * Vertical layout box for dialog UI elements.
2418
+ * @constructor
2419
+ * @extends CKEDITOR.ui.dialog.hbox
2420
+ * @param {CKEDITOR.dialog} dialog
2421
+ * Parent dialog object.
2422
+ * @param {Array} childObjList
2423
+ * Array of {@link CKEDITOR.ui.dialog.uiElement} objects inside this
2424
+ * container.
2425
+ * @param {Array} childHtmlList
2426
+ * Array of HTML code that correspond to the HTML output of all the
2427
+ * objects in childObjList.
2428
+ * @param {Array} htmlList
2429
+ * Array of HTML code that this element will output to.
2430
+ * @param {CKEDITOR.dialog.definition.uiElement} elementDefinition
2431
+ * The element definition. Accepted fields:
2432
+ * <ul>
2433
+ * <li><strong>width</strong> (Optional) The width of the layout.</li>
2434
+ * <li><strong>heights</strong> (Optional) The heights of individual cells.
2435
+ * </li>
2436
+ * <li><strong>align</strong> (Optional) The alignment of the layout.</li>
2437
+ * <li><strong>padding</strong> (Optional) The padding width inside child
2438
+ * cells.</li>
2439
+ * <li><strong>expand</strong> (Optional) Whether the layout should expand
2440
+ * vertically to fill its container.</li>
2441
+ * </ul>
2442
+ * @example
2443
+ */
2444
+ vbox : function( dialog, childObjList, childHtmlList, htmlList, elementDefinition )
2445
+ {
2446
+ if ( arguments.length < 3 )
2447
+ return;
2448
+
2449
+ this._ || ( this._ = {} );
2450
+
2451
+ var children = this._.children = childObjList,
2452
+ width = elementDefinition && elementDefinition.width || null,
2453
+ heights = elementDefinition && elementDefinition.heights || null;
2454
+ /** @ignore */
2455
+ var innerHTML = function()
2456
+ {
2457
+ var html = [ '<table role="presentation" cellspacing="0" border="0" ' ];
2458
+ html.push( 'style="' );
2459
+ if ( elementDefinition && elementDefinition.expand )
2460
+ html.push( 'height:100%;' );
2461
+ html.push( 'width:' + cssLength( width || '100%' ), ';' );
2462
+ html.push( '"' );
2463
+ html.push( 'align="', CKEDITOR.tools.htmlEncode(
2464
+ ( elementDefinition && elementDefinition.align ) || ( dialog.getParentEditor().lang.dir == 'ltr' ? 'left' : 'right' ) ), '" ' );
2465
+
2466
+ html.push( '><tbody>' );
2467
+ for ( var i = 0 ; i < childHtmlList.length ; i++ )
2468
+ {
2469
+ var styles = [];
2470
+ html.push( '<tr><td role="presentation" ' );
2471
+ if ( width )
2472
+ styles.push( 'width:' + cssLength( width || '100%' ) );
2473
+ if ( heights )
2474
+ styles.push( 'height:' + cssLength( heights[i] ) );
2475
+ else if ( elementDefinition && elementDefinition.expand )
2476
+ styles.push( 'height:' + Math.floor( 100 / childHtmlList.length ) + '%' );
2477
+ if ( elementDefinition && elementDefinition.padding != undefined )
2478
+ styles.push( 'padding:' + cssLength( elementDefinition.padding ) );
2479
+ if ( styles.length > 0 )
2480
+ html.push( 'style="', styles.join( '; ' ), '" ' );
2481
+ html.push( ' class="cke_dialog_ui_vbox_child">', childHtmlList[i], '</td></tr>' );
2482
+ }
2483
+ html.push( '</tbody></table>' );
2484
+ return html.join( '' );
2485
+ };
2486
+ CKEDITOR.ui.dialog.uiElement.call( this, dialog, elementDefinition || { type : 'vbox' }, htmlList, 'div', null, { role : 'presentation' }, innerHTML );
2487
+ }
2488
+ };
2489
+ })();
2490
+
2491
+ CKEDITOR.ui.dialog.uiElement.prototype =
2492
+ {
2493
+ /**
2494
+ * Gets the root DOM element of this dialog UI object.
2495
+ * @returns {CKEDITOR.dom.element} Root DOM element of UI object.
2496
+ * @example
2497
+ * uiElement.getElement().hide();
2498
+ */
2499
+ getElement : function()
2500
+ {
2501
+ return CKEDITOR.document.getById( this.domId );
2502
+ },
2503
+
2504
+ /**
2505
+ * Gets the DOM element that the user inputs values.
2506
+ * This function is used by setValue(), getValue() and focus(). It should
2507
+ * be overrided in child classes where the input element isn't the root
2508
+ * element.
2509
+ * @returns {CKEDITOR.dom.element} The element where the user input values.
2510
+ * @example
2511
+ * var rawValue = textInput.getInputElement().$.value;
2512
+ */
2513
+ getInputElement : function()
2514
+ {
2515
+ return this.getElement();
2516
+ },
2517
+
2518
+ /**
2519
+ * Gets the parent dialog object containing this UI element.
2520
+ * @returns {CKEDITOR.dialog} Parent dialog object.
2521
+ * @example
2522
+ * var dialog = uiElement.getDialog();
2523
+ */
2524
+ getDialog : function()
2525
+ {
2526
+ return this._.dialog;
2527
+ },
2528
+
2529
+ /**
2530
+ * Sets the value of this dialog UI object.
2531
+ * @param {Object} value The new value.
2532
+ * @param {Boolean} noChangeEvent Internal commit, to supress 'change' event on this element.
2533
+ * @returns {CKEDITOR.dialog.uiElement} The current UI element.
2534
+ * @example
2535
+ * uiElement.setValue( 'Dingo' );
2536
+ */
2537
+ setValue : function( value, noChangeEvent )
2538
+ {
2539
+ this.getInputElement().setValue( value );
2540
+ !noChangeEvent && this.fire( 'change', { value : value } );
2541
+ return this;
2542
+ },
2543
+
2544
+ /**
2545
+ * Gets the current value of this dialog UI object.
2546
+ * @returns {Object} The current value.
2547
+ * @example
2548
+ * var myValue = uiElement.getValue();
2549
+ */
2550
+ getValue : function()
2551
+ {
2552
+ return this.getInputElement().getValue();
2553
+ },
2554
+
2555
+ /**
2556
+ * Tells whether the UI object's value has changed.
2557
+ * @returns {Boolean} true if changed, false if not changed.
2558
+ * @example
2559
+ * if ( uiElement.isChanged() )
2560
+ * &nbsp;&nbsp;confirm( 'Value changed! Continue?' );
2561
+ */
2562
+ isChanged : function()
2563
+ {
2564
+ // Override in input classes.
2565
+ return false;
2566
+ },
2567
+
2568
+ /**
2569
+ * Selects the parent tab of this element. Usually called by focus() or overridden focus() methods.
2570
+ * @returns {CKEDITOR.dialog.uiElement} The current UI element.
2571
+ * @example
2572
+ * focus : function()
2573
+ * {
2574
+ * this.selectParentTab();
2575
+ * // do something else.
2576
+ * }
2577
+ */
2578
+ selectParentTab : function()
2579
+ {
2580
+ var element = this.getInputElement(),
2581
+ cursor = element,
2582
+ tabId;
2583
+ while ( ( cursor = cursor.getParent() ) && cursor.$.className.search( 'cke_dialog_page_contents' ) == -1 )
2584
+ { /*jsl:pass*/ }
2585
+
2586
+ // Some widgets don't have parent tabs (e.g. OK and Cancel buttons).
2587
+ if ( !cursor )
2588
+ return this;
2589
+
2590
+ tabId = cursor.getAttribute( 'name' );
2591
+ // Avoid duplicate select.
2592
+ if ( this._.dialog._.currentTabId != tabId )
2593
+ this._.dialog.selectPage( tabId );
2594
+ return this;
2595
+ },
2596
+
2597
+ /**
2598
+ * Puts the focus to the UI object. Switches tabs if the UI object isn't in the active tab page.
2599
+ * @returns {CKEDITOR.dialog.uiElement} The current UI element.
2600
+ * @example
2601
+ * uiElement.focus();
2602
+ */
2603
+ focus : function()
2604
+ {
2605
+ this.selectParentTab().getInputElement().focus();
2606
+ return this;
2607
+ },
2608
+
2609
+ /**
2610
+ * Registers the on* event handlers defined in the element definition.
2611
+ * The default behavior of this function is:
2612
+ * <ol>
2613
+ * <li>
2614
+ * If the on* event is defined in the class's eventProcesors list,
2615
+ * then the registration is delegated to the corresponding function
2616
+ * in the eventProcessors list.
2617
+ * </li>
2618
+ * <li>
2619
+ * If the on* event is not defined in the eventProcessors list, then
2620
+ * register the event handler under the corresponding DOM event of
2621
+ * the UI element's input DOM element (as defined by the return value
2622
+ * of {@link CKEDITOR.ui.dialog.uiElement#getInputElement}).
2623
+ * </li>
2624
+ * </ol>
2625
+ * This function is only called at UI element instantiation, but can
2626
+ * be overridded in child classes if they require more flexibility.
2627
+ * @param {CKEDITOR.dialog.definition.uiElement} definition The UI element
2628
+ * definition.
2629
+ * @returns {CKEDITOR.dialog.uiElement} The current UI element.
2630
+ * @example
2631
+ */
2632
+ registerEvents : function( definition )
2633
+ {
2634
+ var regex = /^on([A-Z]\w+)/,
2635
+ match;
2636
+
2637
+ var registerDomEvent = function( uiElement, dialog, eventName, func )
2638
+ {
2639
+ dialog.on( 'load', function()
2640
+ {
2641
+ uiElement.getInputElement().on( eventName, func, uiElement );
2642
+ });
2643
+ };
2644
+
2645
+ for ( var i in definition )
2646
+ {
2647
+ if ( !( match = i.match( regex ) ) )
2648
+ continue;
2649
+ if ( this.eventProcessors[i] )
2650
+ this.eventProcessors[i].call( this, this._.dialog, definition[i] );
2651
+ else
2652
+ registerDomEvent( this, this._.dialog, match[1].toLowerCase(), definition[i] );
2653
+ }
2654
+
2655
+ return this;
2656
+ },
2657
+
2658
+ /**
2659
+ * The event processor list used by
2660
+ * {@link CKEDITOR.ui.dialog.uiElement#getInputElement} at UI element
2661
+ * instantiation. The default list defines three on* events:
2662
+ * <ol>
2663
+ * <li>onLoad - Called when the element's parent dialog opens for the
2664
+ * first time</li>
2665
+ * <li>onShow - Called whenever the element's parent dialog opens.</li>
2666
+ * <li>onHide - Called whenever the element's parent dialog closes.</li>
2667
+ * </ol>
2668
+ * @field
2669
+ * @type Object
2670
+ * @example
2671
+ * // This connects the 'click' event in CKEDITOR.ui.dialog.button to onClick
2672
+ * // handlers in the UI element's definitions.
2673
+ * CKEDITOR.ui.dialog.button.eventProcessors = CKEDITOR.tools.extend( {},
2674
+ * &nbsp;&nbsp;CKEDITOR.ui.dialog.uiElement.prototype.eventProcessors,
2675
+ * &nbsp;&nbsp;{ onClick : function( dialog, func ) { this.on( 'click', func ); } },
2676
+ * &nbsp;&nbsp;true );
2677
+ */
2678
+ eventProcessors :
2679
+ {
2680
+ onLoad : function( dialog, func )
2681
+ {
2682
+ dialog.on( 'load', func, this );
2683
+ },
2684
+
2685
+ onShow : function( dialog, func )
2686
+ {
2687
+ dialog.on( 'show', func, this );
2688
+ },
2689
+
2690
+ onHide : function( dialog, func )
2691
+ {
2692
+ dialog.on( 'hide', func, this );
2693
+ }
2694
+ },
2695
+
2696
+ /**
2697
+ * The default handler for a UI element's access key down event, which
2698
+ * tries to put focus to the UI element.<br />
2699
+ * Can be overridded in child classes for more sophisticaed behavior.
2700
+ * @param {CKEDITOR.dialog} dialog The parent dialog object.
2701
+ * @param {String} key The key combination pressed. Since access keys
2702
+ * are defined to always include the CTRL key, its value should always
2703
+ * include a 'CTRL+' prefix.
2704
+ * @example
2705
+ */
2706
+ accessKeyDown : function( dialog, key )
2707
+ {
2708
+ this.focus();
2709
+ },
2710
+
2711
+ /**
2712
+ * The default handler for a UI element's access key up event, which
2713
+ * does nothing.<br />
2714
+ * Can be overridded in child classes for more sophisticated behavior.
2715
+ * @param {CKEDITOR.dialog} dialog The parent dialog object.
2716
+ * @param {String} key The key combination pressed. Since access keys
2717
+ * are defined to always include the CTRL key, its value should always
2718
+ * include a 'CTRL+' prefix.
2719
+ * @example
2720
+ */
2721
+ accessKeyUp : function( dialog, key )
2722
+ {
2723
+ },
2724
+
2725
+ /**
2726
+ * Disables a UI element.
2727
+ * @example
2728
+ */
2729
+ disable : function()
2730
+ {
2731
+ var element = this.getElement();
2732
+ element.setAttribute( 'disabled', 'true' );
2733
+ element.addClass( 'cke_disabled' );
2734
+ },
2735
+
2736
+ /**
2737
+ * Enables a UI element.
2738
+ * @example
2739
+ */
2740
+ enable : function()
2741
+ {
2742
+ var element = this.getElement();
2743
+ element.removeAttribute( 'disabled' );
2744
+ element.removeClass( 'cke_disabled' );
2745
+ },
2746
+
2747
+ /**
2748
+ * Determines whether an UI element is enabled or not.
2749
+ * @returns {Boolean} Whether the UI element is enabled.
2750
+ * @example
2751
+ */
2752
+ isEnabled : function()
2753
+ {
2754
+ return !this.getInputElement().getAttribute( 'disabled' );
2755
+ },
2756
+
2757
+ /**
2758
+ * Determines whether an UI element is visible or not.
2759
+ * @returns {Boolean} Whether the UI element is visible.
2760
+ * @example
2761
+ */
2762
+ isVisible : function()
2763
+ {
2764
+ return this.getInputElement().isVisible();
2765
+ },
2766
+
2767
+ /**
2768
+ * Determines whether an UI element is focus-able or not.
2769
+ * Focus-able is defined as being both visible and enabled.
2770
+ * @returns {Boolean} Whether the UI element can be focused.
2771
+ * @example
2772
+ */
2773
+ isFocusable : function()
2774
+ {
2775
+ if ( !this.isEnabled() || !this.isVisible() )
2776
+ return false;
2777
+ return true;
2778
+ }
2779
+ };
2780
+
2781
+ CKEDITOR.ui.dialog.hbox.prototype = CKEDITOR.tools.extend( new CKEDITOR.ui.dialog.uiElement,
2782
+ /**
2783
+ * @lends CKEDITOR.ui.dialog.hbox.prototype
2784
+ */
2785
+ {
2786
+ /**
2787
+ * Gets a child UI element inside this container.
2788
+ * @param {Array|Number} indices An array or a single number to indicate the child's
2789
+ * position in the container's descendant tree. Omit to get all the children in an array.
2790
+ * @returns {Array|CKEDITOR.ui.dialog.uiElement} Array of all UI elements in the container
2791
+ * if no argument given, or the specified UI element if indices is given.
2792
+ * @example
2793
+ * var checkbox = hbox.getChild( [0,1] );
2794
+ * checkbox.setValue( true );
2795
+ */
2796
+ getChild : function( indices )
2797
+ {
2798
+ // If no arguments, return a clone of the children array.
2799
+ if ( arguments.length < 1 )
2800
+ return this._.children.concat();
2801
+
2802
+ // If indices isn't array, make it one.
2803
+ if ( !indices.splice )
2804
+ indices = [ indices ];
2805
+
2806
+ // Retrieve the child element according to tree position.
2807
+ if ( indices.length < 2 )
2808
+ return this._.children[ indices[0] ];
2809
+ else
2810
+ return ( this._.children[ indices[0] ] && this._.children[ indices[0] ].getChild ) ?
2811
+ this._.children[ indices[0] ].getChild( indices.slice( 1, indices.length ) ) :
2812
+ null;
2813
+ }
2814
+ }, true );
2815
+
2816
+ CKEDITOR.ui.dialog.vbox.prototype = new CKEDITOR.ui.dialog.hbox();
2817
+
2818
+
2819
+
2820
+ (function()
2821
+ {
2822
+ var commonBuilder = {
2823
+ build : function( dialog, elementDefinition, output )
2824
+ {
2825
+ var children = elementDefinition.children,
2826
+ child,
2827
+ childHtmlList = [],
2828
+ childObjList = [];
2829
+ for ( var i = 0 ; ( i < children.length && ( child = children[i] ) ) ; i++ )
2830
+ {
2831
+ var childHtml = [];
2832
+ childHtmlList.push( childHtml );
2833
+ childObjList.push( CKEDITOR.dialog._.uiElementBuilders[ child.type ].build( dialog, child, childHtml ) );
2834
+ }
2835
+ return new CKEDITOR.ui.dialog[elementDefinition.type]( dialog, childObjList, childHtmlList, output, elementDefinition );
2836
+ }
2837
+ };
2838
+
2839
+ CKEDITOR.dialog.addUIElement( 'hbox', commonBuilder );
2840
+ CKEDITOR.dialog.addUIElement( 'vbox', commonBuilder );
2841
+ })();
2842
+
2843
+ /**
2844
+ * Generic dialog command. It opens a specific dialog when executed.
2845
+ * @constructor
2846
+ * @augments CKEDITOR.commandDefinition
2847
+ * @param {string} dialogName The name of the dialog to open when executing
2848
+ * this command.
2849
+ * @example
2850
+ * // Register the "link" command, which opens the "link" dialog.
2851
+ * editor.addCommand( 'link', <b>new CKEDITOR.dialogCommand( 'link' )</b> );
2852
+ */
2853
+ CKEDITOR.dialogCommand = function( dialogName )
2854
+ {
2855
+ this.dialogName = dialogName;
2856
+ };
2857
+
2858
+ CKEDITOR.dialogCommand.prototype =
2859
+ {
2860
+ /** @ignore */
2861
+ exec : function( editor )
2862
+ {
2863
+ editor.openDialog( this.dialogName );
2864
+ },
2865
+
2866
+ // Dialog commands just open a dialog ui, thus require no undo logic,
2867
+ // undo support should dedicate to specific dialog implementation.
2868
+ canUndo: false,
2869
+
2870
+ editorFocus : CKEDITOR.env.ie || CKEDITOR.env.webkit
2871
+ };
2872
+
2873
+ (function()
2874
+ {
2875
+ var notEmptyRegex = /^([a]|[^a])+$/,
2876
+ integerRegex = /^\d*$/,
2877
+ numberRegex = /^\d*(?:\.\d+)?$/;
2878
+
2879
+ CKEDITOR.VALIDATE_OR = 1;
2880
+ CKEDITOR.VALIDATE_AND = 2;
2881
+
2882
+ CKEDITOR.dialog.validate =
2883
+ {
2884
+ functions : function()
2885
+ {
2886
+ return function()
2887
+ {
2888
+ /**
2889
+ * It's important for validate functions to be able to accept the value
2890
+ * as argument in addition to this.getValue(), so that it is possible to
2891
+ * combine validate functions together to make more sophisticated
2892
+ * validators.
2893
+ */
2894
+ var value = this && this.getValue ? this.getValue() : arguments[0];
2895
+
2896
+ var msg = undefined,
2897
+ relation = CKEDITOR.VALIDATE_AND,
2898
+ functions = [], i;
2899
+
2900
+ for ( i = 0 ; i < arguments.length ; i++ )
2901
+ {
2902
+ if ( typeof( arguments[i] ) == 'function' )
2903
+ functions.push( arguments[i] );
2904
+ else
2905
+ break;
2906
+ }
2907
+
2908
+ if ( i < arguments.length && typeof( arguments[i] ) == 'string' )
2909
+ {
2910
+ msg = arguments[i];
2911
+ i++;
2912
+ }
2913
+
2914
+ if ( i < arguments.length && typeof( arguments[i]) == 'number' )
2915
+ relation = arguments[i];
2916
+
2917
+ var passed = ( relation == CKEDITOR.VALIDATE_AND ? true : false );
2918
+ for ( i = 0 ; i < functions.length ; i++ )
2919
+ {
2920
+ if ( relation == CKEDITOR.VALIDATE_AND )
2921
+ passed = passed && functions[i]( value );
2922
+ else
2923
+ passed = passed || functions[i]( value );
2924
+ }
2925
+
2926
+ if ( !passed )
2927
+ {
2928
+ if ( msg !== undefined )
2929
+ alert( msg );
2930
+ if ( this && ( this.select || this.focus ) )
2931
+ ( this.select || this.focus )();
2932
+ return false;
2933
+ }
2934
+
2935
+ return true;
2936
+ };
2937
+ },
2938
+
2939
+ regex : function( regex, msg )
2940
+ {
2941
+ /*
2942
+ * Can be greatly shortened by deriving from functions validator if code size
2943
+ * turns out to be more important than performance.
2944
+ */
2945
+ return function()
2946
+ {
2947
+ var value = this && this.getValue ? this.getValue() : arguments[0];
2948
+ if ( !regex.test( value ) )
2949
+ {
2950
+ if ( msg !== undefined )
2951
+ alert( msg );
2952
+ if ( this && ( this.select || this.focus ) )
2953
+ {
2954
+ if ( this.select )
2955
+ this.select();
2956
+ else
2957
+ this.focus();
2958
+ }
2959
+ return false;
2960
+ }
2961
+ return true;
2962
+ };
2963
+ },
2964
+
2965
+ notEmpty : function( msg )
2966
+ {
2967
+ return this.regex( notEmptyRegex, msg );
2968
+ },
2969
+
2970
+ integer : function( msg )
2971
+ {
2972
+ return this.regex( integerRegex, msg );
2973
+ },
2974
+
2975
+ 'number' : function( msg )
2976
+ {
2977
+ return this.regex( numberRegex, msg );
2978
+ },
2979
+
2980
+ equals : function( value, msg )
2981
+ {
2982
+ return this.functions( function( val ){ return val == value; }, msg );
2983
+ },
2984
+
2985
+ notEqual : function( value, msg )
2986
+ {
2987
+ return this.functions( function( val ){ return val != value; }, msg );
2988
+ }
2989
+ };
2990
+
2991
+ CKEDITOR.on( 'instanceDestroyed', function( evt )
2992
+ {
2993
+ // Remove dialog cover on last instance destroy.
2994
+ if ( CKEDITOR.tools.isEmpty( CKEDITOR.instances ) )
2995
+ {
2996
+ var currentTopDialog;
2997
+ while ( ( currentTopDialog = CKEDITOR.dialog._.currentTop ) )
2998
+ currentTopDialog.hide();
2999
+ removeCovers();
3000
+ }
3001
+
3002
+ var dialogs = evt.editor._.storedDialogs;
3003
+ for ( var name in dialogs )
3004
+ dialogs[ name ].destroy();
3005
+
3006
+ });
3007
+
3008
+ })();
3009
+
3010
+ // Extend the CKEDITOR.editor class with dialog specific functions.
3011
+ CKEDITOR.tools.extend( CKEDITOR.editor.prototype,
3012
+ /** @lends CKEDITOR.editor.prototype */
3013
+ {
3014
+ /**
3015
+ * Loads and opens a registered dialog.
3016
+ * @param {String} dialogName The registered name of the dialog.
3017
+ * @param {Function} callback The function to be invoked after dialog instance created.
3018
+ * @see CKEDITOR.dialog.add
3019
+ * @example
3020
+ * CKEDITOR.instances.editor1.openDialog( 'smiley' );
3021
+ * @returns {CKEDITOR.dialog} The dialog object corresponding to the dialog displayed. null if the dialog name is not registered.
3022
+ */
3023
+ openDialog : function( dialogName, callback )
3024
+ {
3025
+ if ( this.mode == 'wysiwyg' && CKEDITOR.env.ie )
3026
+ {
3027
+ var selection = this.getSelection();
3028
+ selection && selection.lock();
3029
+ }
3030
+
3031
+ var dialogDefinitions = CKEDITOR.dialog._.dialogDefinitions[ dialogName ],
3032
+ dialogSkin = this.skin.dialog;
3033
+
3034
+ if ( CKEDITOR.dialog._.currentTop === null )
3035
+ showCover( this );
3036
+
3037
+ // If the dialogDefinition is already loaded, open it immediately.
3038
+ if ( typeof dialogDefinitions == 'function' && dialogSkin._isLoaded )
3039
+ {
3040
+ var storedDialogs = this._.storedDialogs ||
3041
+ ( this._.storedDialogs = {} );
3042
+
3043
+ var dialog = storedDialogs[ dialogName ] ||
3044
+ ( storedDialogs[ dialogName ] = new CKEDITOR.dialog( this, dialogName ) );
3045
+
3046
+ callback && callback.call( dialog, dialog );
3047
+ dialog.show();
3048
+
3049
+ return dialog;
3050
+ }
3051
+ else if ( dialogDefinitions == 'failed' )
3052
+ {
3053
+ hideCover();
3054
+ throw new Error( '[CKEDITOR.dialog.openDialog] Dialog "' + dialogName + '" failed when loading definition.' );
3055
+ }
3056
+
3057
+ var me = this;
3058
+
3059
+ function onDialogFileLoaded( success )
3060
+ {
3061
+ var dialogDefinition = CKEDITOR.dialog._.dialogDefinitions[ dialogName ],
3062
+ skin = me.skin.dialog;
3063
+
3064
+ // Check if both skin part and definition is loaded.
3065
+ if ( !skin._isLoaded || loadDefinition && typeof success == 'undefined' )
3066
+ return;
3067
+
3068
+ // In case of plugin error, mark it as loading failed.
3069
+ if ( typeof dialogDefinition != 'function' )
3070
+ CKEDITOR.dialog._.dialogDefinitions[ dialogName ] = 'failed';
3071
+
3072
+ me.openDialog( dialogName, callback );
3073
+ }
3074
+
3075
+ if ( typeof dialogDefinitions == 'string' )
3076
+ {
3077
+ var loadDefinition = 1;
3078
+ CKEDITOR.scriptLoader.load( CKEDITOR.getUrl( dialogDefinitions ), onDialogFileLoaded, null, 0, 1 );
3079
+ }
3080
+
3081
+ CKEDITOR.skins.load( this, 'dialog', onDialogFileLoaded );
3082
+
3083
+ return null;
3084
+ }
3085
+ });
3086
+ })();
3087
+
3088
+ CKEDITOR.plugins.add( 'dialog',
3089
+ {
3090
+ requires : [ 'dialogui' ]
3091
+ });
3092
+
3093
+ // Dialog related configurations.
3094
+
3095
+ /**
3096
+ * The color of the dialog background cover. It should be a valid CSS color
3097
+ * string.
3098
+ * @name CKEDITOR.config.dialog_backgroundCoverColor
3099
+ * @type String
3100
+ * @default 'white'
3101
+ * @example
3102
+ * config.dialog_backgroundCoverColor = 'rgb(255, 254, 253)';
3103
+ */
3104
+
3105
+ /**
3106
+ * The opacity of the dialog background cover. It should be a number within the
3107
+ * range [0.0, 1.0].
3108
+ * @name CKEDITOR.config.dialog_backgroundCoverOpacity
3109
+ * @type Number
3110
+ * @default 0.5
3111
+ * @example
3112
+ * config.dialog_backgroundCoverOpacity = 0.7;
3113
+ */
3114
+
3115
+ /**
3116
+ * If the dialog has more than one tab, put focus into the first tab as soon as dialog is opened.
3117
+ * @name CKEDITOR.config.dialog_startupFocusTab
3118
+ * @type Boolean
3119
+ * @default false
3120
+ * @example
3121
+ * config.dialog_startupFocusTab = true;
3122
+ */
3123
+
3124
+ /**
3125
+ * The distance of magnetic borders used in moving and resizing dialogs,
3126
+ * measured in pixels.
3127
+ * @name CKEDITOR.config.dialog_magnetDistance
3128
+ * @type Number
3129
+ * @default 20
3130
+ * @example
3131
+ * config.dialog_magnetDistance = 30;
3132
+ */
3133
+
3134
+ /**
3135
+ * The guideline to follow when generating the dialog buttons. There are 3 possible options:
3136
+ * <ul>
3137
+ * <li>'OS' - the buttons will be displayed in the default order of the user's OS;</li>
3138
+ * <li>'ltr' - for Left-To-Right order;</li>
3139
+ * <li>'rtl' - for Right-To-Left order.</li>
3140
+ * </ul>
3141
+ * @name CKEDITOR.config.dialog_buttonsOrder
3142
+ * @type String
3143
+ * @default 'OS'
3144
+ * @since 3.5
3145
+ * @example
3146
+ * config.dialog_buttonsOrder = 'rtl';
3147
+ */
3148
+
3149
+ /**
3150
+ * The dialog contents to removed. It's a string composed by dialog name and tab name with a colon between them.
3151
+ * Separate each pair with semicolon (see example).
3152
+ * <b>Note: All names are case-sensitive.</b>
3153
+ * <b>Note: Be cautious when specifying dialog tabs that are mandatory, like "info", dialog functionality might be broken because of this!</b>
3154
+ * @name CKEDITOR.config.removeDialogTabs
3155
+ * @type String
3156
+ * @since 3.5
3157
+ * @default ''
3158
+ * @example
3159
+ * config.removeDialogTabs = 'flash:advanced;image:Link';
3160
+ */
3161
+
3162
+ /**
3163
+ * Fired when a dialog definition is about to be used to create a dialog into
3164
+ * an editor instance. This event makes it possible to customize the definition
3165
+ * before creating it.
3166
+ * <p>Note that this event is called only the first time a specific dialog is
3167
+ * opened. Successive openings will use the cached dialog, and this event will
3168
+ * not get fired.</p>
3169
+ * @name CKEDITOR#dialogDefinition
3170
+ * @event
3171
+ * @param {CKEDITOR.dialog.definition} data The dialog defination that
3172
+ * is being loaded.
3173
+ * @param {CKEDITOR.editor} editor The editor instance that will use the
3174
+ * dialog.
3175
+ */
3176
+
3177
+ /**
3178
+ * Fired when a tab is going to be selected in a dialog
3179
+ * @name CKEDITOR.dialog#selectPage
3180
+ * @event
3181
+ * @param {String} page The id of the page that it's gonna be selected.
3182
+ * @param {String} currentPage The id of the current page.
3183
+ */
3184
+
3185
+ /**
3186
+ * Fired when the user tries to dismiss a dialog
3187
+ * @name CKEDITOR.dialog#cancel
3188
+ * @event
3189
+ * @param {Boolean} hide Whether the event should proceed or not.
3190
+ */
3191
+
3192
+ /**
3193
+ * Fired when the user tries to confirm a dialog
3194
+ * @name CKEDITOR.dialog#ok
3195
+ * @event
3196
+ * @param {Boolean} hide Whether the event should proceed or not.
3197
+ */
3198
+
3199
+ /**
3200
+ * Fired when a dialog is shown
3201
+ * @name CKEDITOR.dialog#show
3202
+ * @event
3203
+ */
3204
+
3205
+ /**
3206
+ * Fired when a dialog is shown
3207
+ * @name CKEDITOR.editor#dialogShow
3208
+ * @event
3209
+ */
3210
+
3211
+ /**
3212
+ * Fired when a dialog is hidden
3213
+ * @name CKEDITOR.dialog#hide
3214
+ * @event
3215
+ */
3216
+
3217
+ /**
3218
+ * Fired when a dialog is hidden
3219
+ * @name CKEDITOR.editor#dialogHide
3220
+ * @event
3221
+ */
3222
+
3223
+ /**
3224
+ * Fired when a dialog is being resized. The event is fired on
3225
+ * both the 'CKEDITOR.dialog' object and the dialog instance
3226
+ * since 3.5.3, previously it's available only in the global object.
3227
+ * @name CKEDITOR.dialog#resize
3228
+ * @since 3.5
3229
+ * @event
3230
+ * @param {CKEDITOR.dialog} dialog The dialog being resized (if
3231
+ * it's fired on the dialog itself, this parameter isn't sent).
3232
+ * @param {String} skin The skin name.
3233
+ * @param {Number} width The new width.
3234
+ * @param {Number} height The new height.
3235
+ */