radiant-ck_editor_filter-extension 0.1.1

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