lolita 3.1.10 → 3.1.11

Sign up to get free protection for your applications and to get access to all the features.
Files changed (239) hide show
  1. data/.document +5 -5
  2. data/.rspec +2 -2
  3. data/GUIDELINES.rdoc +24 -24
  4. data/Gemfile +26 -26
  5. data/History.rdoc +162 -154
  6. data/LICENSE.txt +22 -22
  7. data/README.rdoc +98 -98
  8. data/Rakefile +40 -40
  9. data/VERSION +1 -1
  10. data/app/controllers/lolita/info_controller.rb +41 -41
  11. data/app/controllers/lolita/rest_controller.rb +130 -130
  12. data/app/helpers/components/lolita/configuration/list_component.rb +10 -10
  13. data/app/helpers/lolita_helper.rb +11 -11
  14. data/app/views/components/lolita/configuration/column/_display.html.erb +4 -4
  15. data/app/views/components/lolita/configuration/column/_header.html.erb +7 -7
  16. data/app/views/components/lolita/configuration/column/_sort.html.erb +4 -4
  17. data/app/views/components/lolita/configuration/columns/_body.html.erb +4 -4
  18. data/app/views/components/lolita/configuration/columns/_display.html.erb +1 -1
  19. data/app/views/components/lolita/configuration/columns/_first.html.erb +2 -2
  20. data/app/views/components/lolita/configuration/columns/_first_column_header.html.erb +3 -3
  21. data/app/views/components/lolita/configuration/columns/_header.html.erb +8 -8
  22. data/app/views/components/lolita/configuration/columns/_last.html.erb +4 -4
  23. data/app/views/components/lolita/configuration/columns/_last_column_header.html.erb +2 -2
  24. data/app/views/components/lolita/configuration/columns/_row.html.erb +7 -7
  25. data/app/views/components/lolita/configuration/field/_display.html.erb +9 -9
  26. data/app/views/components/lolita/configuration/field/_label.html.erb +1 -1
  27. data/app/views/components/lolita/configuration/field/_object.html.erb +1 -1
  28. data/app/views/components/lolita/configuration/field/array/_display.html.erb +4 -4
  29. data/app/views/components/lolita/configuration/field/array/habtm/_display.html.erb +26 -26
  30. data/app/views/components/lolita/configuration/field/array/select/_display.html.erb +5 -5
  31. data/app/views/components/lolita/configuration/field/boolean/filter/_display.html.erb +1 -1
  32. data/app/views/components/lolita/configuration/field/date/_display.html.erb +1 -1
  33. data/app/views/components/lolita/configuration/field/date_time/date/_display.html.erb +1 -1
  34. data/app/views/components/lolita/configuration/field/integer/_display.html.erb +1 -1
  35. data/app/views/components/lolita/configuration/field/string/_display.html.erb +4 -4
  36. data/app/views/components/lolita/configuration/field/string/disabled/_display.html.erb +1 -1
  37. data/app/views/components/lolita/configuration/field/string/password/_display.html.erb +3 -3
  38. data/app/views/components/lolita/configuration/field/string/text/_display.html.erb +18 -18
  39. data/app/views/components/lolita/configuration/field_set/_display.html.erb +5 -5
  40. data/app/views/components/lolita/configuration/list/_display.html.erb +10 -10
  41. data/app/views/components/lolita/configuration/list/_filter.html.erb +7 -7
  42. data/app/views/components/lolita/configuration/list/_new_resource.html.erb +4 -4
  43. data/app/views/components/lolita/configuration/list/_title.html.erb +4 -4
  44. data/app/views/components/lolita/configuration/tab/_display.html.erb +17 -17
  45. data/app/views/components/lolita/configuration/tab/_fields.html.erb +6 -6
  46. data/app/views/components/lolita/configuration/tab/content/_display.html.erb +1 -1
  47. data/app/views/components/lolita/configuration/tab/default/_display.html.erb +8 -8
  48. data/app/views/components/lolita/configuration/tabs/_display.html.erb +10 -10
  49. data/app/views/components/lolita/navigation/_display.html.erb +2 -2
  50. data/app/views/components/lolita/navigation/_tree.html.erb +38 -38
  51. data/app/views/components/lolita/shared/_flash.html.erb +5 -5
  52. data/app/views/components/lolita/shared/_header.html.erb +8 -8
  53. data/app/views/components/lolita/shared/_right_sidebar.html.erb +13 -13
  54. data/app/views/layouts/lolita/application.html.erb +44 -44
  55. data/app/views/lolita/info/index.html.erb +232 -232
  56. data/app/views/lolita/rest/form.html.erb +1 -1
  57. data/app/views/lolita/rest/index.html.erb +1 -1
  58. data/author +1 -1
  59. data/config/locales/default/lv.yml +180 -180
  60. data/config/locales/en.yml +20 -20
  61. data/config/locales/lv.yml +20 -20
  62. data/config/routes.rb +3 -3
  63. data/db/seed.rb +1 -1
  64. data/features/create_page.feature +19 -19
  65. data/features/step_definitions/lolita_steps.rb +7 -7
  66. data/features/step_definitions/web_steps.rb +219 -219
  67. data/features/support/env.rb +73 -73
  68. data/features/support/paths.rb +35 -35
  69. data/lib/generators/helpers/file_helper.rb +22 -22
  70. data/lib/generators/lolita/assets_generator.rb +18 -18
  71. data/lib/generators/lolita/install_generator.rb +28 -28
  72. data/lib/generators/templates/lolita.rb +19 -19
  73. data/lib/lolita.rb +184 -184
  74. data/lib/lolita/adapter/abstract_adapter.rb +13 -13
  75. data/lib/lolita/adapter/active_record.rb +148 -148
  76. data/lib/lolita/adapter/mongoid.rb +127 -127
  77. data/lib/lolita/base_configuration.rb +165 -165
  78. data/lib/lolita/builder.rb +249 -249
  79. data/lib/lolita/configuration/base.rb +76 -76
  80. data/lib/lolita/configuration/column.rb +93 -94
  81. data/lib/lolita/configuration/columns.rb +66 -66
  82. data/lib/lolita/configuration/factory.rb +55 -55
  83. data/lib/lolita/configuration/field.rb +216 -216
  84. data/lib/lolita/configuration/field/array.rb +75 -75
  85. data/lib/lolita/configuration/field/big_decimal.rb +12 -12
  86. data/lib/lolita/configuration/field/boolean.rb +12 -12
  87. data/lib/lolita/configuration/field/date.rb +12 -12
  88. data/lib/lolita/configuration/field/date_time.rb +13 -13
  89. data/lib/lolita/configuration/field/integer.rb +12 -12
  90. data/lib/lolita/configuration/field/string.rb +13 -13
  91. data/lib/lolita/configuration/field/time.rb +13 -13
  92. data/lib/lolita/configuration/field_set.rb +25 -25
  93. data/lib/lolita/configuration/fields.rb +35 -35
  94. data/lib/lolita/configuration/filter.rb +108 -108
  95. data/lib/lolita/configuration/list.rb +104 -104
  96. data/lib/lolita/configuration/page.rb +125 -124
  97. data/lib/lolita/configuration/tab.rb +187 -187
  98. data/lib/lolita/configuration/tab/content.rb +21 -21
  99. data/lib/lolita/configuration/tab/default.rb +25 -25
  100. data/lib/lolita/configuration/tabs.rb +132 -132
  101. data/lib/lolita/controllers/component_helpers.rb +127 -127
  102. data/lib/lolita/controllers/internal_helpers.rb +109 -109
  103. data/lib/lolita/controllers/url_helpers.rb +111 -111
  104. data/lib/lolita/controllers/user_helpers.rb +32 -32
  105. data/lib/lolita/controllers/view_user_helpers.rb +12 -12
  106. data/lib/lolita/dbi/base.rb +50 -50
  107. data/lib/lolita/errors.rb +12 -12
  108. data/lib/lolita/hooks.rb +355 -355
  109. data/lib/lolita/hooks/named_hook.rb +125 -125
  110. data/lib/lolita/lazy_loader.rb +46 -46
  111. data/lib/lolita/mapping.rb +55 -55
  112. data/lib/lolita/modules.rb +6 -6
  113. data/lib/lolita/modules/rest.rb +10 -10
  114. data/lib/lolita/navigation/branch.rb +132 -132
  115. data/lib/lolita/navigation/tree.rb +116 -116
  116. data/lib/lolita/observed_array.rb +74 -74
  117. data/lib/lolita/rails.rb +20 -20
  118. data/lib/lolita/rails/all.rb +10 -10
  119. data/lib/lolita/rails/routes.rb +133 -133
  120. data/lib/lolita/ruby_ext/accessors.rb +26 -26
  121. data/lib/lolita/support/formatter.rb +62 -62
  122. data/lib/lolita/support/formatter/rails.rb +56 -56
  123. data/lib/lolita/test/matchers.rb +77 -77
  124. data/lolita.gemspec +2 -2
  125. data/public/javascripts/jquery-1.6.min.js +15 -15
  126. data/public/javascripts/jquery-ui-1.8.13.min.js +407 -407
  127. data/public/javascripts/lolita/main.js +39 -39
  128. data/public/javascripts/lolita/tab.js +41 -41
  129. data/public/javascripts/modernizr-1.7.min.js +1 -1
  130. data/public/javascripts/rails.js +137 -137
  131. data/public/javascripts/tinymce/langs/en.js +221 -221
  132. data/public/javascripts/tinymce/license.txt +504 -504
  133. data/public/javascripts/tinymce/themes/advanced/about.htm +52 -52
  134. data/public/javascripts/tinymce/themes/advanced/anchor.htm +26 -26
  135. data/public/javascripts/tinymce/themes/advanced/charmap.htm +51 -51
  136. data/public/javascripts/tinymce/themes/advanced/color_picker.htm +74 -74
  137. data/public/javascripts/tinymce/themes/advanced/editor_template_src.js +1328 -1328
  138. data/public/javascripts/tinymce/themes/advanced/image.htm +80 -80
  139. data/public/javascripts/tinymce/themes/advanced/js/about.js +73 -73
  140. data/public/javascripts/tinymce/themes/advanced/js/anchor.js +42 -42
  141. data/public/javascripts/tinymce/themes/advanced/js/charmap.js +354 -354
  142. data/public/javascripts/tinymce/themes/advanced/js/color_picker.js +329 -329
  143. data/public/javascripts/tinymce/themes/advanced/js/image.js +247 -247
  144. data/public/javascripts/tinymce/themes/advanced/js/link.js +153 -153
  145. data/public/javascripts/tinymce/themes/advanced/js/source_editor.js +56 -56
  146. data/public/javascripts/tinymce/themes/advanced/langs/en.js +68 -68
  147. data/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +53 -53
  148. data/public/javascripts/tinymce/themes/advanced/link.htm +57 -57
  149. data/public/javascripts/tinymce/themes/advanced/shortcuts.htm +47 -47
  150. data/public/javascripts/tinymce/themes/advanced/skins/cirkuit/content.css +66 -66
  151. data/public/javascripts/tinymce/themes/advanced/skins/cirkuit/dialog.css +117 -117
  152. data/public/javascripts/tinymce/themes/advanced/skins/cirkuit/ui.css +988 -988
  153. data/public/javascripts/tinymce/themes/advanced/source_editor.htm +25 -25
  154. data/public/javascripts/tinymce/tiny_mce_popup.js +4 -4
  155. data/public/javascripts/tinymce_config.js +15 -15
  156. data/public/stylesheets/lolita/default.css +169 -169
  157. data/public/stylesheets/lolita/style.css +253 -253
  158. data/spec/adapter_helper.rb +43 -43
  159. data/spec/builder_spec.rb +120 -120
  160. data/spec/configuration/base_spec.rb +44 -44
  161. data/spec/configuration/column_spec.rb +89 -89
  162. data/spec/configuration/columns_spec.rb +54 -54
  163. data/spec/configuration/field_set_spec.rb +12 -12
  164. data/spec/configuration/field_spec.rb +118 -118
  165. data/spec/configuration/filter_spec.rb +122 -122
  166. data/spec/configuration/list_spec.rb +76 -76
  167. data/spec/configuration/page_spec.rb +19 -19
  168. data/spec/configuration/tab_spec.rb +165 -165
  169. data/spec/configuration/tabs_spec.rb +106 -106
  170. data/spec/controllers/component_helpers_spec.rb +5 -5
  171. data/spec/controllers/internal_helpers_spec.rb +76 -76
  172. data/spec/controllers/lolita_rest_nested_resources_spec.rb +33 -33
  173. data/spec/controllers/lolita_rest_spec.rb +53 -53
  174. data/spec/dbi/base_spec.rb +44 -44
  175. data/spec/hooks_spec.rb +257 -257
  176. data/spec/lolita_spec.rb +13 -13
  177. data/spec/mapping_spec.rb +29 -29
  178. data/spec/navigation/branch_spec.rb +81 -81
  179. data/spec/navigation/tree_spec.rb +73 -73
  180. data/spec/orm/mongoid.rb +11 -11
  181. data/spec/rails_app/app/controllers/application_controller.rb +3 -3
  182. data/spec/rails_app/app/helpers/application_helper.rb +3 -3
  183. data/spec/rails_app/app/mongoid/address.rb +7 -7
  184. data/spec/rails_app/app/mongoid/category.rb +5 -5
  185. data/spec/rails_app/app/mongoid/comment.rb +5 -5
  186. data/spec/rails_app/app/mongoid/post.rb +18 -18
  187. data/spec/rails_app/app/mongoid/preference.rb +5 -5
  188. data/spec/rails_app/app/mongoid/profile.rb +13 -13
  189. data/spec/rails_app/app/mongoid/tag.rb +3 -3
  190. data/spec/rails_app/app/views/components/lolita/configuration/list/_body_cell.html.erb +1 -1
  191. data/spec/rails_app/config/application.rb +26 -26
  192. data/spec/rails_app/config/boot.rb +13 -13
  193. data/spec/rails_app/config/environment.rb +5 -5
  194. data/spec/rails_app/config/environments/development.rb +19 -19
  195. data/spec/rails_app/config/environments/production.rb +33 -33
  196. data/spec/rails_app/config/environments/test.rb +33 -33
  197. data/spec/rails_app/config/initializers/backtrace_silencers.rb +7 -7
  198. data/spec/rails_app/config/initializers/inflections.rb +2 -2
  199. data/spec/rails_app/config/initializers/secret_token.rb +1 -1
  200. data/spec/rails_app/config/routes.rb +2 -2
  201. data/spec/rails_app/lib/lolita/configuration/field/my_custom_collection.rb +13 -13
  202. data/spec/rails_app/public/javascripts/jquery-1.5.1.min.js +15 -15
  203. data/spec/rails_app/public/javascripts/lolita/main.js +6 -6
  204. data/spec/rails_app/public/javascripts/lolita/tab.js +40 -40
  205. data/spec/rails_app/public/javascripts/modernizr-1.7.min.js +1 -1
  206. data/spec/rails_app/public/javascripts/rails.js +137 -137
  207. data/spec/rails_app/public/javascripts/tinymce/langs/en.js +221 -221
  208. data/spec/rails_app/public/javascripts/tinymce/license.txt +504 -504
  209. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/about.htm +52 -52
  210. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/anchor.htm +26 -26
  211. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/charmap.htm +51 -51
  212. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/color_picker.htm +74 -74
  213. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/editor_template_src.js +1328 -1328
  214. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/image.htm +80 -80
  215. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/about.js +73 -73
  216. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/anchor.js +42 -42
  217. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/charmap.js +354 -354
  218. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/color_picker.js +329 -329
  219. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/image.js +247 -247
  220. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/link.js +153 -153
  221. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/js/source_editor.js +56 -56
  222. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/langs/en.js +68 -68
  223. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/langs/en_dlg.js +53 -53
  224. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/link.htm +57 -57
  225. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/shortcuts.htm +47 -47
  226. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/skins/cirkuit/content.css +66 -66
  227. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/skins/cirkuit/dialog.css +117 -117
  228. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/skins/cirkuit/ui.css +988 -988
  229. data/spec/rails_app/public/javascripts/tinymce/themes/advanced/source_editor.htm +25 -25
  230. data/spec/rails_app/public/javascripts/tinymce/tiny_mce_popup.js +4 -4
  231. data/spec/rails_app/public/stylesheets/lolita/default.css +169 -169
  232. data/spec/rails_app/public/stylesheets/lolita/style.css +214 -214
  233. data/spec/routing/routes_spec.rb +15 -15
  234. data/spec/spec_helper.rb +46 -46
  235. data/spec/support/factories/category.rb +3 -3
  236. data/spec/support/factories/post.rb +4 -4
  237. data/spec/support/factories/tag.rb +2 -2
  238. data/spec/support/formatter_spec.rb +42 -42
  239. metadata +31 -31
