inline_forms 0.9.17 → 0.9.18

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