@@ -1,52 +1,52 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <title>{#advanced_dlg.about_title}</title>
5
- <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6
- <script type="text/javascript" src="../../utils/mctabs.js"></script>
7
- <script type="text/javascript" src="js/about.js"></script>
8
- </head>
9
- <body id="about" style="display: none">
10
- <div class="tabs">
11
- <ul>
12
- <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.about_general}</a></span></li>
13
- <li id="help_tab" style="display:none" aria-hidden="true" aria-controls="help_panel"><span><a href="javascript:mcTabs.displayTab('help_tab','help_panel');" onmousedown="return false;">{#advanced_dlg.about_help}</a></span></li>
14
- <li id="plugins_tab" aria-controls="plugins_panel"><span><a href="javascript:mcTabs.displayTab('plugins_tab','plugins_panel');" onmousedown="return false;">{#advanced_dlg.about_plugins}</a></span></li>
15
- </ul>
16
- </div>
17
-
18
- <div class="panel_wrapper">
19
- <div id="general_panel" class="panel current">
20
- <h3>{#advanced_dlg.about_title}</h3>
21
- <p>Version: <span id="version"></span> (<span id="date"></span>)</p>
22
- <p>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under <a href="../../license.txt" target="_blank">LGPL</a>
23
- by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</p>
24
- <p>Copyright &copy; 2003-2008, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
25
- <p>For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.</p>
26
-
27
- <div id="buttoncontainer">
28
- <a href="http://www.moxiecode.com" target="_blank"><img src="http://tinymce.moxiecode.com/images/gotmoxie.png" alt="Got Moxie?" border="0" /></a>
29
- </div>
30
- </div>
31
-
32
- <div id="plugins_panel" class="panel">
33
- <div id="pluginscontainer">
34
- <h3>{#advanced_dlg.about_loaded}</h3>
35
-
36
- <div id="plugintablecontainer">
37
- </div>
38
-
39
- <p>&nbsp;</p>
40
- </div>
41
- </div>
42
-
43
- <div id="help_panel" class="panel noscroll" style="overflow: visible;">
44
- <div id="iframecontainer"></div>
45
- </div>
46
- </div>
47
-
48
- <div class="mceActionPanel">
49
- <input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" />
50
- </div>
51
- </body>
52
- </html>
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <title>{#advanced_dlg.about_title}</title>
5
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
7
+ <script type="text/javascript" src="js/about.js"></script>
8
+ </head>
9
+ <body id="about" style="display: none">
10
+ <div class="tabs">
11
+ <ul>
12
+ <li id="general_tab" class="current" aria-controls="general_panel"><span><a href="javascript:mcTabs.displayTab('general_tab','general_panel');" onmousedown="return false;">{#advanced_dlg.about_general}</a></span></li>
13
+ <li id="help_tab" style="display:none" aria-hidden="true" aria-controls="help_panel"><span><a href="javascript:mcTabs.displayTab('help_tab','help_panel');" onmousedown="return false;">{#advanced_dlg.about_help}</a></span></li>
14
+ <li id="plugins_tab" aria-controls="plugins_panel"><span><a href="javascript:mcTabs.displayTab('plugins_tab','plugins_panel');" onmousedown="return false;">{#advanced_dlg.about_plugins}</a></span></li>
15
+ </ul>
16
+ </div>
17
+
18
+ <div class="panel_wrapper">
19
+ <div id="general_panel" class="panel current">
20
+ <h3>{#advanced_dlg.about_title}</h3>
21
+ <p>Version: <span id="version"></span> (<span id="date"></span>)</p>
22
+ <p>TinyMCE is a platform independent web based Javascript HTML WYSIWYG editor control released as Open Source under <a href="../../license.txt" target="_blank">LGPL</a>
23
+ by Moxiecode Systems AB. It has the ability to convert HTML TEXTAREA fields or other HTML elements to editor instances.</p>
24
+ <p>Copyright &copy; 2003-2008, <a href="http://www.moxiecode.com" target="_blank">Moxiecode Systems AB</a>, All rights reserved.</p>
25
+ <p>For more information about this software visit the <a href="http://tinymce.moxiecode.com" target="_blank">TinyMCE website</a>.</p>
26
+
27
+ <div id="buttoncontainer">
28
+ <a href="http://www.moxiecode.com" target="_blank"><img src="http://tinymce.moxiecode.com/images/gotmoxie.png" alt="Got Moxie?" border="0" /></a>
29
+ </div>
30
+ </div>
31
+
32
+ <div id="plugins_panel" class="panel">
33
+ <div id="pluginscontainer">
34
+ <h3>{#advanced_dlg.about_loaded}</h3>
35
+
36
+ <div id="plugintablecontainer">
37
+ </div>
38
+
39
+ <p>&nbsp;</p>
40
+ </div>
41
+ </div>
42
+
43
+ <div id="help_panel" class="panel noscroll" style="overflow: visible;">
44
+ <div id="iframecontainer"></div>
45
+ </div>
46
+ </div>
47
+
48
+ <div class="mceActionPanel">
49
+ <input type="button" id="cancel" name="cancel" value="{#close}" onclick="tinyMCEPopup.close();" />
50
+ </div>
51
+ </body>
52
+ </html>
@@ -1,26 +1,26 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <title>{#advanced_dlg.anchor_title}</title>
5
- <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6
- <script type="text/javascript" src="js/anchor.js"></script>
7
- </head>
8
- <body style="display: none" role="application" aria-labelledby="app_title">
9
- <form onsubmit="AnchorDialog.update();return false;" action="#">
10
- <table border="0" cellpadding="4" cellspacing="0" role="presentation">
11
- <tr>
12
- <td colspan="2" class="title" id="app_title">{#advanced_dlg.anchor_title}</td>
13
- </tr>
14
- <tr>
15
- <td class="nowrap"><label for="anchorName">{#advanced_dlg.anchor_name}:</label></td>
16
- <td><input name="anchorName" type="text" class="mceFocus" id="anchorName" value="" style="width: 200px" aria-required="true" /></td>
17
- </tr>
18
- </table>
19
-
20
- <div class="mceActionPanel">
21
- <input type="submit" id="insert" name="insert" value="{#update}" />
22
- <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
23
- </div>
24
- </form>
25
- </body>
26
- </html>
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <title>{#advanced_dlg.anchor_title}</title>
5
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6
+ <script type="text/javascript" src="js/anchor.js"></script>
7
+ </head>
8
+ <body style="display: none" role="application" aria-labelledby="app_title">
9
+ <form onsubmit="AnchorDialog.update();return false;" action="#">
10
+ <table border="0" cellpadding="4" cellspacing="0" role="presentation">
11
+ <tr>
12
+ <td colspan="2" class="title" id="app_title">{#advanced_dlg.anchor_title}</td>
13
+ </tr>
14
+ <tr>
15
+ <td class="nowrap"><label for="anchorName">{#advanced_dlg.anchor_name}:</label></td>
16
+ <td><input name="anchorName" type="text" class="mceFocus" id="anchorName" value="" style="width: 200px" aria-required="true" /></td>
17
+ </tr>
18
+ </table>
19
+
20
+ <div class="mceActionPanel">
21
+ <input type="submit" id="insert" name="insert" value="{#update}" />
22
+ <input type="button" id="cancel" name="cancel" value="{#cancel}" onclick="tinyMCEPopup.close();" />
23
+ </div>
24
+ </form>
25
+ </body>
26
+ </html>
@@ -1,51 +1,51 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <title>{#advanced_dlg.charmap_title}</title>
5
- <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6
- <script type="text/javascript" src="js/charmap.js"></script>
7
- </head>
8
- <body id="charmap" style="display:none">
9
- <table align="center" border="0" cellspacing="0" cellpadding="2" role="presentation">
10
- <tr>
11
- <td colspan="2" class="title" ><label for="charmapView" id="charmap_label">{#advanced_dlg.charmap_title}</label></td>
12
- </tr>
13
- <tr>
14
- <td id="charmapView" rowspan="2" align="left" valign="top">
15
- <!-- Chars will be rendered here -->
16
- </td>
17
- <td width="100" align="center" valign="top">
18
- <table border="0" cellpadding="0" cellspacing="0" width="100" style="height:100px" role="presentation">
19
- <tr>
20
- <td id="codeV">&nbsp;</td>
21
- </tr>
22
- <tr>
23
- <td id="codeN">&nbsp;</td>
24
- </tr>
25
- </table>
26
- </td>
27
- </tr>
28
- <tr>
29
- <td valign="bottom" style="padding-bottom: 3px;">
30
- <table width="100" align="center" border="0" cellpadding="2" cellspacing="0" role="presentation">
31
- <tr>
32
- <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;"><label for="codeA">HTML-Code</label></td>
33
- </tr>
34
- <tr>
35
- <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeA" align="center">&nbsp;</td>
36
- </tr>
37
- <tr>
38
- <td style="font-size: 1px;">&nbsp;</td>
39
- </tr>
40
- <tr>
41
- <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;"><label for="codeB">NUM-Code</label></td>
42
- </tr>
43
- <tr>
44
- <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeB" align="center">&nbsp;</td>
45
- </tr>
46
- </table>
47
- </td>
48
- </tr>
49
- </table>
50
- </body>
51
- </html>
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <title>{#advanced_dlg.charmap_title}</title>
5
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6
+ <script type="text/javascript" src="js/charmap.js"></script>
7
+ </head>
8
+ <body id="charmap" style="display:none">
9
+ <table align="center" border="0" cellspacing="0" cellpadding="2" role="presentation">
10
+ <tr>
11
+ <td colspan="2" class="title" ><label for="charmapView" id="charmap_label">{#advanced_dlg.charmap_title}</label></td>
12
+ </tr>
13
+ <tr>
14
+ <td id="charmapView" rowspan="2" align="left" valign="top">
15
+ <!-- Chars will be rendered here -->
16
+ </td>
17
+ <td width="100" align="center" valign="top">
18
+ <table border="0" cellpadding="0" cellspacing="0" width="100" style="height:100px" role="presentation">
19
+ <tr>
20
+ <td id="codeV">&nbsp;</td>
21
+ </tr>
22
+ <tr>
23
+ <td id="codeN">&nbsp;</td>
24
+ </tr>
25
+ </table>
26
+ </td>
27
+ </tr>
28
+ <tr>
29
+ <td valign="bottom" style="padding-bottom: 3px;">
30
+ <table width="100" align="center" border="0" cellpadding="2" cellspacing="0" role="presentation">
31
+ <tr>
32
+ <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;"><label for="codeA">HTML-Code</label></td>
33
+ </tr>
34
+ <tr>
35
+ <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeA" align="center">&nbsp;</td>
36
+ </tr>
37
+ <tr>
38
+ <td style="font-size: 1px;">&nbsp;</td>
39
+ </tr>
40
+ <tr>
41
+ <td align="center" style="border-left: 1px solid #666699; border-top: 1px solid #666699; border-right: 1px solid #666699;"><label for="codeB">NUM-Code</label></td>
42
+ </tr>
43
+ <tr>
44
+ <td style="font-size: 16px; font-weight: bold; border-left: 1px solid #666699; border-bottom: 1px solid #666699; border-right: 1px solid #666699;" id="codeB" align="center">&nbsp;</td>
45
+ </tr>
46
+ </table>
47
+ </td>
48
+ </tr>
49
+ </table>
50
+ </body>
51
+ </html>
@@ -1,74 +1,74 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <title>{#advanced_dlg.colorpicker_title}</title>
5
- <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6
- <script type="text/javascript" src="../../utils/mctabs.js"></script>
7
- <script type="text/javascript" src="js/color_picker.js"></script>
8
- </head>
9
- <body id="colorpicker" style="display: none" role="application" aria-labelledby="app_label">
10
- <span class="mceVoiceLabel" id="app_label" style="display:none;">{#advanced_dlg.colorpicker_title}</span>
11
- <form onsubmit="insertAction();return false" action="#">
12
- <div class="tabs">
13
- <ul>
14
- <li id="picker_tab" aria-controls="picker_panel" class="current"><span><a href="javascript:mcTabs.displayTab('picker_tab','picker_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_picker_tab}</a></span></li>
15
- <li id="rgb_tab" aria-controls="rgb_panel"><span><a href="javascript:;" onclick="mcTabs.displayTab('rgb_tab','rgb_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_palette_tab}</a></span></li>
16
- <li id="named_tab" aria-controls="named_panel"><span><a href="javascript:;" onclick="javascript:mcTabs.displayTab('named_tab','named_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_named_tab}</a></span></li>
17
- </ul>
18
- </div>
19
-
20
- <div class="panel_wrapper">
21
- <div id="picker_panel" class="panel current">
22
- <fieldset>
23
- <legend>{#advanced_dlg.colorpicker_picker_title}</legend>
24
- <div id="picker">
25
- <img id="colors" src="img/colorpicker.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" alt="" />
26
-
27
- <div id="light">
28
- <!-- Will be filled with divs -->
29
- </div>
30
-
31
- <br style="clear: both" />
32
- </div>
33
- </fieldset>
34
- </div>
35
-
36
- <div id="rgb_panel" class="panel">
37
- <fieldset>
38
- <legend id="webcolors_title">{#advanced_dlg.colorpicker_palette_title}</legend>
39
- <div id="webcolors">
40
- <!-- Gets filled with web safe colors-->
41
- </div>
42
-
43
- <br style="clear: both" />
44
- </fieldset>
45
- </div>
46
-
47
- <div id="named_panel" class="panel">
48
- <fieldset id="named_picker_label">
49
- <legend id="named_title">{#advanced_dlg.colorpicker_named_title}</legend>
50
- <div id="namedcolors" role="listbox" tabindex="0" aria-labelledby="named_picker_label">
51
- <!-- Gets filled with named colors-->
52
- </div>
53
-
54
- <br style="clear: both" />
55
-
56
- <div id="colornamecontainer">
57
- {#advanced_dlg.colorpicker_name} <span id="colorname"></span>
58
- </div>
59
- </fieldset>
60
- </div>
61
- </div>
62
-
63
- <div class="mceActionPanel">
64
- <input type="submit" id="insert" name="insert" value="{#apply}" />
65
-
66
- <div id="preview"></div>
67
-
68
- <div id="previewblock">
69
- <label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" class="text mceFocus" aria-required="true" />
70
- </div>
71
- </div>
72
- </form>
73
- </body>
74
- </html>
1
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
+ <html xmlns="http://www.w3.org/1999/xhtml">
3
+ <head>
4
+ <title>{#advanced_dlg.colorpicker_title}</title>
5
+ <script type="text/javascript" src="../../tiny_mce_popup.js"></script>
6
+ <script type="text/javascript" src="../../utils/mctabs.js"></script>
7
+ <script type="text/javascript" src="js/color_picker.js"></script>
8
+ </head>
9
+ <body id="colorpicker" style="display: none" role="application" aria-labelledby="app_label">
10
+ <span class="mceVoiceLabel" id="app_label" style="display:none;">{#advanced_dlg.colorpicker_title}</span>
11
+ <form onsubmit="insertAction();return false" action="#">
12
+ <div class="tabs">
13
+ <ul>
14
+ <li id="picker_tab" aria-controls="picker_panel" class="current"><span><a href="javascript:mcTabs.displayTab('picker_tab','picker_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_picker_tab}</a></span></li>
15
+ <li id="rgb_tab" aria-controls="rgb_panel"><span><a href="javascript:;" onclick="mcTabs.displayTab('rgb_tab','rgb_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_palette_tab}</a></span></li>
16
+ <li id="named_tab" aria-controls="named_panel"><span><a href="javascript:;" onclick="javascript:mcTabs.displayTab('named_tab','named_panel');" onmousedown="return false;">{#advanced_dlg.colorpicker_named_tab}</a></span></li>
17
+ </ul>
18
+ </div>
19
+
20
+ <div class="panel_wrapper">
21
+ <div id="picker_panel" class="panel current">
22
+ <fieldset>
23
+ <legend>{#advanced_dlg.colorpicker_picker_title}</legend>
24
+ <div id="picker">
25
+ <img id="colors" src="img/colorpicker.jpg" onclick="computeColor(event)" onmousedown="isMouseDown = true;return false;" onmouseup="isMouseDown = false;" onmousemove="if (isMouseDown && isMouseOver) computeColor(event); return false;" onmouseover="isMouseOver=true;" onmouseout="isMouseOver=false;" alt="" />
26
+
27
+ <div id="light">
28
+ <!-- Will be filled with divs -->
29
+ </div>
30
+
31
+ <br style="clear: both" />
32
+ </div>
33
+ </fieldset>
34
+ </div>
35
+
36
+ <div id="rgb_panel" class="panel">
37
+ <fieldset>
38
+ <legend id="webcolors_title">{#advanced_dlg.colorpicker_palette_title}</legend>
39
+ <div id="webcolors">
40
+ <!-- Gets filled with web safe colors-->
41
+ </div>
42
+
43
+ <br style="clear: both" />
44
+ </fieldset>
45
+ </div>
46
+
47
+ <div id="named_panel" class="panel">
48
+ <fieldset id="named_picker_label">
49
+ <legend id="named_title">{#advanced_dlg.colorpicker_named_title}</legend>
50
+ <div id="namedcolors" role="listbox" tabindex="0" aria-labelledby="named_picker_label">
51
+ <!-- Gets filled with named colors-->
52
+ </div>
53
+
54
+ <br style="clear: both" />
55
+
56
+ <div id="colornamecontainer">
57
+ {#advanced_dlg.colorpicker_name} <span id="colorname"></span>
58
+ </div>
59
+ </fieldset>
60
+ </div>
61
+ </div>
62
+
63
+ <div class="mceActionPanel">
64
+ <input type="submit" id="insert" name="insert" value="{#apply}" />
65
+
66
+ <div id="preview"></div>
67
+
68
+ <div id="previewblock">
69
+ <label for="color">{#advanced_dlg.colorpicker_color}</label> <input id="color" type="text" size="8" class="text mceFocus" aria-required="true" />
70
+ </div>
71
+ </div>
72
+ </form>
73
+ </body>
74
+ </html>
@@ -1,1328 +1,1328 @@
1
- /**
2
- * editor_template_src.js
3
- *
4
- * Copyright 2009, Moxiecode Systems AB
5
- * Released under LGPL License.
6
- *
7
- * License: http://tinymce.moxiecode.com/license
8
- * Contributing: http://tinymce.moxiecode.com/contributing
9
- */
10
-
11
- (function(tinymce) {
12
- var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode;
13
-
14
- // Tell it to load theme specific language pack(s)
15
- tinymce.ThemeManager.requireLangPack('advanced');
16
-
17
- tinymce.create('tinymce.themes.AdvancedTheme', {
18
- sizes : [8, 10, 12, 14, 18, 24, 36],
19
-
20
- // Control name lookup, format: title, command
21
- controls : {
22
- bold : ['bold_desc', 'Bold'],
23
- italic : ['italic_desc', 'Italic'],
24
- underline : ['underline_desc', 'Underline'],
25
- strikethrough : ['striketrough_desc', 'Strikethrough'],
26
- justifyleft : ['justifyleft_desc', 'JustifyLeft'],
27
- justifycenter : ['justifycenter_desc', 'JustifyCenter'],
28
- justifyright : ['justifyright_desc', 'JustifyRight'],
29
- justifyfull : ['justifyfull_desc', 'JustifyFull'],
30
- bullist : ['bullist_desc', 'InsertUnorderedList'],
31
- numlist : ['numlist_desc', 'InsertOrderedList'],
32
- outdent : ['outdent_desc', 'Outdent'],
33
- indent : ['indent_desc', 'Indent'],
34
- cut : ['cut_desc', 'Cut'],
35
- copy : ['copy_desc', 'Copy'],
36
- paste : ['paste_desc', 'Paste'],
37
- undo : ['undo_desc', 'Undo'],
38
- redo : ['redo_desc', 'Redo'],
39
- link : ['link_desc', 'mceLink'],
40
- unlink : ['unlink_desc', 'unlink'],
41
- image : ['image_desc', 'mceImage'],
42
- cleanup : ['cleanup_desc', 'mceCleanup'],
43
- help : ['help_desc', 'mceHelp'],
44
- code : ['code_desc', 'mceCodeEditor'],
45
- hr : ['hr_desc', 'InsertHorizontalRule'],
46
- removeformat : ['removeformat_desc', 'RemoveFormat'],
47
- sub : ['sub_desc', 'subscript'],
48
- sup : ['sup_desc', 'superscript'],
49
- forecolor : ['forecolor_desc', 'ForeColor'],
50
- forecolorpicker : ['forecolor_desc', 'mceForeColor'],
51
- backcolor : ['backcolor_desc', 'HiliteColor'],
52
- backcolorpicker : ['backcolor_desc', 'mceBackColor'],
53
- charmap : ['charmap_desc', 'mceCharMap'],
54
- visualaid : ['visualaid_desc', 'mceToggleVisualAid'],
55
- anchor : ['anchor_desc', 'mceInsertAnchor'],
56
- newdocument : ['newdocument_desc', 'mceNewDocument'],
57
- blockquote : ['blockquote_desc', 'mceBlockQuote']
58
- },
59
-
60
- stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'],
61
-
62
- init : function(ed, url) {
63
- var t = this, s, v, o;
64
-
65
- t.editor = ed;
66
- t.url = url;
67
- t.onResolveName = new tinymce.util.Dispatcher(this);
68
-
69
- ed.forcedHighContrastMode = ed.settings.detect_highcontrast && t._isHighContrast();
70
- ed.settings.skin = ed.forcedHighContrastMode ? 'highcontrast' : ed.settings.skin;
71
-
72
- // Default settings
73
- t.settings = s = extend({
74
- theme_advanced_path : true,
75
- theme_advanced_toolbar_location : 'bottom',
76
- theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",
77
- theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",
78
- theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap",
79
- theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6",
80
- theme_advanced_toolbar_align : "center",
81
- theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
82
- theme_advanced_more_colors : 1,
83
- theme_advanced_row_height : 23,
84
- theme_advanced_resize_horizontal : 1,
85
- theme_advanced_resizing_use_cookie : 1,
86
- theme_advanced_font_sizes : "1,2,3,4,5,6,7",
87
- theme_advanced_font_selector : "span",
88
- readonly : ed.settings.readonly
89
- }, ed.settings);
90
-
91
- // Setup default font_size_style_values
92
- if (!s.font_size_style_values)
93
- s.font_size_style_values = "8pt,10pt,12pt,14pt,18pt,24pt,36pt";
94
-
95
- if (tinymce.is(s.theme_advanced_font_sizes, 'string')) {
96
- s.font_size_style_values = tinymce.explode(s.font_size_style_values);
97
- s.font_size_classes = tinymce.explode(s.font_size_classes || '');
98
-
99
- // Parse string value
100
- o = {};
101
- ed.settings.theme_advanced_font_sizes = s.theme_advanced_font_sizes;
102
- each(ed.getParam('theme_advanced_font_sizes', '', 'hash'), function(v, k) {
103
- var cl;
104
-
105
- if (k == v && v >= 1 && v <= 7) {
106
- k = v + ' (' + t.sizes[v - 1] + 'pt)';
107
- cl = s.font_size_classes[v - 1];
108
- v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt');
109
- }
110
-
111
- if (/^\s*\./.test(v))
112
- cl = v.replace(/\./g, '');
113
-
114
- o[k] = cl ? {'class' : cl} : {fontSize : v};
115
- });
116
-
117
- s.theme_advanced_font_sizes = o;
118
- }
119
-
120
- if ((v = s.theme_advanced_path_location) && v != 'none')
121
- s.theme_advanced_statusbar_location = s.theme_advanced_path_location;
122
-
123
- if (s.theme_advanced_statusbar_location == 'none')
124
- s.theme_advanced_statusbar_location = 0;
125
-
126
- if (ed.settings.content_css !== false)
127
- ed.contentCSS.push(ed.baseURI.toAbsolute(url + "/skins/" + ed.settings.skin + "/content.css"));
128
-
129
- // Init editor
130
- ed.onInit.add(function() {
131
- if (!ed.settings.readonly) {
132
- ed.onNodeChange.add(t._nodeChanged, t);
133
- ed.onKeyUp.add(t._updateUndoStatus, t);
134
- ed.onMouseUp.add(t._updateUndoStatus, t);
135
- ed.dom.bind(ed.dom.getRoot(), 'dragend', function() {
136
- t._updateUndoStatus(ed);
137
- });
138
- }
139
- });
140
-
141
- ed.onSetProgressState.add(function(ed, b, ti) {
142
- var co, id = ed.id, tb;
143
-
144
- if (b) {
145
- t.progressTimer = setTimeout(function() {
146
- co = ed.getContainer();
147
- co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild);
148
- tb = DOM.get(ed.id + '_tbl');
149
-
150
- DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}});
151
- DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}});
152
- }, ti || 0);
153
- } else {
154
- DOM.remove(id + '_blocker');
155
- DOM.remove(id + '_progress');
156
- clearTimeout(t.progressTimer);
157
- }
158
- });
159
-
160
- DOM.loadCSS(s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : url + "/skins/" + ed.settings.skin + "/ui.css");
161
-
162
- if (s.skin_variant)
163
- DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css");
164
- },
165
-
166
- _isHighContrast : function() {
167
- var actualColor, div = DOM.add(DOM.getRoot(), 'div', {'style': 'background-color: rgb(171,239,86);'});
168
-
169
- actualColor = (DOM.getStyle(div, 'background-color', true) + '').toLowerCase().replace(/ /g, '');
170
- DOM.remove(div);
171
-
172
- return actualColor != 'rgb(171,239,86)' && actualColor != '#abef56';
173
- },
174
-
175
- createControl : function(n, cf) {
176
- var cd, c;
177
-
178
- if (c = cf.createControl(n))
179
- return c;
180
-
181
- switch (n) {
182
- case "styleselect":
183
- return this._createStyleSelect();
184
-
185
- case "formatselect":
186
- return this._createBlockFormats();
187
-
188
- case "fontselect":
189
- return this._createFontSelect();
190
-
191
- case "fontsizeselect":
192
- return this._createFontSizeSelect();
193
-
194
- case "forecolor":
195
- return this._createForeColorMenu();
196
-
197
- case "backcolor":
198
- return this._createBackColorMenu();
199
- }
200
-
201
- if ((cd = this.controls[n]))
202
- return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]});
203
- },
204
-
205
- execCommand : function(cmd, ui, val) {
206
- var f = this['_' + cmd];
207
-
208
- if (f) {
209
- f.call(this, ui, val);
210
- return true;
211
- }
212
-
213
- return false;
214
- },
215
-
216
- _importClasses : function(e) {
217
- var ed = this.editor, ctrl = ed.controlManager.get('styleselect');
218
-
219
- if (ctrl.getLength() == 0) {
220
- each(ed.dom.getClasses(), function(o, idx) {
221
- var name = 'style_' + idx;
222
-
223
- ed.formatter.register(name, {
224
- inline : 'span',
225
- attributes : {'class' : o['class']},
226
- selector : '*'
227
- });
228
-
229
- ctrl.add(o['class'], name);
230
- });
231
- }
232
- },
233
-
234
- _createStyleSelect : function(n) {
235
- var t = this, ed = t.editor, ctrlMan = ed.controlManager, ctrl;
236
-
237
- // Setup style select box
238
- ctrl = ctrlMan.createListBox('styleselect', {
239
- title : 'advanced.style_select',
240
- onselect : function(name) {
241
- var matches, formatNames = [];
242
-
243
- each(ctrl.items, function(item) {
244
- formatNames.push(item.value);
245
- });
246
-
247
- ed.focus();
248
- ed.undoManager.add();
249
-
250
- // Toggle off the current format
251
- matches = ed.formatter.matchAll(formatNames);
252
- if (!name || matches[0] == name) {
253
- if (matches[0])
254
- ed.formatter.remove(matches[0]);
255
- } else
256
- ed.formatter.apply(name);
257
-
258
- ed.undoManager.add();
259
- ed.nodeChanged();
260
-
261
- return false; // No auto select
262
- }
263
- });
264
-
265
- // Handle specified format
266
- ed.onInit.add(function() {
267
- var counter = 0, formats = ed.getParam('style_formats');
268
-
269
- if (formats) {
270
- each(formats, function(fmt) {
271
- var name, keys = 0;
272
-
273
- each(fmt, function() {keys++;});
274
-
275
- if (keys > 1) {
276
- name = fmt.name = fmt.name || 'style_' + (counter++);
277
- ed.formatter.register(name, fmt);
278
- ctrl.add(fmt.title, name);
279
- } else
280
- ctrl.add(fmt.title);
281
- });
282
- } else {
283
- each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) {
284
- var name;
285
-
286
- if (val) {
287
- name = 'style_' + (counter++);
288
-
289
- ed.formatter.register(name, {
290
- inline : 'span',
291
- classes : val,
292
- selector : '*'
293
- });
294
-
295
- ctrl.add(t.editor.translate(key), name);
296
- }
297
- });
298
- }
299
- });
300
-
301
- // Auto import classes if the ctrl box is empty
302
- if (ctrl.getLength() == 0) {
303
- ctrl.onPostRender.add(function(ed, n) {
304
- if (!ctrl.NativeListBox) {
305
- Event.add(n.id + '_text', 'focus', t._importClasses, t);
306
- Event.add(n.id + '_text', 'mousedown', t._importClasses, t);
307
- Event.add(n.id + '_open', 'focus', t._importClasses, t);
308
- Event.add(n.id + '_open', 'mousedown', t._importClasses, t);
309
- } else
310
- Event.add(n.id, 'focus', t._importClasses, t);
311
- });
312
- }
313
-
314
- return ctrl;
315
- },
316
-
317
- _createFontSelect : function() {
318
- var c, t = this, ed = t.editor;
319
-
320
- c = ed.controlManager.createListBox('fontselect', {
321
- title : 'advanced.fontdefault',
322
- onselect : function(v) {
323
- var cur = c.items[c.selectedIndex];
324
-
325
- if (!v && cur) {
326
- ed.execCommand('FontName', false, cur.value);
327
- return;
328
- }
329
-
330
- ed.execCommand('FontName', false, v);
331
-
332
- // Fake selection, execCommand will fire a nodeChange and update the selection
333
- c.select(function(sv) {
334
- return v == sv;
335
- });
336
-
337
- return false; // No auto select
338
- }
339
- });
340
-
341
- if (c) {
342
- each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) {
343
- c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''});
344
- });
345
- }
346
-
347
- return c;
348
- },
349
-
350
- _createFontSizeSelect : function() {
351
- var t = this, ed = t.editor, c, i = 0, cl = [];
352
-
353
- c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {
354
- var cur = c.items[c.selectedIndex];
355
-
356
- if (!v && cur) {
357
- cur = cur.value;
358
-
359
- if (cur['class']) {
360
- ed.formatter.toggle('fontsize_class', {value : cur['class']});
361
- ed.undoManager.add();
362
- ed.nodeChanged();
363
- } else {
364
- ed.execCommand('FontSize', false, cur.fontSize);
365
- }
366
-
367
- return;
368
- }
369
-
370
- if (v['class']) {
371
- ed.focus();
372
- ed.undoManager.add();
373
- ed.formatter.toggle('fontsize_class', {value : v['class']});
374
- ed.undoManager.add();
375
- ed.nodeChanged();
376
- } else
377
- ed.execCommand('FontSize', false, v.fontSize);
378
-
379
- // Fake selection, execCommand will fire a nodeChange and update the selection
380
- c.select(function(sv) {
381
- return v == sv;
382
- });
383
-
384
- return false; // No auto select
385
- }});
386
-
387
- if (c) {
388
- each(t.settings.theme_advanced_font_sizes, function(v, k) {
389
- var fz = v.fontSize;
390
-
391
- if (fz >= 1 && fz <= 7)
392
- fz = t.sizes[parseInt(fz) - 1] + 'pt';
393
-
394
- c.add(k, v, {'style' : 'font-size:' + fz, 'class' : 'mceFontSize' + (i++) + (' ' + (v['class'] || ''))});
395
- });
396
- }
397
-
398
- return c;
399
- },
400
-
401
- _createBlockFormats : function() {
402
- var c, fmts = {
403
- p : 'advanced.paragraph',
404
- address : 'advanced.address',
405
- pre : 'advanced.pre',
406
- h1 : 'advanced.h1',
407
- h2 : 'advanced.h2',
408
- h3 : 'advanced.h3',
409
- h4 : 'advanced.h4',
410
- h5 : 'advanced.h5',
411
- h6 : 'advanced.h6',
412
- div : 'advanced.div',
413
- blockquote : 'advanced.blockquote',
414
- code : 'advanced.code',
415
- dt : 'advanced.dt',
416
- dd : 'advanced.dd',
417
- samp : 'advanced.samp'
418
- }, t = this;
419
-
420
- c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', cmd : 'FormatBlock'});
421
- if (c) {
422
- each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) {
423
- c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v});
424
- });
425
- }
426
-
427
- return c;
428
- },
429
-
430
- _createForeColorMenu : function() {
431
- var c, t = this, s = t.settings, o = {}, v;
432
-
433
- if (s.theme_advanced_more_colors) {
434
- o.more_colors_func = function() {
435
- t._mceColorPicker(0, {
436
- color : c.value,
437
- func : function(co) {
438
- c.setColor(co);
439
- }
440
- });
441
- };
442
- }
443
-
444
- if (v = s.theme_advanced_text_colors)
445
- o.colors = v;
446
-
447
- if (s.theme_advanced_default_foreground_color)
448
- o.default_color = s.theme_advanced_default_foreground_color;
449
-
450
- o.title = 'advanced.forecolor_desc';
451
- o.cmd = 'ForeColor';
452
- o.scope = this;
453
-
454
- c = t.editor.controlManager.createColorSplitButton('forecolor', o);
455
-
456
- return c;
457
- },
458
-
459
- _createBackColorMenu : function() {
460
- var c, t = this, s = t.settings, o = {}, v;
461
-
462
- if (s.theme_advanced_more_colors) {
463
- o.more_colors_func = function() {
464
- t._mceColorPicker(0, {
465
- color : c.value,
466
- func : function(co) {
467
- c.setColor(co);
468
- }
469
- });
470
- };
471
- }
472
-
473
- if (v = s.theme_advanced_background_colors)
474
- o.colors = v;
475
-
476
- if (s.theme_advanced_default_background_color)
477
- o.default_color = s.theme_advanced_default_background_color;
478
-
479
- o.title = 'advanced.backcolor_desc';
480
- o.cmd = 'HiliteColor';
481
- o.scope = this;
482
-
483
- c = t.editor.controlManager.createColorSplitButton('backcolor', o);
484
-
485
- return c;
486
- },
487
-
488
- renderUI : function(o) {
489
- var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl;
490
-
491
- if (ed.settings) {
492
- ed.settings.aria_label = s.aria_label + ed.getLang('advanced.help_shortcut');
493
- }
494
-
495
- // TODO: ACC Should have an aria-describedby attribute which is user-configurable to describe what this field is actually for.
496
- // Maybe actually inherit it from the original textara?
497
- n = p = DOM.create('span', {role : 'application', 'aria-labelledby' : ed.id + '_voice', id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')});
498
- DOM.add(n, 'span', {'class': 'mceVoiceLabel', 'style': 'display:none;', id: ed.id + '_voice'}, s.aria_label);
499
-
500
- if (!DOM.boxModel)
501
- n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'});
502
-
503
- n = sc = DOM.add(n, 'table', {role : "presentation", id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0});
504
- n = tb = DOM.add(n, 'tbody');
505
-
506
- switch ((s.theme_advanced_layout_manager || '').toLowerCase()) {
507
- case "rowlayout":
508
- ic = t._rowLayout(s, tb, o);
509
- break;
510
-
511
- case "customlayout":
512
- ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p);
513
- break;
514
-
515
- default:
516
- ic = t._simpleLayout(s, tb, o, p);
517
- }
518
-
519
- n = o.targetNode;
520
-
521
- // Add classes to first and last TRs
522
- nl = sc.rows;
523
- DOM.addClass(nl[0], 'mceFirst');
524
- DOM.addClass(nl[nl.length - 1], 'mceLast');
525
-
526
- // Add classes to first and last TDs
527
- each(DOM.select('tr', tb), function(n) {
528
- DOM.addClass(n.firstChild, 'mceFirst');
529
- DOM.addClass(n.childNodes[n.childNodes.length - 1], 'mceLast');
530
- });
531
-
532
- if (DOM.get(s.theme_advanced_toolbar_container))
533
- DOM.get(s.theme_advanced_toolbar_container).appendChild(p);
534
- else
535
- DOM.insertAfter(p, n);
536
-
537
- Event.add(ed.id + '_path_row', 'click', function(e) {
538
- e = e.target;
539
-
540
- if (e.nodeName == 'A') {
541
- t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1'));
542
-
543
- return Event.cancel(e);
544
- }
545
- });
546
- /*
547
- if (DOM.get(ed.id + '_path_row')) {
548
- Event.add(ed.id + '_tbl', 'mouseover', function(e) {
549
- var re;
550
-
551
- e = e.target;
552
-
553
- if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) {
554
- re = DOM.get(ed.id + '_path_row');
555
- t.lastPath = re.innerHTML;
556
- DOM.setHTML(re, e.parentNode.title);
557
- }
558
- });
559
-
560
- Event.add(ed.id + '_tbl', 'mouseout', function(e) {
561
- if (t.lastPath) {
562
- DOM.setHTML(ed.id + '_path_row', t.lastPath);
563
- t.lastPath = 0;
564
- }
565
- });
566
- }
567
- */
568
-
569
- if (!ed.getParam('accessibility_focus'))
570
- Event.add(DOM.add(p, 'a', {href : '#'}, '<!-- IE -->'), 'focus', function() {tinyMCE.get(ed.id).focus();});
571
-
572
- if (s.theme_advanced_toolbar_location == 'external')
573
- o.deltaHeight = 0;
574
-
575
- t.deltaHeight = o.deltaHeight;
576
- o.targetNode = null;
577
-
578
- ed.onKeyDown.add(function(ed, evt) {
579
- var DOM_VK_F10 = 121, DOM_VK_F11 = 122;
580
-
581
- if (evt.altKey) {
582
- if (evt.keyCode === DOM_VK_F10) {
583
- t.toolbarGroup.focus();
584
- return Event.cancel(evt);
585
- } else if (evt.keyCode === DOM_VK_F11) {
586
- DOM.get(ed.id + '_path_row').focus();
587
- return Event.cancel(evt);
588
- }
589
- }
590
- });
591
-
592
- // alt+0 is the UK recommended shortcut for accessing the list of access controls.
593
- ed.addShortcut('alt+0', '', 'mceShortcuts', t);
594
-
595
- return {
596
- iframeContainer : ic,
597
- editorContainer : ed.id + '_parent',
598
- sizeContainer : sc,
599
- deltaHeight : o.deltaHeight
600
- };
601
- },
602
-
603
- getInfo : function() {
604
- return {
605
- longname : 'Advanced theme',
606
- author : 'Moxiecode Systems AB',
607
- authorurl : 'http://tinymce.moxiecode.com',
608
- version : tinymce.majorVersion + "." + tinymce.minorVersion
609
- }
610
- },
611
-
612
- resizeBy : function(dw, dh) {
613
- var e = DOM.get(this.editor.id + '_ifr');
614
-
615
- this.resizeTo(e.clientWidth + dw, e.clientHeight + dh);
616
- },
617
-
618
- resizeTo : function(w, h, store) {
619
- var ed = this.editor, s = this.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr');
620
-
621
- // Boundery fix box
622
- w = Math.max(s.theme_advanced_resizing_min_width || 100, w);
623
- h = Math.max(s.theme_advanced_resizing_min_height || 100, h);
624
- w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w);
625
- h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h);
626
-
627
- // Resize iframe and container
628
- DOM.setStyle(e, 'height', '');
629
- DOM.setStyle(ifr, 'height', h);
630
-
631
- if (s.theme_advanced_resize_horizontal) {
632
- DOM.setStyle(e, 'width', '');
633
- DOM.setStyle(ifr, 'width', w);
634
-
635
- // Make sure that the size is never smaller than the over all ui
636
- if (w < e.clientWidth) {
637
- w = e.clientWidth;
638
- DOM.setStyle(ifr, 'width', e.clientWidth);
639
- }
640
- }
641
-
642
- // Store away the size
643
- if (store && s.theme_advanced_resizing_use_cookie) {
644
- Cookie.setHash("TinyMCE_" + ed.id + "_size", {
645
- cw : w,
646
- ch : h
647
- });
648
- }
649
- },
650
-
651
- destroy : function() {
652
- var id = this.editor.id;
653
-
654
- Event.clear(id + '_resize');
655
- Event.clear(id + '_path_row');
656
- Event.clear(id + '_external_close');
657
- },
658
-
659
- // Internal functions
660
-
661
- _simpleLayout : function(s, tb, o, p) {
662
- var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c;
663
-
664
- if (s.readonly) {
665
- n = DOM.add(tb, 'tr');
666
- n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
667
- return ic;
668
- }
669
-
670
- // Create toolbar container at top
671
- if (lo == 'top')
672
- t._addToolbars(tb, o);
673
-
674
- // Create external toolbar
675
- if (lo == 'external') {
676
- n = c = DOM.create('div', {style : 'position:relative'});
677
- n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'});
678
- DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'});
679
- n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0});
680
- etb = DOM.add(n, 'tbody');
681
-
682
- if (p.firstChild.className == 'mceOldBoxModel')
683
- p.firstChild.appendChild(c);
684
- else
685
- p.insertBefore(c, p.firstChild);
686
-
687
- t._addToolbars(etb, o);
688
-
689
- ed.onMouseUp.add(function() {
690
- var e = DOM.get(ed.id + '_external');
691
- DOM.show(e);
692
-
693
- DOM.hide(lastExtID);
694
-
695
- var f = Event.add(ed.id + '_external_close', 'click', function() {
696
- DOM.hide(ed.id + '_external');
697
- Event.remove(ed.id + '_external_close', 'click', f);
698
- });
699
-
700
- DOM.show(e);
701
- DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1);
702
-
703
- // Fixes IE rendering bug
704
- DOM.hide(e);
705
- DOM.show(e);
706
- e.style.filter = '';
707
-
708
- lastExtID = ed.id + '_external';
709
-
710
- e = null;
711
- });
712
- }
713
-
714
- if (sl == 'top')
715
- t._addStatusBar(tb, o);
716
-
717
- // Create iframe container
718
- if (!s.theme_advanced_toolbar_container) {
719
- n = DOM.add(tb, 'tr');
720
- n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
721
- }
722
-
723
- // Create toolbar container at bottom
724
- if (lo == 'bottom')
725
- t._addToolbars(tb, o);
726
-
727
- if (sl == 'bottom')
728
- t._addStatusBar(tb, o);
729
-
730
- return ic;
731
- },
732
-
733
- _rowLayout : function(s, tb, o) {
734
- var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a;
735
-
736
- dc = s.theme_advanced_containers_default_class || '';
737
- da = s.theme_advanced_containers_default_align || 'center';
738
-
739
- each(explode(s.theme_advanced_containers || ''), function(c, i) {
740
- var v = s['theme_advanced_container_' + c] || '';
741
-
742
- switch (v.toLowerCase()) {
743
- case 'mceeditor':
744
- n = DOM.add(tb, 'tr');
745
- n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
746
- break;
747
-
748
- case 'mceelementpath':
749
- t._addStatusBar(tb, o);
750
- break;
751
-
752
- default:
753
- a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase();
754
- a = 'mce' + t._ufirst(a);
755
-
756
- n = DOM.add(DOM.add(tb, 'tr'), 'td', {
757
- 'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc) + ' ' + a || da
758
- });
759
-
760
- to = cf.createToolbar("toolbar" + i);
761
- t._addControls(v, to);
762
- DOM.setHTML(n, to.renderHTML());
763
- o.deltaHeight -= s.theme_advanced_row_height;
764
- }
765
- });
766
-
767
- return ic;
768
- },
769
-
770
- _addControls : function(v, tb) {
771
- var t = this, s = t.settings, di, cf = t.editor.controlManager;
772
-
773
- if (s.theme_advanced_disable && !t._disabled) {
774
- di = {};
775
-
776
- each(explode(s.theme_advanced_disable), function(v) {
777
- di[v] = 1;
778
- });
779
-
780
- t._disabled = di;
781
- } else
782
- di = t._disabled;
783
-
784
- each(explode(v), function(n) {
785
- var c;
786
-
787
- if (di && di[n])
788
- return;
789
-
790
- // Compatiblity with 2.x
791
- if (n == 'tablecontrols') {
792
- each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) {
793
- n = t.createControl(n, cf);
794
-
795
- if (n)
796
- tb.add(n);
797
- });
798
-
799
- return;
800
- }
801
-
802
- c = t.createControl(n, cf);
803
-
804
- if (c)
805
- tb.add(c);
806
- });
807
- },
808
-
809
- _addToolbars : function(c, o) {
810
- var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a, toolbarGroup;
811
-
812
- toolbarGroup = cf.createToolbarGroup('toolbargroup', {
813
- 'name': ed.getLang('advanced.toolbar'),
814
- 'tab_focus_toolbar':ed.getParam('theme_advanced_tab_focus_toolbar')
815
- });
816
-
817
- t.toolbarGroup = toolbarGroup;
818
-
819
- a = s.theme_advanced_toolbar_align.toLowerCase();
820
- a = 'mce' + t._ufirst(a);
821
-
822
- n = DOM.add(DOM.add(c, 'tr', {role: 'presentation'}), 'td', {'class' : 'mceToolbar ' + a, "role":"presentation"});
823
-
824
- // Create toolbar and add the controls
825
- for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
826
- tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i});
827
-
828
- if (s['theme_advanced_buttons' + i + '_add'])
829
- v += ',' + s['theme_advanced_buttons' + i + '_add'];
830
-
831
- if (s['theme_advanced_buttons' + i + '_add_before'])
832
- v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v;
833
-
834
- t._addControls(v, tb);
835
- toolbarGroup.add(tb);
836
-
837
- o.deltaHeight -= s.theme_advanced_row_height;
838
- }
839
- h.push(toolbarGroup.renderHTML());
840
- h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
841
- DOM.setHTML(n, h.join(''));
842
- },
843
-
844
- _addStatusBar : function(tb, o) {
845
- var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
846
-
847
- n = DOM.add(tb, 'tr');
848
- n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'});
849
- n = DOM.add(n, 'div', {id : ed.id + '_path_row', 'role': 'group', 'aria-labelledby': ed.id + '_path_voice'});
850
- if (s.theme_advanced_path) {
851
- DOM.add(n, 'span', {id: ed.id + '_path_voice'}, ed.translate('advanced.path'));
852
- DOM.add(n, 'span', {}, ': ');
853
- } else {
854
- DOM.add(n, 'span', {}, '&#160;');
855
- }
856
-
857
-
858
- if (s.theme_advanced_resizing) {
859
- DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize'});
860
-
861
- if (s.theme_advanced_resizing_use_cookie) {
862
- ed.onPostRender.add(function() {
863
- var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl');
864
-
865
- if (!o)
866
- return;
867
-
868
- t.resizeTo(o.cw, o.ch);
869
- });
870
- }
871
-
872
- ed.onPostRender.add(function() {
873
- Event.add(ed.id + '_resize', 'click', function(e) {
874
- e.preventDefault();
875
- });
876
-
877
- Event.add(ed.id + '_resize', 'mousedown', function(e) {
878
- var mouseMoveHandler1, mouseMoveHandler2,
879
- mouseUpHandler1, mouseUpHandler2,
880
- startX, startY, startWidth, startHeight, width, height, ifrElm;
881
-
882
- function resizeOnMove(e) {
883
- e.preventDefault();
884
-
885
- width = startWidth + (e.screenX - startX);
886
- height = startHeight + (e.screenY - startY);
887
-
888
- t.resizeTo(width, height);
889
- };
890
-
891
- function endResize(e) {
892
- // Stop listening
893
- Event.remove(DOM.doc, 'mousemove', mouseMoveHandler1);
894
- Event.remove(ed.getDoc(), 'mousemove', mouseMoveHandler2);
895
- Event.remove(DOM.doc, 'mouseup', mouseUpHandler1);
896
- Event.remove(ed.getDoc(), 'mouseup', mouseUpHandler2);
897
-
898
- width = startWidth + (e.screenX - startX);
899
- height = startHeight + (e.screenY - startY);
900
- t.resizeTo(width, height, true);
901
- };
902
-
903
- e.preventDefault();
904
-
905
- // Get the current rect size
906
- startX = e.screenX;
907
- startY = e.screenY;
908
- ifrElm = DOM.get(t.editor.id + '_ifr');
909
- startWidth = width = ifrElm.clientWidth;
910
- startHeight = height = ifrElm.clientHeight;
911
-
912
- // Register envent handlers
913
- mouseMoveHandler1 = Event.add(DOM.doc, 'mousemove', resizeOnMove);
914
- mouseMoveHandler2 = Event.add(ed.getDoc(), 'mousemove', resizeOnMove);
915
- mouseUpHandler1 = Event.add(DOM.doc, 'mouseup', endResize);
916
- mouseUpHandler2 = Event.add(ed.getDoc(), 'mouseup', endResize);
917
- });
918
- });
919
- }
920
-
921
- o.deltaHeight -= 21;
922
- n = tb = null;
923
- },
924
-
925
- _updateUndoStatus : function(ed) {
926
- var cm = ed.controlManager;
927
-
928
- cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);
929
- cm.setDisabled('redo', !ed.undoManager.hasRedo());
930
- },
931
-
932
- _nodeChanged : function(ed, cm, n, co, ob) {
933
- var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, formatNames, matches;
934
-
935
- tinymce.each(t.stateControls, function(c) {
936
- cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
937
- });
938
-
939
- function getParent(name) {
940
- var i, parents = ob.parents, func = name;
941
-
942
- if (typeof(name) == 'string') {
943
- func = function(node) {
944
- return node.nodeName == name;
945
- };
946
- }
947
-
948
- for (i = 0; i < parents.length; i++) {
949
- if (func(parents[i]))
950
- return parents[i];
951
- }
952
- };
953
-
954
- cm.setActive('visualaid', ed.hasVisual);
955
- cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);
956
- cm.setDisabled('redo', !ed.undoManager.hasRedo());
957
- cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));
958
-
959
- p = getParent('A');
960
- if (c = cm.get('link')) {
961
- if (!p || !p.name) {
962
- c.setDisabled(!p && co);
963
- c.setActive(!!p);
964
- }
965
- }
966
-
967
- if (c = cm.get('unlink')) {
968
- c.setDisabled(!p && co);
969
- c.setActive(!!p && !p.name);
970
- }
971
-
972
- if (c = cm.get('anchor')) {
973
- c.setActive(!co && !!p && p.name);
974
- }
975
-
976
- p = getParent('IMG');
977
- if (c = cm.get('image'))
978
- c.setActive(!co && !!p && n.className.indexOf('mceItem') == -1);
979
-
980
- if (c = cm.get('styleselect')) {
981
- t._importClasses();
982
-
983
- formatNames = [];
984
- each(c.items, function(item) {
985
- formatNames.push(item.value);
986
- });
987
-
988
- matches = ed.formatter.matchAll(formatNames);
989
- c.select(matches[0]);
990
- }
991
-
992
- if (c = cm.get('formatselect')) {
993
- p = getParent(DOM.isBlock);
994
-
995
- if (p)
996
- c.select(p.nodeName.toLowerCase());
997
- }
998
-
999
- // Find out current fontSize, fontFamily and fontClass
1000
- getParent(function(n) {
1001
- if (n.nodeName === 'SPAN') {
1002
- if (!cl && n.className)
1003
- cl = n.className;
1004
- }
1005
-
1006
- if (ed.dom.is(n, s.theme_advanced_font_selector)) {
1007
- if (!fz && n.style.fontSize)
1008
- fz = n.style.fontSize;
1009
-
1010
- if (!fn && n.style.fontFamily)
1011
- fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();
1012
- }
1013
-
1014
- return false;
1015
- });
1016
-
1017
- if (c = cm.get('fontselect')) {
1018
- c.select(function(v) {
1019
- return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn;
1020
- });
1021
- }
1022
-
1023
- // Select font size
1024
- if (c = cm.get('fontsizeselect')) {
1025
- // Use computed style
1026
- if (s.theme_advanced_runtime_fontsize && !fz && !cl)
1027
- fz = ed.dom.getStyle(n, 'fontSize', true);
1028
-
1029
- c.select(function(v) {
1030
- if (v.fontSize && v.fontSize === fz)
1031
- return true;
1032
-
1033
- if (v['class'] && v['class'] === cl)
1034
- return true;
1035
- });
1036
- }
1037
-
1038
- if (s.theme_advanced_show_current_color) {
1039
- function updateColor(controlId, color) {
1040
- if (c = cm.get(controlId)) {
1041
- if (!color)
1042
- color = c.settings.default_color;
1043
- if (color !== c.value) {
1044
- c.displayColor(color);
1045
- }
1046
- }
1047
- };
1048
-
1049
- updateColor('forecolor', fc);
1050
- updateColor('backcolor', bc);
1051
- }
1052
-
1053
- if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {
1054
- p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});
1055
-
1056
- if (t.statusKeyboardNavigation) {
1057
- t.statusKeyboardNavigation.destroy();
1058
- t.statusKeyboardNavigation = null;
1059
- }
1060
-
1061
- DOM.setHTML(p, '');
1062
-
1063
- getParent(function(n) {
1064
- var na = n.nodeName.toLowerCase(), u, pi, ti = '';
1065
-
1066
- if (n.getAttribute('data-mce-bogus'))
1067
- return;
1068
-
1069
- // Ignore non element and hidden elements
1070
- if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')))
1071
- return;
1072
-
1073
- // Handle prefix
1074
- if (tinymce.isIE && n.scopeName !== 'HTML')
1075
- na = n.scopeName + ':' + na;
1076
-
1077
- // Remove internal prefix
1078
- na = na.replace(/mce\:/g, '');
1079
-
1080
- // Handle node name
1081
- switch (na) {
1082
- case 'b':
1083
- na = 'strong';
1084
- break;
1085
-
1086
- case 'i':
1087
- na = 'em';
1088
- break;
1089
-
1090
- case 'img':
1091
- if (v = DOM.getAttrib(n, 'src'))
1092
- ti += 'src: ' + v + ' ';
1093
-
1094
- break;
1095
-
1096
- case 'a':
1097
- if (v = DOM.getAttrib(n, 'name')) {
1098
- ti += 'name: ' + v + ' ';
1099
- na += '#' + v;
1100
- }
1101
-
1102
- if (v = DOM.getAttrib(n, 'href'))
1103
- ti += 'href: ' + v + ' ';
1104
-
1105
- break;
1106
-
1107
- case 'font':
1108
- if (v = DOM.getAttrib(n, 'face'))
1109
- ti += 'font: ' + v + ' ';
1110
-
1111
- if (v = DOM.getAttrib(n, 'size'))
1112
- ti += 'size: ' + v + ' ';
1113
-
1114
- if (v = DOM.getAttrib(n, 'color'))
1115
- ti += 'color: ' + v + ' ';
1116
-
1117
- break;
1118
-
1119
- case 'span':
1120
- if (v = DOM.getAttrib(n, 'style'))
1121
- ti += 'style: ' + v + ' ';
1122
-
1123
- break;
1124
- }
1125
-
1126
- if (v = DOM.getAttrib(n, 'id'))
1127
- ti += 'id: ' + v + ' ';
1128
-
1129
- if (v = n.className) {
1130
- v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '')
1131
-
1132
- if (v) {
1133
- ti += 'class: ' + v + ' ';
1134
-
1135
- if (DOM.isBlock(n) || na == 'img' || na == 'span')
1136
- na += '.' + v;
1137
- }
1138
- }
1139
-
1140
- na = na.replace(/(html:)/g, '');
1141
- na = {name : na, node : n, title : ti};
1142
- t.onResolveName.dispatch(t, na);
1143
- ti = na.title;
1144
- na = na.name;
1145
-
1146
- //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');";
1147
- pi = DOM.create('a', {'href' : "javascript:;", role: 'button', onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na);
1148
-
1149
- if (p.hasChildNodes()) {
1150
- p.insertBefore(DOM.create('span', {'aria-hidden': 'true'}, '\u00a0\u00bb '), p.firstChild);
1151
- p.insertBefore(pi, p.firstChild);
1152
- } else
1153
- p.appendChild(pi);
1154
- }, ed.getBody());
1155
-
1156
- if (DOM.select('a', p).length > 0) {
1157
- t.statusKeyboardNavigation = new tinymce.ui.KeyboardNavigation({
1158
- root: ed.id + "_path_row",
1159
- items: DOM.select('a', p),
1160
- excludeFromTabOrder: true,
1161
- onCancel: function() {
1162
- ed.focus();
1163
- }
1164
- }, DOM);
1165
- }
1166
- }
1167
- },
1168
-
1169
- // Commands gets called by execCommand
1170
-
1171
- _sel : function(v) {
1172
- this.editor.execCommand('mceSelectNodeDepth', false, v);
1173
- },
1174
-
1175
- _mceInsertAnchor : function(ui, v) {
1176
- var ed = this.editor;
1177
-
1178
- ed.windowManager.open({
1179
- url : this.url + '/anchor.htm',
1180
- width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)),
1181
- height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)),
1182
- inline : true
1183
- }, {
1184
- theme_url : this.url
1185
- });
1186
- },
1187
-
1188
- _mceCharMap : function() {
1189
- var ed = this.editor;
1190
-
1191
- ed.windowManager.open({
1192
- url : this.url + '/charmap.htm',
1193
- width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),
1194
- height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),
1195
- inline : true
1196
- }, {
1197
- theme_url : this.url
1198
- });
1199
- },
1200
-
1201
- _mceHelp : function() {
1202
- var ed = this.editor;
1203
-
1204
- ed.windowManager.open({
1205
- url : this.url + '/about.htm',
1206
- width : 480,
1207
- height : 380,
1208
- inline : true
1209
- }, {
1210
- theme_url : this.url
1211
- });
1212
- },
1213
-
1214
- _mceShortcuts : function() {
1215
- var ed = this.editor;
1216
- ed.windowManager.open({
1217
- url: this.url + '/shortcuts.htm',
1218
- width: 480,
1219
- height: 380,
1220
- inline: true
1221
- }, {
1222
- theme_url: this.url
1223
- });
1224
- },
1225
-
1226
- _mceColorPicker : function(u, v) {
1227
- var ed = this.editor;
1228
-
1229
- v = v || {};
1230
-
1231
- ed.windowManager.open({
1232
- url : this.url + '/color_picker.htm',
1233
- width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)),
1234
- height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)),
1235
- close_previous : false,
1236
- inline : true
1237
- }, {
1238
- input_color : v.color,
1239
- func : v.func,
1240
- theme_url : this.url
1241
- });
1242
- },
1243
-
1244
- _mceCodeEditor : function(ui, val) {
1245
- var ed = this.editor;
1246
-
1247
- ed.windowManager.open({
1248
- url : this.url + '/source_editor.htm',
1249
- width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)),
1250
- height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)),
1251
- inline : true,
1252
- resizable : true,
1253
- maximizable : true
1254
- }, {
1255
- theme_url : this.url
1256
- });
1257
- },
1258
-
1259
- _mceImage : function(ui, val) {
1260
- var ed = this.editor;
1261
-
1262
- // Internal image object like a flash placeholder
1263
- if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)
1264
- return;
1265
-
1266
- ed.windowManager.open({
1267
- url : this.url + '/image.htm',
1268
- width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)),
1269
- height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)),
1270
- inline : true
1271
- }, {
1272
- theme_url : this.url
1273
- });
1274
- },
1275
-
1276
- _mceLink : function(ui, val) {
1277
- var ed = this.editor;
1278
-
1279
- ed.windowManager.open({
1280
- url : this.url + '/link.htm',
1281
- width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)),
1282
- height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)),
1283
- inline : true
1284
- }, {
1285
- theme_url : this.url
1286
- });
1287
- },
1288
-
1289
- _mceNewDocument : function() {
1290
- var ed = this.editor;
1291
-
1292
- ed.windowManager.confirm('advanced.newdocument', function(s) {
1293
- if (s)
1294
- ed.execCommand('mceSetContent', false, '');
1295
- });
1296
- },
1297
-
1298
- _mceForeColor : function() {
1299
- var t = this;
1300
-
1301
- this._mceColorPicker(0, {
1302
- color: t.fgColor,
1303
- func : function(co) {
1304
- t.fgColor = co;
1305
- t.editor.execCommand('ForeColor', false, co);
1306
- }
1307
- });
1308
- },
1309
-
1310
- _mceBackColor : function() {
1311
- var t = this;
1312
-
1313
- this._mceColorPicker(0, {
1314
- color: t.bgColor,
1315
- func : function(co) {
1316
- t.bgColor = co;
1317
- t.editor.execCommand('HiliteColor', false, co);
1318
- }
1319
- });
1320
- },
1321
-
1322
- _ufirst : function(s) {
1323
- return s.substring(0, 1).toUpperCase() + s.substring(1);
1324
- }
1325
- });
1326
-
1327
- tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme);
1328
- }(tinymce));
1
+ /**
2
+ * editor_template_src.js
3
+ *
4
+ * Copyright 2009, Moxiecode Systems AB
5
+ * Released under LGPL License.
6
+ *
7
+ * License: http://tinymce.moxiecode.com/license
8
+ * Contributing: http://tinymce.moxiecode.com/contributing
9
+ */
10
+
11
+ (function(tinymce) {
12
+ var DOM = tinymce.DOM, Event = tinymce.dom.Event, extend = tinymce.extend, each = tinymce.each, Cookie = tinymce.util.Cookie, lastExtID, explode = tinymce.explode;
13
+
14
+ // Tell it to load theme specific language pack(s)
15
+ tinymce.ThemeManager.requireLangPack('advanced');
16
+
17
+ tinymce.create('tinymce.themes.AdvancedTheme', {
18
+ sizes : [8, 10, 12, 14, 18, 24, 36],
19
+
20
+ // Control name lookup, format: title, command
21
+ controls : {
22
+ bold : ['bold_desc', 'Bold'],
23
+ italic : ['italic_desc', 'Italic'],
24
+ underline : ['underline_desc', 'Underline'],
25
+ strikethrough : ['striketrough_desc', 'Strikethrough'],
26
+ justifyleft : ['justifyleft_desc', 'JustifyLeft'],
27
+ justifycenter : ['justifycenter_desc', 'JustifyCenter'],
28
+ justifyright : ['justifyright_desc', 'JustifyRight'],
29
+ justifyfull : ['justifyfull_desc', 'JustifyFull'],
30
+ bullist : ['bullist_desc', 'InsertUnorderedList'],
31
+ numlist : ['numlist_desc', 'InsertOrderedList'],
32
+ outdent : ['outdent_desc', 'Outdent'],
33
+ indent : ['indent_desc', 'Indent'],
34
+ cut : ['cut_desc', 'Cut'],
35
+ copy : ['copy_desc', 'Copy'],
36
+ paste : ['paste_desc', 'Paste'],
37
+ undo : ['undo_desc', 'Undo'],
38
+ redo : ['redo_desc', 'Redo'],
39
+ link : ['link_desc', 'mceLink'],
40
+ unlink : ['unlink_desc', 'unlink'],
41
+ image : ['image_desc', 'mceImage'],
42
+ cleanup : ['cleanup_desc', 'mceCleanup'],
43
+ help : ['help_desc', 'mceHelp'],
44
+ code : ['code_desc', 'mceCodeEditor'],
45
+ hr : ['hr_desc', 'InsertHorizontalRule'],
46
+ removeformat : ['removeformat_desc', 'RemoveFormat'],
47
+ sub : ['sub_desc', 'subscript'],
48
+ sup : ['sup_desc', 'superscript'],
49
+ forecolor : ['forecolor_desc', 'ForeColor'],
50
+ forecolorpicker : ['forecolor_desc', 'mceForeColor'],
51
+ backcolor : ['backcolor_desc', 'HiliteColor'],
52
+ backcolorpicker : ['backcolor_desc', 'mceBackColor'],
53
+ charmap : ['charmap_desc', 'mceCharMap'],
54
+ visualaid : ['visualaid_desc', 'mceToggleVisualAid'],
55
+ anchor : ['anchor_desc', 'mceInsertAnchor'],
56
+ newdocument : ['newdocument_desc', 'mceNewDocument'],
57
+ blockquote : ['blockquote_desc', 'mceBlockQuote']
58
+ },
59
+
60
+ stateControls : ['bold', 'italic', 'underline', 'strikethrough', 'bullist', 'numlist', 'justifyleft', 'justifycenter', 'justifyright', 'justifyfull', 'sub', 'sup', 'blockquote'],
61
+
62
+ init : function(ed, url) {
63
+ var t = this, s, v, o;
64
+
65
+ t.editor = ed;
66
+ t.url = url;
67
+ t.onResolveName = new tinymce.util.Dispatcher(this);
68
+
69
+ ed.forcedHighContrastMode = ed.settings.detect_highcontrast && t._isHighContrast();
70
+ ed.settings.skin = ed.forcedHighContrastMode ? 'highcontrast' : ed.settings.skin;
71
+
72
+ // Default settings
73
+ t.settings = s = extend({
74
+ theme_advanced_path : true,
75
+ theme_advanced_toolbar_location : 'bottom',
76
+ theme_advanced_buttons1 : "bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect",
77
+ theme_advanced_buttons2 : "bullist,numlist,|,outdent,indent,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code",
78
+ theme_advanced_buttons3 : "hr,removeformat,visualaid,|,sub,sup,|,charmap",
79
+ theme_advanced_blockformats : "p,address,pre,h1,h2,h3,h4,h5,h6",
80
+ theme_advanced_toolbar_align : "center",
81
+ theme_advanced_fonts : "Andale Mono=andale mono,times;Arial=arial,helvetica,sans-serif;Arial Black=arial black,avant garde;Book Antiqua=book antiqua,palatino;Comic Sans MS=comic sans ms,sans-serif;Courier New=courier new,courier;Georgia=georgia,palatino;Helvetica=helvetica;Impact=impact,chicago;Symbol=symbol;Tahoma=tahoma,arial,helvetica,sans-serif;Terminal=terminal,monaco;Times New Roman=times new roman,times;Trebuchet MS=trebuchet ms,geneva;Verdana=verdana,geneva;Webdings=webdings;Wingdings=wingdings,zapf dingbats",
82
+ theme_advanced_more_colors : 1,
83
+ theme_advanced_row_height : 23,
84
+ theme_advanced_resize_horizontal : 1,
85
+ theme_advanced_resizing_use_cookie : 1,
86
+ theme_advanced_font_sizes : "1,2,3,4,5,6,7",
87
+ theme_advanced_font_selector : "span",
88
+ readonly : ed.settings.readonly
89
+ }, ed.settings);
90
+
91
+ // Setup default font_size_style_values
92
+ if (!s.font_size_style_values)
93
+ s.font_size_style_values = "8pt,10pt,12pt,14pt,18pt,24pt,36pt";
94
+
95
+ if (tinymce.is(s.theme_advanced_font_sizes, 'string')) {
96
+ s.font_size_style_values = tinymce.explode(s.font_size_style_values);
97
+ s.font_size_classes = tinymce.explode(s.font_size_classes || '');
98
+
99
+ // Parse string value
100
+ o = {};
101
+ ed.settings.theme_advanced_font_sizes = s.theme_advanced_font_sizes;
102
+ each(ed.getParam('theme_advanced_font_sizes', '', 'hash'), function(v, k) {
103
+ var cl;
104
+
105
+ if (k == v && v >= 1 && v <= 7) {
106
+ k = v + ' (' + t.sizes[v - 1] + 'pt)';
107
+ cl = s.font_size_classes[v - 1];
108
+ v = s.font_size_style_values[v - 1] || (t.sizes[v - 1] + 'pt');
109
+ }
110
+
111
+ if (/^\s*\./.test(v))
112
+ cl = v.replace(/\./g, '');
113
+
114
+ o[k] = cl ? {'class' : cl} : {fontSize : v};
115
+ });
116
+
117
+ s.theme_advanced_font_sizes = o;
118
+ }
119
+
120
+ if ((v = s.theme_advanced_path_location) && v != 'none')
121
+ s.theme_advanced_statusbar_location = s.theme_advanced_path_location;
122
+
123
+ if (s.theme_advanced_statusbar_location == 'none')
124
+ s.theme_advanced_statusbar_location = 0;
125
+
126
+ if (ed.settings.content_css !== false)
127
+ ed.contentCSS.push(ed.baseURI.toAbsolute(url + "/skins/" + ed.settings.skin + "/content.css"));
128
+
129
+ // Init editor
130
+ ed.onInit.add(function() {
131
+ if (!ed.settings.readonly) {
132
+ ed.onNodeChange.add(t._nodeChanged, t);
133
+ ed.onKeyUp.add(t._updateUndoStatus, t);
134
+ ed.onMouseUp.add(t._updateUndoStatus, t);
135
+ ed.dom.bind(ed.dom.getRoot(), 'dragend', function() {
136
+ t._updateUndoStatus(ed);
137
+ });
138
+ }
139
+ });
140
+
141
+ ed.onSetProgressState.add(function(ed, b, ti) {
142
+ var co, id = ed.id, tb;
143
+
144
+ if (b) {
145
+ t.progressTimer = setTimeout(function() {
146
+ co = ed.getContainer();
147
+ co = co.insertBefore(DOM.create('DIV', {style : 'position:relative'}), co.firstChild);
148
+ tb = DOM.get(ed.id + '_tbl');
149
+
150
+ DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}});
151
+ DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}});
152
+ }, ti || 0);
153
+ } else {
154
+ DOM.remove(id + '_blocker');
155
+ DOM.remove(id + '_progress');
156
+ clearTimeout(t.progressTimer);
157
+ }
158
+ });
159
+
160
+ DOM.loadCSS(s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : url + "/skins/" + ed.settings.skin + "/ui.css");
161
+
162
+ if (s.skin_variant)
163
+ DOM.loadCSS(url + "/skins/" + ed.settings.skin + "/ui_" + s.skin_variant + ".css");
164
+ },
165
+
166
+ _isHighContrast : function() {
167
+ var actualColor, div = DOM.add(DOM.getRoot(), 'div', {'style': 'background-color: rgb(171,239,86);'});
168
+
169
+ actualColor = (DOM.getStyle(div, 'background-color', true) + '').toLowerCase().replace(/ /g, '');
170
+ DOM.remove(div);
171
+
172
+ return actualColor != 'rgb(171,239,86)' && actualColor != '#abef56';
173
+ },
174
+
175
+ createControl : function(n, cf) {
176
+ var cd, c;
177
+
178
+ if (c = cf.createControl(n))
179
+ return c;
180
+
181
+ switch (n) {
182
+ case "styleselect":
183
+ return this._createStyleSelect();
184
+
185
+ case "formatselect":
186
+ return this._createBlockFormats();
187
+
188
+ case "fontselect":
189
+ return this._createFontSelect();
190
+
191
+ case "fontsizeselect":
192
+ return this._createFontSizeSelect();
193
+
194
+ case "forecolor":
195
+ return this._createForeColorMenu();
196
+
197
+ case "backcolor":
198
+ return this._createBackColorMenu();
199
+ }
200
+
201
+ if ((cd = this.controls[n]))
202
+ return cf.createButton(n, {title : "advanced." + cd[0], cmd : cd[1], ui : cd[2], value : cd[3]});
203
+ },
204
+
205
+ execCommand : function(cmd, ui, val) {
206
+ var f = this['_' + cmd];
207
+
208
+ if (f) {
209
+ f.call(this, ui, val);
210
+ return true;
211
+ }
212
+
213
+ return false;
214
+ },
215
+
216
+ _importClasses : function(e) {
217
+ var ed = this.editor, ctrl = ed.controlManager.get('styleselect');
218
+
219
+ if (ctrl.getLength() == 0) {
220
+ each(ed.dom.getClasses(), function(o, idx) {
221
+ var name = 'style_' + idx;
222
+
223
+ ed.formatter.register(name, {
224
+ inline : 'span',
225
+ attributes : {'class' : o['class']},
226
+ selector : '*'
227
+ });
228
+
229
+ ctrl.add(o['class'], name);
230
+ });
231
+ }
232
+ },
233
+
234
+ _createStyleSelect : function(n) {
235
+ var t = this, ed = t.editor, ctrlMan = ed.controlManager, ctrl;
236
+
237
+ // Setup style select box
238
+ ctrl = ctrlMan.createListBox('styleselect', {
239
+ title : 'advanced.style_select',
240
+ onselect : function(name) {
241
+ var matches, formatNames = [];
242
+
243
+ each(ctrl.items, function(item) {
244
+ formatNames.push(item.value);
245
+ });
246
+
247
+ ed.focus();
248
+ ed.undoManager.add();
249
+
250
+ // Toggle off the current format
251
+ matches = ed.formatter.matchAll(formatNames);
252
+ if (!name || matches[0] == name) {
253
+ if (matches[0])
254
+ ed.formatter.remove(matches[0]);
255
+ } else
256
+ ed.formatter.apply(name);
257
+
258
+ ed.undoManager.add();
259
+ ed.nodeChanged();
260
+
261
+ return false; // No auto select
262
+ }
263
+ });
264
+
265
+ // Handle specified format
266
+ ed.onInit.add(function() {
267
+ var counter = 0, formats = ed.getParam('style_formats');
268
+
269
+ if (formats) {
270
+ each(formats, function(fmt) {
271
+ var name, keys = 0;
272
+
273
+ each(fmt, function() {keys++;});
274
+
275
+ if (keys > 1) {
276
+ name = fmt.name = fmt.name || 'style_' + (counter++);
277
+ ed.formatter.register(name, fmt);
278
+ ctrl.add(fmt.title, name);
279
+ } else
280
+ ctrl.add(fmt.title);
281
+ });
282
+ } else {
283
+ each(ed.getParam('theme_advanced_styles', '', 'hash'), function(val, key) {
284
+ var name;
285
+
286
+ if (val) {
287
+ name = 'style_' + (counter++);
288
+
289
+ ed.formatter.register(name, {
290
+ inline : 'span',
291
+ classes : val,
292
+ selector : '*'
293
+ });
294
+
295
+ ctrl.add(t.editor.translate(key), name);
296
+ }
297
+ });
298
+ }
299
+ });
300
+
301
+ // Auto import classes if the ctrl box is empty
302
+ if (ctrl.getLength() == 0) {
303
+ ctrl.onPostRender.add(function(ed, n) {
304
+ if (!ctrl.NativeListBox) {
305
+ Event.add(n.id + '_text', 'focus', t._importClasses, t);
306
+ Event.add(n.id + '_text', 'mousedown', t._importClasses, t);
307
+ Event.add(n.id + '_open', 'focus', t._importClasses, t);
308
+ Event.add(n.id + '_open', 'mousedown', t._importClasses, t);
309
+ } else
310
+ Event.add(n.id, 'focus', t._importClasses, t);
311
+ });
312
+ }
313
+
314
+ return ctrl;
315
+ },
316
+
317
+ _createFontSelect : function() {
318
+ var c, t = this, ed = t.editor;
319
+
320
+ c = ed.controlManager.createListBox('fontselect', {
321
+ title : 'advanced.fontdefault',
322
+ onselect : function(v) {
323
+ var cur = c.items[c.selectedIndex];
324
+
325
+ if (!v && cur) {
326
+ ed.execCommand('FontName', false, cur.value);
327
+ return;
328
+ }
329
+
330
+ ed.execCommand('FontName', false, v);
331
+
332
+ // Fake selection, execCommand will fire a nodeChange and update the selection
333
+ c.select(function(sv) {
334
+ return v == sv;
335
+ });
336
+
337
+ return false; // No auto select
338
+ }
339
+ });
340
+
341
+ if (c) {
342
+ each(ed.getParam('theme_advanced_fonts', t.settings.theme_advanced_fonts, 'hash'), function(v, k) {
343
+ c.add(ed.translate(k), v, {style : v.indexOf('dings') == -1 ? 'font-family:' + v : ''});
344
+ });
345
+ }
346
+
347
+ return c;
348
+ },
349
+
350
+ _createFontSizeSelect : function() {
351
+ var t = this, ed = t.editor, c, i = 0, cl = [];
352
+
353
+ c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {
354
+ var cur = c.items[c.selectedIndex];
355
+
356
+ if (!v && cur) {
357
+ cur = cur.value;
358
+
359
+ if (cur['class']) {
360
+ ed.formatter.toggle('fontsize_class', {value : cur['class']});
361
+ ed.undoManager.add();
362
+ ed.nodeChanged();
363
+ } else {
364
+ ed.execCommand('FontSize', false, cur.fontSize);
365
+ }
366
+
367
+ return;
368
+ }
369
+
370
+ if (v['class']) {
371
+ ed.focus();
372
+ ed.undoManager.add();
373
+ ed.formatter.toggle('fontsize_class', {value : v['class']});
374
+ ed.undoManager.add();
375
+ ed.nodeChanged();
376
+ } else
377
+ ed.execCommand('FontSize', false, v.fontSize);
378
+
379
+ // Fake selection, execCommand will fire a nodeChange and update the selection
380
+ c.select(function(sv) {
381
+ return v == sv;
382
+ });
383
+
384
+ return false; // No auto select
385
+ }});
386
+
387
+ if (c) {
388
+ each(t.settings.theme_advanced_font_sizes, function(v, k) {
389
+ var fz = v.fontSize;
390
+
391
+ if (fz >= 1 && fz <= 7)
392
+ fz = t.sizes[parseInt(fz) - 1] + 'pt';
393
+
394
+ c.add(k, v, {'style' : 'font-size:' + fz, 'class' : 'mceFontSize' + (i++) + (' ' + (v['class'] || ''))});
395
+ });
396
+ }
397
+
398
+ return c;
399
+ },
400
+
401
+ _createBlockFormats : function() {
402
+ var c, fmts = {
403
+ p : 'advanced.paragraph',
404
+ address : 'advanced.address',
405
+ pre : 'advanced.pre',
406
+ h1 : 'advanced.h1',
407
+ h2 : 'advanced.h2',
408
+ h3 : 'advanced.h3',
409
+ h4 : 'advanced.h4',
410
+ h5 : 'advanced.h5',
411
+ h6 : 'advanced.h6',
412
+ div : 'advanced.div',
413
+ blockquote : 'advanced.blockquote',
414
+ code : 'advanced.code',
415
+ dt : 'advanced.dt',
416
+ dd : 'advanced.dd',
417
+ samp : 'advanced.samp'
418
+ }, t = this;
419
+
420
+ c = t.editor.controlManager.createListBox('formatselect', {title : 'advanced.block', cmd : 'FormatBlock'});
421
+ if (c) {
422
+ each(t.editor.getParam('theme_advanced_blockformats', t.settings.theme_advanced_blockformats, 'hash'), function(v, k) {
423
+ c.add(t.editor.translate(k != v ? k : fmts[v]), v, {'class' : 'mce_formatPreview mce_' + v});
424
+ });
425
+ }
426
+
427
+ return c;
428
+ },
429
+
430
+ _createForeColorMenu : function() {
431
+ var c, t = this, s = t.settings, o = {}, v;
432
+
433
+ if (s.theme_advanced_more_colors) {
434
+ o.more_colors_func = function() {
435
+ t._mceColorPicker(0, {
436
+ color : c.value,
437
+ func : function(co) {
438
+ c.setColor(co);
439
+ }
440
+ });
441
+ };
442
+ }
443
+
444
+ if (v = s.theme_advanced_text_colors)
445
+ o.colors = v;
446
+
447
+ if (s.theme_advanced_default_foreground_color)
448
+ o.default_color = s.theme_advanced_default_foreground_color;
449
+
450
+ o.title = 'advanced.forecolor_desc';
451
+ o.cmd = 'ForeColor';
452
+ o.scope = this;
453
+
454
+ c = t.editor.controlManager.createColorSplitButton('forecolor', o);
455
+
456
+ return c;
457
+ },
458
+
459
+ _createBackColorMenu : function() {
460
+ var c, t = this, s = t.settings, o = {}, v;
461
+
462
+ if (s.theme_advanced_more_colors) {
463
+ o.more_colors_func = function() {
464
+ t._mceColorPicker(0, {
465
+ color : c.value,
466
+ func : function(co) {
467
+ c.setColor(co);
468
+ }
469
+ });
470
+ };
471
+ }
472
+
473
+ if (v = s.theme_advanced_background_colors)
474
+ o.colors = v;
475
+
476
+ if (s.theme_advanced_default_background_color)
477
+ o.default_color = s.theme_advanced_default_background_color;
478
+
479
+ o.title = 'advanced.backcolor_desc';
480
+ o.cmd = 'HiliteColor';
481
+ o.scope = this;
482
+
483
+ c = t.editor.controlManager.createColorSplitButton('backcolor', o);
484
+
485
+ return c;
486
+ },
487
+
488
+ renderUI : function(o) {
489
+ var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl;
490
+
491
+ if (ed.settings) {
492
+ ed.settings.aria_label = s.aria_label + ed.getLang('advanced.help_shortcut');
493
+ }
494
+
495
+ // TODO: ACC Should have an aria-describedby attribute which is user-configurable to describe what this field is actually for.
496
+ // Maybe actually inherit it from the original textara?
497
+ n = p = DOM.create('span', {role : 'application', 'aria-labelledby' : ed.id + '_voice', id : ed.id + '_parent', 'class' : 'mceEditor ' + ed.settings.skin + 'Skin' + (s.skin_variant ? ' ' + ed.settings.skin + 'Skin' + t._ufirst(s.skin_variant) : '')});
498
+ DOM.add(n, 'span', {'class': 'mceVoiceLabel', 'style': 'display:none;', id: ed.id + '_voice'}, s.aria_label);
499
+
500
+ if (!DOM.boxModel)
501
+ n = DOM.add(n, 'div', {'class' : 'mceOldBoxModel'});
502
+
503
+ n = sc = DOM.add(n, 'table', {role : "presentation", id : ed.id + '_tbl', 'class' : 'mceLayout', cellSpacing : 0, cellPadding : 0});
504
+ n = tb = DOM.add(n, 'tbody');
505
+
506
+ switch ((s.theme_advanced_layout_manager || '').toLowerCase()) {
507
+ case "rowlayout":
508
+ ic = t._rowLayout(s, tb, o);
509
+ break;
510
+
511
+ case "customlayout":
512
+ ic = ed.execCallback("theme_advanced_custom_layout", s, tb, o, p);
513
+ break;
514
+
515
+ default:
516
+ ic = t._simpleLayout(s, tb, o, p);
517
+ }
518
+
519
+ n = o.targetNode;
520
+
521
+ // Add classes to first and last TRs
522
+ nl = sc.rows;
523
+ DOM.addClass(nl[0], 'mceFirst');
524
+ DOM.addClass(nl[nl.length - 1], 'mceLast');
525
+
526
+ // Add classes to first and last TDs
527
+ each(DOM.select('tr', tb), function(n) {
528
+ DOM.addClass(n.firstChild, 'mceFirst');
529
+ DOM.addClass(n.childNodes[n.childNodes.length - 1], 'mceLast');
530
+ });
531
+
532
+ if (DOM.get(s.theme_advanced_toolbar_container))
533
+ DOM.get(s.theme_advanced_toolbar_container).appendChild(p);
534
+ else
535
+ DOM.insertAfter(p, n);
536
+
537
+ Event.add(ed.id + '_path_row', 'click', function(e) {
538
+ e = e.target;
539
+
540
+ if (e.nodeName == 'A') {
541
+ t._sel(e.className.replace(/^.*mcePath_([0-9]+).*$/, '$1'));
542
+
543
+ return Event.cancel(e);
544
+ }
545
+ });
546
+ /*
547
+ if (DOM.get(ed.id + '_path_row')) {
548
+ Event.add(ed.id + '_tbl', 'mouseover', function(e) {
549
+ var re;
550
+
551
+ e = e.target;
552
+
553
+ if (e.nodeName == 'SPAN' && DOM.hasClass(e.parentNode, 'mceButton')) {
554
+ re = DOM.get(ed.id + '_path_row');
555
+ t.lastPath = re.innerHTML;
556
+ DOM.setHTML(re, e.parentNode.title);
557
+ }
558
+ });
559
+
560
+ Event.add(ed.id + '_tbl', 'mouseout', function(e) {
561
+ if (t.lastPath) {
562
+ DOM.setHTML(ed.id + '_path_row', t.lastPath);
563
+ t.lastPath = 0;
564
+ }
565
+ });
566
+ }
567
+ */
568
+
569
+ if (!ed.getParam('accessibility_focus'))
570
+ Event.add(DOM.add(p, 'a', {href : '#'}, '<!-- IE -->'), 'focus', function() {tinyMCE.get(ed.id).focus();});
571
+
572
+ if (s.theme_advanced_toolbar_location == 'external')
573
+ o.deltaHeight = 0;
574
+
575
+ t.deltaHeight = o.deltaHeight;
576
+ o.targetNode = null;
577
+
578
+ ed.onKeyDown.add(function(ed, evt) {
579
+ var DOM_VK_F10 = 121, DOM_VK_F11 = 122;
580
+
581
+ if (evt.altKey) {
582
+ if (evt.keyCode === DOM_VK_F10) {
583
+ t.toolbarGroup.focus();
584
+ return Event.cancel(evt);
585
+ } else if (evt.keyCode === DOM_VK_F11) {
586
+ DOM.get(ed.id + '_path_row').focus();
587
+ return Event.cancel(evt);
588
+ }
589
+ }
590
+ });
591
+
592
+ // alt+0 is the UK recommended shortcut for accessing the list of access controls.
593
+ ed.addShortcut('alt+0', '', 'mceShortcuts', t);
594
+
595
+ return {
596
+ iframeContainer : ic,
597
+ editorContainer : ed.id + '_parent',
598
+ sizeContainer : sc,
599
+ deltaHeight : o.deltaHeight
600
+ };
601
+ },
602
+
603
+ getInfo : function() {
604
+ return {
605
+ longname : 'Advanced theme',
606
+ author : 'Moxiecode Systems AB',
607
+ authorurl : 'http://tinymce.moxiecode.com',
608
+ version : tinymce.majorVersion + "." + tinymce.minorVersion
609
+ }
610
+ },
611
+
612
+ resizeBy : function(dw, dh) {
613
+ var e = DOM.get(this.editor.id + '_ifr');
614
+
615
+ this.resizeTo(e.clientWidth + dw, e.clientHeight + dh);
616
+ },
617
+
618
+ resizeTo : function(w, h, store) {
619
+ var ed = this.editor, s = this.settings, e = DOM.get(ed.id + '_tbl'), ifr = DOM.get(ed.id + '_ifr');
620
+
621
+ // Boundery fix box
622
+ w = Math.max(s.theme_advanced_resizing_min_width || 100, w);
623
+ h = Math.max(s.theme_advanced_resizing_min_height || 100, h);
624
+ w = Math.min(s.theme_advanced_resizing_max_width || 0xFFFF, w);
625
+ h = Math.min(s.theme_advanced_resizing_max_height || 0xFFFF, h);
626
+
627
+ // Resize iframe and container
628
+ DOM.setStyle(e, 'height', '');
629
+ DOM.setStyle(ifr, 'height', h);
630
+
631
+ if (s.theme_advanced_resize_horizontal) {
632
+ DOM.setStyle(e, 'width', '');
633
+ DOM.setStyle(ifr, 'width', w);
634
+
635
+ // Make sure that the size is never smaller than the over all ui
636
+ if (w < e.clientWidth) {
637
+ w = e.clientWidth;
638
+ DOM.setStyle(ifr, 'width', e.clientWidth);
639
+ }
640
+ }
641
+
642
+ // Store away the size
643
+ if (store && s.theme_advanced_resizing_use_cookie) {
644
+ Cookie.setHash("TinyMCE_" + ed.id + "_size", {
645
+ cw : w,
646
+ ch : h
647
+ });
648
+ }
649
+ },
650
+
651
+ destroy : function() {
652
+ var id = this.editor.id;
653
+
654
+ Event.clear(id + '_resize');
655
+ Event.clear(id + '_path_row');
656
+ Event.clear(id + '_external_close');
657
+ },
658
+
659
+ // Internal functions
660
+
661
+ _simpleLayout : function(s, tb, o, p) {
662
+ var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c;
663
+
664
+ if (s.readonly) {
665
+ n = DOM.add(tb, 'tr');
666
+ n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
667
+ return ic;
668
+ }
669
+
670
+ // Create toolbar container at top
671
+ if (lo == 'top')
672
+ t._addToolbars(tb, o);
673
+
674
+ // Create external toolbar
675
+ if (lo == 'external') {
676
+ n = c = DOM.create('div', {style : 'position:relative'});
677
+ n = DOM.add(n, 'div', {id : ed.id + '_external', 'class' : 'mceExternalToolbar'});
678
+ DOM.add(n, 'a', {id : ed.id + '_external_close', href : 'javascript:;', 'class' : 'mceExternalClose'});
679
+ n = DOM.add(n, 'table', {id : ed.id + '_tblext', cellSpacing : 0, cellPadding : 0});
680
+ etb = DOM.add(n, 'tbody');
681
+
682
+ if (p.firstChild.className == 'mceOldBoxModel')
683
+ p.firstChild.appendChild(c);
684
+ else
685
+ p.insertBefore(c, p.firstChild);
686
+
687
+ t._addToolbars(etb, o);
688
+
689
+ ed.onMouseUp.add(function() {
690
+ var e = DOM.get(ed.id + '_external');
691
+ DOM.show(e);
692
+
693
+ DOM.hide(lastExtID);
694
+
695
+ var f = Event.add(ed.id + '_external_close', 'click', function() {
696
+ DOM.hide(ed.id + '_external');
697
+ Event.remove(ed.id + '_external_close', 'click', f);
698
+ });
699
+
700
+ DOM.show(e);
701
+ DOM.setStyle(e, 'top', 0 - DOM.getRect(ed.id + '_tblext').h - 1);
702
+
703
+ // Fixes IE rendering bug
704
+ DOM.hide(e);
705
+ DOM.show(e);
706
+ e.style.filter = '';
707
+
708
+ lastExtID = ed.id + '_external';
709
+
710
+ e = null;
711
+ });
712
+ }
713
+
714
+ if (sl == 'top')
715
+ t._addStatusBar(tb, o);
716
+
717
+ // Create iframe container
718
+ if (!s.theme_advanced_toolbar_container) {
719
+ n = DOM.add(tb, 'tr');
720
+ n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
721
+ }
722
+
723
+ // Create toolbar container at bottom
724
+ if (lo == 'bottom')
725
+ t._addToolbars(tb, o);
726
+
727
+ if (sl == 'bottom')
728
+ t._addStatusBar(tb, o);
729
+
730
+ return ic;
731
+ },
732
+
733
+ _rowLayout : function(s, tb, o) {
734
+ var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a;
735
+
736
+ dc = s.theme_advanced_containers_default_class || '';
737
+ da = s.theme_advanced_containers_default_align || 'center';
738
+
739
+ each(explode(s.theme_advanced_containers || ''), function(c, i) {
740
+ var v = s['theme_advanced_container_' + c] || '';
741
+
742
+ switch (v.toLowerCase()) {
743
+ case 'mceeditor':
744
+ n = DOM.add(tb, 'tr');
745
+ n = ic = DOM.add(n, 'td', {'class' : 'mceIframeContainer'});
746
+ break;
747
+
748
+ case 'mceelementpath':
749
+ t._addStatusBar(tb, o);
750
+ break;
751
+
752
+ default:
753
+ a = (s['theme_advanced_container_' + c + '_align'] || da).toLowerCase();
754
+ a = 'mce' + t._ufirst(a);
755
+
756
+ n = DOM.add(DOM.add(tb, 'tr'), 'td', {
757
+ 'class' : 'mceToolbar ' + (s['theme_advanced_container_' + c + '_class'] || dc) + ' ' + a || da
758
+ });
759
+
760
+ to = cf.createToolbar("toolbar" + i);
761
+ t._addControls(v, to);
762
+ DOM.setHTML(n, to.renderHTML());
763
+ o.deltaHeight -= s.theme_advanced_row_height;
764
+ }
765
+ });
766
+
767
+ return ic;
768
+ },
769
+
770
+ _addControls : function(v, tb) {
771
+ var t = this, s = t.settings, di, cf = t.editor.controlManager;
772
+
773
+ if (s.theme_advanced_disable && !t._disabled) {
774
+ di = {};
775
+
776
+ each(explode(s.theme_advanced_disable), function(v) {
777
+ di[v] = 1;
778
+ });
779
+
780
+ t._disabled = di;
781
+ } else
782
+ di = t._disabled;
783
+
784
+ each(explode(v), function(n) {
785
+ var c;
786
+
787
+ if (di && di[n])
788
+ return;
789
+
790
+ // Compatiblity with 2.x
791
+ if (n == 'tablecontrols') {
792
+ each(["table","|","row_props","cell_props","|","row_before","row_after","delete_row","|","col_before","col_after","delete_col","|","split_cells","merge_cells"], function(n) {
793
+ n = t.createControl(n, cf);
794
+
795
+ if (n)
796
+ tb.add(n);
797
+ });
798
+
799
+ return;
800
+ }
801
+
802
+ c = t.createControl(n, cf);
803
+
804
+ if (c)
805
+ tb.add(c);
806
+ });
807
+ },
808
+
809
+ _addToolbars : function(c, o) {
810
+ var t = this, i, tb, ed = t.editor, s = t.settings, v, cf = ed.controlManager, di, n, h = [], a, toolbarGroup;
811
+
812
+ toolbarGroup = cf.createToolbarGroup('toolbargroup', {
813
+ 'name': ed.getLang('advanced.toolbar'),
814
+ 'tab_focus_toolbar':ed.getParam('theme_advanced_tab_focus_toolbar')
815
+ });
816
+
817
+ t.toolbarGroup = toolbarGroup;
818
+
819
+ a = s.theme_advanced_toolbar_align.toLowerCase();
820
+ a = 'mce' + t._ufirst(a);
821
+
822
+ n = DOM.add(DOM.add(c, 'tr', {role: 'presentation'}), 'td', {'class' : 'mceToolbar ' + a, "role":"presentation"});
823
+
824
+ // Create toolbar and add the controls
825
+ for (i=1; (v = s['theme_advanced_buttons' + i]); i++) {
826
+ tb = cf.createToolbar("toolbar" + i, {'class' : 'mceToolbarRow' + i});
827
+
828
+ if (s['theme_advanced_buttons' + i + '_add'])
829
+ v += ',' + s['theme_advanced_buttons' + i + '_add'];
830
+
831
+ if (s['theme_advanced_buttons' + i + '_add_before'])
832
+ v = s['theme_advanced_buttons' + i + '_add_before'] + ',' + v;
833
+
834
+ t._addControls(v, tb);
835
+ toolbarGroup.add(tb);
836
+
837
+ o.deltaHeight -= s.theme_advanced_row_height;
838
+ }
839
+ h.push(toolbarGroup.renderHTML());
840
+ h.push(DOM.createHTML('a', {href : '#', accesskey : 'z', title : ed.getLang("advanced.toolbar_focus"), onfocus : 'tinyMCE.getInstanceById(\'' + ed.id + '\').focus();'}, '<!-- IE -->'));
841
+ DOM.setHTML(n, h.join(''));
842
+ },
843
+
844
+ _addStatusBar : function(tb, o) {
845
+ var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
846
+
847
+ n = DOM.add(tb, 'tr');
848
+ n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'});
849
+ n = DOM.add(n, 'div', {id : ed.id + '_path_row', 'role': 'group', 'aria-labelledby': ed.id + '_path_voice'});
850
+ if (s.theme_advanced_path) {
851
+ DOM.add(n, 'span', {id: ed.id + '_path_voice'}, ed.translate('advanced.path'));
852
+ DOM.add(n, 'span', {}, ': ');
853
+ } else {
854
+ DOM.add(n, 'span', {}, '&#160;');
855
+ }
856
+
857
+
858
+ if (s.theme_advanced_resizing) {
859
+ DOM.add(td, 'a', {id : ed.id + '_resize', href : 'javascript:;', onclick : "return false;", 'class' : 'mceResize'});
860
+
861
+ if (s.theme_advanced_resizing_use_cookie) {
862
+ ed.onPostRender.add(function() {
863
+ var o = Cookie.getHash("TinyMCE_" + ed.id + "_size"), c = DOM.get(ed.id + '_tbl');
864
+
865
+ if (!o)
866
+ return;
867
+
868
+ t.resizeTo(o.cw, o.ch);
869
+ });
870
+ }
871
+
872
+ ed.onPostRender.add(function() {
873
+ Event.add(ed.id + '_resize', 'click', function(e) {
874
+ e.preventDefault();
875
+ });
876
+
877
+ Event.add(ed.id + '_resize', 'mousedown', function(e) {
878
+ var mouseMoveHandler1, mouseMoveHandler2,
879
+ mouseUpHandler1, mouseUpHandler2,
880
+ startX, startY, startWidth, startHeight, width, height, ifrElm;
881
+
882
+ function resizeOnMove(e) {
883
+ e.preventDefault();
884
+
885
+ width = startWidth + (e.screenX - startX);
886
+ height = startHeight + (e.screenY - startY);
887
+
888
+ t.resizeTo(width, height);
889
+ };
890
+
891
+ function endResize(e) {
892
+ // Stop listening
893
+ Event.remove(DOM.doc, 'mousemove', mouseMoveHandler1);
894
+ Event.remove(ed.getDoc(), 'mousemove', mouseMoveHandler2);
895
+ Event.remove(DOM.doc, 'mouseup', mouseUpHandler1);
896
+ Event.remove(ed.getDoc(), 'mouseup', mouseUpHandler2);
897
+
898
+ width = startWidth + (e.screenX - startX);
899
+ height = startHeight + (e.screenY - startY);
900
+ t.resizeTo(width, height, true);
901
+ };
902
+
903
+ e.preventDefault();
904
+
905
+ // Get the current rect size
906
+ startX = e.screenX;
907
+ startY = e.screenY;
908
+ ifrElm = DOM.get(t.editor.id + '_ifr');
909
+ startWidth = width = ifrElm.clientWidth;
910
+ startHeight = height = ifrElm.clientHeight;
911
+
912
+ // Register envent handlers
913
+ mouseMoveHandler1 = Event.add(DOM.doc, 'mousemove', resizeOnMove);
914
+ mouseMoveHandler2 = Event.add(ed.getDoc(), 'mousemove', resizeOnMove);
915
+ mouseUpHandler1 = Event.add(DOM.doc, 'mouseup', endResize);
916
+ mouseUpHandler2 = Event.add(ed.getDoc(), 'mouseup', endResize);
917
+ });
918
+ });
919
+ }
920
+
921
+ o.deltaHeight -= 21;
922
+ n = tb = null;
923
+ },
924
+
925
+ _updateUndoStatus : function(ed) {
926
+ var cm = ed.controlManager;
927
+
928
+ cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);
929
+ cm.setDisabled('redo', !ed.undoManager.hasRedo());
930
+ },
931
+
932
+ _nodeChanged : function(ed, cm, n, co, ob) {
933
+ var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, formatNames, matches;
934
+
935
+ tinymce.each(t.stateControls, function(c) {
936
+ cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
937
+ });
938
+
939
+ function getParent(name) {
940
+ var i, parents = ob.parents, func = name;
941
+
942
+ if (typeof(name) == 'string') {
943
+ func = function(node) {
944
+ return node.nodeName == name;
945
+ };
946
+ }
947
+
948
+ for (i = 0; i < parents.length; i++) {
949
+ if (func(parents[i]))
950
+ return parents[i];
951
+ }
952
+ };
953
+
954
+ cm.setActive('visualaid', ed.hasVisual);
955
+ cm.setDisabled('undo', !ed.undoManager.hasUndo() && !ed.typing);
956
+ cm.setDisabled('redo', !ed.undoManager.hasRedo());
957
+ cm.setDisabled('outdent', !ed.queryCommandState('Outdent'));
958
+
959
+ p = getParent('A');
960
+ if (c = cm.get('link')) {
961
+ if (!p || !p.name) {
962
+ c.setDisabled(!p && co);
963
+ c.setActive(!!p);
964
+ }
965
+ }
966
+
967
+ if (c = cm.get('unlink')) {
968
+ c.setDisabled(!p && co);
969
+ c.setActive(!!p && !p.name);
970
+ }
971
+
972
+ if (c = cm.get('anchor')) {
973
+ c.setActive(!co && !!p && p.name);
974
+ }
975
+
976
+ p = getParent('IMG');
977
+ if (c = cm.get('image'))
978
+ c.setActive(!co && !!p && n.className.indexOf('mceItem') == -1);
979
+
980
+ if (c = cm.get('styleselect')) {
981
+ t._importClasses();
982
+
983
+ formatNames = [];
984
+ each(c.items, function(item) {
985
+ formatNames.push(item.value);
986
+ });
987
+
988
+ matches = ed.formatter.matchAll(formatNames);
989
+ c.select(matches[0]);
990
+ }
991
+
992
+ if (c = cm.get('formatselect')) {
993
+ p = getParent(DOM.isBlock);
994
+
995
+ if (p)
996
+ c.select(p.nodeName.toLowerCase());
997
+ }
998
+
999
+ // Find out current fontSize, fontFamily and fontClass
1000
+ getParent(function(n) {
1001
+ if (n.nodeName === 'SPAN') {
1002
+ if (!cl && n.className)
1003
+ cl = n.className;
1004
+ }
1005
+
1006
+ if (ed.dom.is(n, s.theme_advanced_font_selector)) {
1007
+ if (!fz && n.style.fontSize)
1008
+ fz = n.style.fontSize;
1009
+
1010
+ if (!fn && n.style.fontFamily)
1011
+ fn = n.style.fontFamily.replace(/[\"\']+/g, '').replace(/^([^,]+).*/, '$1').toLowerCase();
1012
+ }
1013
+
1014
+ return false;
1015
+ });
1016
+
1017
+ if (c = cm.get('fontselect')) {
1018
+ c.select(function(v) {
1019
+ return v.replace(/^([^,]+).*/, '$1').toLowerCase() == fn;
1020
+ });
1021
+ }
1022
+
1023
+ // Select font size
1024
+ if (c = cm.get('fontsizeselect')) {
1025
+ // Use computed style
1026
+ if (s.theme_advanced_runtime_fontsize && !fz && !cl)
1027
+ fz = ed.dom.getStyle(n, 'fontSize', true);
1028
+
1029
+ c.select(function(v) {
1030
+ if (v.fontSize && v.fontSize === fz)
1031
+ return true;
1032
+
1033
+ if (v['class'] && v['class'] === cl)
1034
+ return true;
1035
+ });
1036
+ }
1037
+
1038
+ if (s.theme_advanced_show_current_color) {
1039
+ function updateColor(controlId, color) {
1040
+ if (c = cm.get(controlId)) {
1041
+ if (!color)
1042
+ color = c.settings.default_color;
1043
+ if (color !== c.value) {
1044
+ c.displayColor(color);
1045
+ }
1046
+ }
1047
+ };
1048
+
1049
+ updateColor('forecolor', fc);
1050
+ updateColor('backcolor', bc);
1051
+ }
1052
+
1053
+ if (s.theme_advanced_path && s.theme_advanced_statusbar_location) {
1054
+ p = DOM.get(ed.id + '_path') || DOM.add(ed.id + '_path_row', 'span', {id : ed.id + '_path'});
1055
+
1056
+ if (t.statusKeyboardNavigation) {
1057
+ t.statusKeyboardNavigation.destroy();
1058
+ t.statusKeyboardNavigation = null;
1059
+ }
1060
+
1061
+ DOM.setHTML(p, '');
1062
+
1063
+ getParent(function(n) {
1064
+ var na = n.nodeName.toLowerCase(), u, pi, ti = '';
1065
+
1066
+ if (n.getAttribute('data-mce-bogus'))
1067
+ return;
1068
+
1069
+ // Ignore non element and hidden elements
1070
+ if (n.nodeType != 1 || n.nodeName === 'BR' || (DOM.hasClass(n, 'mceItemHidden') || DOM.hasClass(n, 'mceItemRemoved')))
1071
+ return;
1072
+
1073
+ // Handle prefix
1074
+ if (tinymce.isIE && n.scopeName !== 'HTML')
1075
+ na = n.scopeName + ':' + na;
1076
+
1077
+ // Remove internal prefix
1078
+ na = na.replace(/mce\:/g, '');
1079
+
1080
+ // Handle node name
1081
+ switch (na) {
1082
+ case 'b':
1083
+ na = 'strong';
1084
+ break;
1085
+
1086
+ case 'i':
1087
+ na = 'em';
1088
+ break;
1089
+
1090
+ case 'img':
1091
+ if (v = DOM.getAttrib(n, 'src'))
1092
+ ti += 'src: ' + v + ' ';
1093
+
1094
+ break;
1095
+
1096
+ case 'a':
1097
+ if (v = DOM.getAttrib(n, 'name')) {
1098
+ ti += 'name: ' + v + ' ';
1099
+ na += '#' + v;
1100
+ }
1101
+
1102
+ if (v = DOM.getAttrib(n, 'href'))
1103
+ ti += 'href: ' + v + ' ';
1104
+
1105
+ break;
1106
+
1107
+ case 'font':
1108
+ if (v = DOM.getAttrib(n, 'face'))
1109
+ ti += 'font: ' + v + ' ';
1110
+
1111
+ if (v = DOM.getAttrib(n, 'size'))
1112
+ ti += 'size: ' + v + ' ';
1113
+
1114
+ if (v = DOM.getAttrib(n, 'color'))
1115
+ ti += 'color: ' + v + ' ';
1116
+
1117
+ break;
1118
+
1119
+ case 'span':
1120
+ if (v = DOM.getAttrib(n, 'style'))
1121
+ ti += 'style: ' + v + ' ';
1122
+
1123
+ break;
1124
+ }
1125
+
1126
+ if (v = DOM.getAttrib(n, 'id'))
1127
+ ti += 'id: ' + v + ' ';
1128
+
1129
+ if (v = n.className) {
1130
+ v = v.replace(/\b\s*(webkit|mce|Apple-)\w+\s*\b/g, '')
1131
+
1132
+ if (v) {
1133
+ ti += 'class: ' + v + ' ';
1134
+
1135
+ if (DOM.isBlock(n) || na == 'img' || na == 'span')
1136
+ na += '.' + v;
1137
+ }
1138
+ }
1139
+
1140
+ na = na.replace(/(html:)/g, '');
1141
+ na = {name : na, node : n, title : ti};
1142
+ t.onResolveName.dispatch(t, na);
1143
+ ti = na.title;
1144
+ na = na.name;
1145
+
1146
+ //u = "javascript:tinymce.EditorManager.get('" + ed.id + "').theme._sel('" + (de++) + "');";
1147
+ pi = DOM.create('a', {'href' : "javascript:;", role: 'button', onmousedown : "return false;", title : ti, 'class' : 'mcePath_' + (de++)}, na);
1148
+
1149
+ if (p.hasChildNodes()) {
1150
+ p.insertBefore(DOM.create('span', {'aria-hidden': 'true'}, '\u00a0\u00bb '), p.firstChild);
1151
+ p.insertBefore(pi, p.firstChild);
1152
+ } else
1153
+ p.appendChild(pi);
1154
+ }, ed.getBody());
1155
+
1156
+ if (DOM.select('a', p).length > 0) {
1157
+ t.statusKeyboardNavigation = new tinymce.ui.KeyboardNavigation({
1158
+ root: ed.id + "_path_row",
1159
+ items: DOM.select('a', p),
1160
+ excludeFromTabOrder: true,
1161
+ onCancel: function() {
1162
+ ed.focus();
1163
+ }
1164
+ }, DOM);
1165
+ }
1166
+ }
1167
+ },
1168
+
1169
+ // Commands gets called by execCommand
1170
+
1171
+ _sel : function(v) {
1172
+ this.editor.execCommand('mceSelectNodeDepth', false, v);
1173
+ },
1174
+
1175
+ _mceInsertAnchor : function(ui, v) {
1176
+ var ed = this.editor;
1177
+
1178
+ ed.windowManager.open({
1179
+ url : this.url + '/anchor.htm',
1180
+ width : 320 + parseInt(ed.getLang('advanced.anchor_delta_width', 0)),
1181
+ height : 90 + parseInt(ed.getLang('advanced.anchor_delta_height', 0)),
1182
+ inline : true
1183
+ }, {
1184
+ theme_url : this.url
1185
+ });
1186
+ },
1187
+
1188
+ _mceCharMap : function() {
1189
+ var ed = this.editor;
1190
+
1191
+ ed.windowManager.open({
1192
+ url : this.url + '/charmap.htm',
1193
+ width : 550 + parseInt(ed.getLang('advanced.charmap_delta_width', 0)),
1194
+ height : 250 + parseInt(ed.getLang('advanced.charmap_delta_height', 0)),
1195
+ inline : true
1196
+ }, {
1197
+ theme_url : this.url
1198
+ });
1199
+ },
1200
+
1201
+ _mceHelp : function() {
1202
+ var ed = this.editor;
1203
+
1204
+ ed.windowManager.open({
1205
+ url : this.url + '/about.htm',
1206
+ width : 480,
1207
+ height : 380,
1208
+ inline : true
1209
+ }, {
1210
+ theme_url : this.url
1211
+ });
1212
+ },
1213
+
1214
+ _mceShortcuts : function() {
1215
+ var ed = this.editor;
1216
+ ed.windowManager.open({
1217
+ url: this.url + '/shortcuts.htm',
1218
+ width: 480,
1219
+ height: 380,
1220
+ inline: true
1221
+ }, {
1222
+ theme_url: this.url
1223
+ });
1224
+ },
1225
+
1226
+ _mceColorPicker : function(u, v) {
1227
+ var ed = this.editor;
1228
+
1229
+ v = v || {};
1230
+
1231
+ ed.windowManager.open({
1232
+ url : this.url + '/color_picker.htm',
1233
+ width : 375 + parseInt(ed.getLang('advanced.colorpicker_delta_width', 0)),
1234
+ height : 250 + parseInt(ed.getLang('advanced.colorpicker_delta_height', 0)),
1235
+ close_previous : false,
1236
+ inline : true
1237
+ }, {
1238
+ input_color : v.color,
1239
+ func : v.func,
1240
+ theme_url : this.url
1241
+ });
1242
+ },
1243
+
1244
+ _mceCodeEditor : function(ui, val) {
1245
+ var ed = this.editor;
1246
+
1247
+ ed.windowManager.open({
1248
+ url : this.url + '/source_editor.htm',
1249
+ width : parseInt(ed.getParam("theme_advanced_source_editor_width", 720)),
1250
+ height : parseInt(ed.getParam("theme_advanced_source_editor_height", 580)),
1251
+ inline : true,
1252
+ resizable : true,
1253
+ maximizable : true
1254
+ }, {
1255
+ theme_url : this.url
1256
+ });
1257
+ },
1258
+
1259
+ _mceImage : function(ui, val) {
1260
+ var ed = this.editor;
1261
+
1262
+ // Internal image object like a flash placeholder
1263
+ if (ed.dom.getAttrib(ed.selection.getNode(), 'class').indexOf('mceItem') != -1)
1264
+ return;
1265
+
1266
+ ed.windowManager.open({
1267
+ url : this.url + '/image.htm',
1268
+ width : 355 + parseInt(ed.getLang('advanced.image_delta_width', 0)),
1269
+ height : 275 + parseInt(ed.getLang('advanced.image_delta_height', 0)),
1270
+ inline : true
1271
+ }, {
1272
+ theme_url : this.url
1273
+ });
1274
+ },
1275
+
1276
+ _mceLink : function(ui, val) {
1277
+ var ed = this.editor;
1278
+
1279
+ ed.windowManager.open({
1280
+ url : this.url + '/link.htm',
1281
+ width : 310 + parseInt(ed.getLang('advanced.link_delta_width', 0)),
1282
+ height : 200 + parseInt(ed.getLang('advanced.link_delta_height', 0)),
1283
+ inline : true
1284
+ }, {
1285
+ theme_url : this.url
1286
+ });
1287
+ },
1288
+
1289
+ _mceNewDocument : function() {
1290
+ var ed = this.editor;
1291
+
1292
+ ed.windowManager.confirm('advanced.newdocument', function(s) {
1293
+ if (s)
1294
+ ed.execCommand('mceSetContent', false, '');
1295
+ });
1296
+ },
1297
+
1298
+ _mceForeColor : function() {
1299
+ var t = this;
1300
+
1301
+ this._mceColorPicker(0, {
1302
+ color: t.fgColor,
1303
+ func : function(co) {
1304
+ t.fgColor = co;
1305
+ t.editor.execCommand('ForeColor', false, co);
1306
+ }
1307
+ });
1308
+ },
1309
+
1310
+ _mceBackColor : function() {
1311
+ var t = this;
1312
+
1313
+ this._mceColorPicker(0, {
1314
+ color: t.bgColor,
1315
+ func : function(co) {
1316
+ t.bgColor = co;
1317
+ t.editor.execCommand('HiliteColor', false, co);
1318
+ }
1319
+ });
1320
+ },
1321
+
1322
+ _ufirst : function(s) {
1323
+ return s.substring(0, 1).toUpperCase() + s.substring(1);
1324
+ }
1325
+ });
1326
+
1327
+ tinymce.ThemeManager.add('advanced', tinymce.themes.AdvancedTheme);
1328
+ }(tinymce));