erp_app 3.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (909) hide show
  1. data/README.md +3 -0
  2. data/app/controllers/erp_app/application_controller.rb +1 -0
  3. data/app/controllers/erp_app/desktop/base_controller.rb +1 -1
  4. data/app/controllers/erp_app/desktop/configuration_management/base_controller.rb +180 -0
  5. data/app/controllers/erp_app/desktop/configuration_management/options_controller.rb +55 -0
  6. data/app/controllers/erp_app/desktop/configuration_management/types_controller.rb +129 -0
  7. data/app/controllers/erp_app/desktop/control_panel/application_management_controller.rb +1 -1
  8. data/app/controllers/erp_app/desktop/control_panel/desktop_management_controller.rb +1 -1
  9. data/app/controllers/erp_app/desktop/control_panel/profile_management_controller.rb +14 -16
  10. data/app/controllers/erp_app/desktop/file_manager/base_controller.rb +5 -7
  11. data/app/controllers/erp_app/desktop/system_management/application_role_management_controller.rb +1 -1
  12. data/app/controllers/erp_app/desktop/user_management/application_management_controller.rb +9 -9
  13. data/app/controllers/erp_app/desktop/user_management/base_controller.rb +1 -1
  14. data/app/controllers/erp_app/desktop/user_management/role_management_controller.rb +13 -8
  15. data/app/controllers/erp_app/mobile/base_controller.rb +21 -0
  16. data/app/controllers/erp_app/mobile/login_controller.rb +11 -0
  17. data/app/controllers/erp_app/mobile/user_management/base_controller.rb +24 -0
  18. data/app/controllers/erp_app/organizer/base_controller.rb +6 -5
  19. data/app/controllers/erp_app/organizer/crm/base_controller.rb +117 -15
  20. data/app/controllers/erp_app/public_controller.rb +73 -6
  21. data/app/controllers/erp_app/shared/configuration_controller.rb +53 -0
  22. data/app/controllers/erp_app/widget_proxy_controller.rb +1 -1
  23. data/app/models/app_container.rb +8 -2
  24. data/app/models/application.rb +1 -1
  25. data/app/models/configuration.rb +129 -0
  26. data/app/models/configuration_item.rb +45 -0
  27. data/app/models/configuration_item_type.rb +96 -0
  28. data/app/models/configuration_item_type_configuration_option.rb +10 -0
  29. data/app/models/configuration_option.rb +20 -0
  30. data/app/models/desktop.rb +7 -10
  31. data/app/models/extensions/user.rb +41 -2
  32. data/app/models/mobile.rb +10 -0
  33. data/app/models/mobile_application.rb +6 -0
  34. data/app/models/organizer.rb +3 -6
  35. data/app/models/preference.rb +2 -2
  36. data/app/models/preference_type.rb +1 -1
  37. data/app/models/user_preference.rb +3 -3
  38. data/app/models/valid_configuration.rb +4 -0
  39. data/app/models/valid_preference_type.rb +2 -2
  40. data/app/observers/user_app_container_observer.rb +7 -2
  41. data/app/views/erp_app/desktop/base/index.erb +25 -32
  42. data/app/views/erp_app/login/index.erb +3 -3
  43. data/app/views/erp_app/mobile/base/index.erb +37 -0
  44. data/app/views/erp_app/mobile/login/index.erb +22 -0
  45. data/app/views/erp_app/mobile/user_management/base/index.html.erb +28 -0
  46. data/app/views/erp_app/organizer/base/get_party_details.erb +19 -0
  47. data/app/views/erp_app/organizer/base/index.erb +20 -23
  48. data/app/views/erp_app/widget_proxy/index.erb +1 -1
  49. data/config/routes.rb +22 -0
  50. data/db/data_migrations/20110728201729_erp_app_setup.rb +3 -1
  51. data/db/data_migrations/20120229160222_add_userinfo_widget.rb +30 -0
  52. data/db/data_migrations/20120405193721_create_party_and_role_type_for_communication_events.rb +10 -0
  53. data/db/data_migrations/20120411180756_create_user_management_mobile_application.rb +18 -0
  54. data/db/data_migrations/20120413000515_create_mobile_containers.rb +13 -0
  55. data/db/data_migrations/20120418164215_create_configuration_management_desktop_application.rb +22 -0
  56. data/db/data_migrations/upgrade/20120213182651_add_true_north_background.rb +16 -0
  57. data/db/migrate/20080805000096_base_app_framework.rb +125 -33
  58. data/db/migrate/20120316152543_add_is_template_to_configurations.rb +5 -0
  59. data/db/migrate/20120320182253_update_app_container.rb +20 -0
  60. data/db/migrate/20120325123722_remove_file_system_loader_column.rb +9 -0
  61. data/db/migrate/20120411151848_add_base_url_to_application.rb +5 -0
  62. data/db/migrate/20120427000446_add_user_defined_to_config_option.rb +17 -0
  63. data/db/migrate/20120429130430_update_configuration_join_tables.rb +16 -0
  64. data/db/migrate/upgrade/20120208201934_add_configuration_models.rb +109 -0
  65. data/db/migrate/upgrade/20120209194251_add_user_defined_to_config_type.rb +5 -0
  66. data/db/migrate/upgrade/20120210172929_add_config_types_to_configs.rb +23 -0
  67. data/lib/erp_app/application_resource_loader/base_loader.rb +17 -0
  68. data/lib/erp_app/application_resource_loader/{file_system_loader.rb → desktop_organizer_loader.rb} +15 -29
  69. data/lib/erp_app/application_resource_loader/mobile_loader.rb +46 -0
  70. data/lib/erp_app/application_resource_loader/shared_loader.rb +26 -0
  71. data/lib/erp_app/application_resource_loader.rb +4 -0
  72. data/lib/erp_app/config.rb +2 -2
  73. data/lib/erp_app/engine.rb +7 -4
  74. data/lib/erp_app/extensions/railties/action_view/base.rb +12 -0
  75. data/lib/erp_app/extensions/railties/action_view/helpers/active_ext_helper.rb +17 -0
  76. data/lib/erp_app/extensions/railties/action_view/helpers/extjs_helper.rb +45 -0
  77. data/lib/erp_app/extensions/railties/action_view/helpers/include_helper.rb +134 -0
  78. data/lib/erp_app/extensions/railties/action_view/helpers/tag_helper.rb +27 -0
  79. data/lib/erp_app/extensions.rb +1 -2
  80. data/lib/erp_app/version.rb +8 -1
  81. data/lib/erp_app/widgets/base.rb +50 -43
  82. data/lib/erp_app/widgets/javascript_loader.rb +13 -20
  83. data/lib/erp_app/widgets/loader.rb +126 -0
  84. data/lib/erp_app/widgets/railties/action_view/base.rb +8 -0
  85. data/lib/erp_app/widgets/railties/action_view/helpers/widget_helper.rb +57 -0
  86. data/lib/erp_app/widgets.rb +2 -2
  87. data/lib/erp_app.rb +3 -1
  88. data/lib/generators/cms_widget/templates/engine/engine_template.rb +0 -4
  89. data/lib/generators/cms_widget/templates/javascript/base.js.erb +2 -1
  90. data/lib/generators/desktop_application/USAGE +1 -1
  91. data/lib/generators/desktop_application/templates/controllers/controller_template.rb +7 -5
  92. data/lib/generators/desktop_application/templates/migrate/migration_template.rb +0 -4
  93. data/lib/generators/mobile_application/USAGE +24 -0
  94. data/lib/generators/mobile_application/mobile_application_generator.rb +27 -0
  95. data/lib/generators/mobile_application/templates/INSTALL +25 -0
  96. data/lib/generators/mobile_application/templates/controllers/controller_template.rb +11 -0
  97. data/lib/generators/mobile_application/templates/migrate/migration_template.rb +14 -0
  98. data/lib/generators/mobile_application/templates/public/app.js.erb +35 -0
  99. data/lib/generators/mobile_application/templates/views/index.html.erb +28 -0
  100. data/lib/generators/organizer_application/templates/controllers/controller_template.rb +9 -11
  101. data/public/images/icons/apartment/apartment_16x16.png +0 -0
  102. data/public/images/icons/apartment/apartment_24x24.png +0 -0
  103. data/public/images/icons/apartment/apartment_32x32.png +0 -0
  104. data/public/images/icons/apartment/apartment_48x48.png +0 -0
  105. data/public/images/wallpaper/truenorth.png +0 -0
  106. data/public/javascripts/erp_app/authentication/widget_manager.js +23 -2
  107. data/public/javascripts/erp_app/ckeditor/ckeditor.js +113 -111
  108. data/public/javascripts/erp_app/ckeditor/contents.css +2 -2
  109. data/public/javascripts/erp_app/ckeditor/lang/_translationstatus.txt +59 -59
  110. data/public/javascripts/erp_app/ckeditor/lang/af.js +1 -1
  111. data/public/javascripts/erp_app/ckeditor/lang/ar.js +1 -1
  112. data/public/javascripts/erp_app/ckeditor/lang/bg.js +1 -1
  113. data/public/javascripts/erp_app/ckeditor/lang/bn.js +1 -1
  114. data/public/javascripts/erp_app/ckeditor/lang/bs.js +1 -1
  115. data/public/javascripts/erp_app/ckeditor/lang/ca.js +1 -1
  116. data/public/javascripts/erp_app/ckeditor/lang/cs.js +1 -1
  117. data/public/javascripts/erp_app/ckeditor/lang/cy.js +1 -1
  118. data/public/javascripts/erp_app/ckeditor/lang/da.js +1 -1
  119. data/public/javascripts/erp_app/ckeditor/lang/de.js +1 -1
  120. data/public/javascripts/erp_app/ckeditor/lang/el.js +1 -1
  121. data/public/javascripts/erp_app/ckeditor/lang/en-au.js +1 -1
  122. data/public/javascripts/erp_app/ckeditor/lang/en-ca.js +1 -1
  123. data/public/javascripts/erp_app/ckeditor/lang/en-gb.js +1 -1
  124. data/public/javascripts/erp_app/ckeditor/lang/en.js +1 -1
  125. data/public/javascripts/erp_app/ckeditor/lang/eo.js +1 -1
  126. data/public/javascripts/erp_app/ckeditor/lang/es.js +1 -1
  127. data/public/javascripts/erp_app/ckeditor/lang/et.js +1 -1
  128. data/public/javascripts/erp_app/ckeditor/lang/eu.js +1 -1
  129. data/public/javascripts/erp_app/ckeditor/lang/fa.js +1 -1
  130. data/public/javascripts/erp_app/ckeditor/lang/fi.js +1 -1
  131. data/public/javascripts/erp_app/ckeditor/lang/fo.js +1 -1
  132. data/public/javascripts/erp_app/ckeditor/lang/fr-ca.js +1 -1
  133. data/public/javascripts/erp_app/ckeditor/lang/fr.js +1 -1
  134. data/public/javascripts/erp_app/ckeditor/lang/gl.js +1 -1
  135. data/public/javascripts/erp_app/ckeditor/lang/gu.js +1 -1
  136. data/public/javascripts/erp_app/ckeditor/lang/he.js +1 -1
  137. data/public/javascripts/erp_app/ckeditor/lang/hi.js +1 -1
  138. data/public/javascripts/erp_app/ckeditor/lang/hr.js +1 -1
  139. data/public/javascripts/erp_app/ckeditor/lang/hu.js +1 -1
  140. data/public/javascripts/erp_app/ckeditor/lang/is.js +1 -1
  141. data/public/javascripts/erp_app/ckeditor/lang/it.js +1 -1
  142. data/public/javascripts/erp_app/ckeditor/lang/ja.js +1 -1
  143. data/public/javascripts/erp_app/ckeditor/lang/ka.js +1 -1
  144. data/public/javascripts/erp_app/ckeditor/lang/km.js +1 -1
  145. data/public/javascripts/erp_app/ckeditor/lang/ko.js +1 -1
  146. data/public/javascripts/erp_app/ckeditor/lang/lt.js +1 -1
  147. data/public/javascripts/erp_app/ckeditor/lang/lv.js +1 -1
  148. data/public/javascripts/erp_app/ckeditor/lang/mn.js +1 -1
  149. data/public/javascripts/erp_app/ckeditor/lang/ms.js +1 -1
  150. data/public/javascripts/erp_app/ckeditor/lang/nb.js +1 -1
  151. data/public/javascripts/erp_app/ckeditor/lang/nl.js +1 -1
  152. data/public/javascripts/erp_app/ckeditor/lang/no.js +1 -1
  153. data/public/javascripts/erp_app/ckeditor/lang/pl.js +1 -1
  154. data/public/javascripts/erp_app/ckeditor/lang/pt-br.js +1 -1
  155. data/public/javascripts/erp_app/ckeditor/lang/pt.js +1 -1
  156. data/public/javascripts/erp_app/ckeditor/lang/ro.js +1 -1
  157. data/public/javascripts/erp_app/ckeditor/lang/ru.js +1 -1
  158. data/public/javascripts/erp_app/ckeditor/lang/sk.js +1 -1
  159. data/public/javascripts/erp_app/ckeditor/lang/sl.js +1 -1
  160. data/public/javascripts/erp_app/ckeditor/lang/sr-latn.js +1 -1
  161. data/public/javascripts/erp_app/ckeditor/lang/sr.js +1 -1
  162. data/public/javascripts/erp_app/ckeditor/lang/sv.js +1 -1
  163. data/public/javascripts/erp_app/ckeditor/lang/th.js +1 -1
  164. data/public/javascripts/erp_app/ckeditor/lang/tr.js +1 -1
  165. data/public/javascripts/erp_app/ckeditor/lang/uk.js +1 -1
  166. data/public/javascripts/erp_app/ckeditor/lang/vi.js +1 -1
  167. data/public/javascripts/erp_app/ckeditor/lang/zh-cn.js +1 -1
  168. data/public/javascripts/erp_app/ckeditor/lang/zh.js +1 -1
  169. data/public/javascripts/erp_app/ckeditor/plugins/autogrow/plugin.js +1 -1
  170. data/public/javascripts/erp_app/ckeditor/plugins/docprops/dialogs/docprops.js +2 -2
  171. data/public/javascripts/erp_app/ckeditor/plugins/find/dialogs/find.js +5 -5
  172. data/public/javascripts/erp_app/ckeditor/plugins/flash/dialogs/flash.js +1 -1
  173. data/public/javascripts/erp_app/ckeditor/plugins/forms/dialogs/textarea.js +1 -1
  174. data/public/javascripts/erp_app/ckeditor/plugins/image/dialogs/image.js +1 -1
  175. data/public/javascripts/erp_app/ckeditor/plugins/link/dialogs/link.js +1 -1
  176. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/codemirror_config.js +85 -0
  177. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/config/editor.css +96 -0
  178. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/config/images/buttonbg.gif +0 -0
  179. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/config/images/cancel.png +0 -0
  180. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/config/images/highlight.png +0 -0
  181. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/config/images/redo.png +0 -0
  182. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/config/images/reindent.png +0 -0
  183. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/config/images/save.png +0 -0
  184. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/config/images/search.png +0 -0
  185. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/config/images/undo.png +0 -0
  186. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/config/nocolors.css +24 -0
  187. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/LICENSE +23 -0
  188. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/bigtest.html +1296 -0
  189. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/compress.html +169 -0
  190. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/csharp/css/csharpcolors.css +60 -0
  191. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/csharp/index.html +61 -0
  192. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/csharp/js/parsecsharp.js +329 -0
  193. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/csharp/js/tokenizecsharp.js +196 -0
  194. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/freemarker/LICENSE +24 -0
  195. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/freemarker/css/freemarkercolors.css +63 -0
  196. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/freemarker/index.html +75 -0
  197. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/freemarker/js/parsefreemarker.js +380 -0
  198. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/groovy/index.html +57 -0
  199. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/java/LICENSE +20 -0
  200. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/java/css/javacolors.css +64 -0
  201. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/java/index.html +66 -0
  202. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/java/js/parsejava.js +285 -0
  203. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/java/js/tokenizejava.js +222 -0
  204. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/lua/LICENSE +32 -0
  205. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/lua/css/luacolors.css +63 -0
  206. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/lua/index.html +68 -0
  207. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/lua/js/parselua.js +254 -0
  208. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/ometa/LICENSE +23 -0
  209. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/ometa/css/ometacolors.css +63 -0
  210. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/ometa/index.html +77 -0
  211. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/ometa/js/parseometa.js +364 -0
  212. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/ometa/js/tokenizeometa.js +209 -0
  213. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/php/LICENSE +37 -0
  214. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/php/css/phpcolors.css +114 -0
  215. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/php/index.html +310 -0
  216. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/php/js/parsephp.js +419 -0
  217. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/php/js/parsephphtmlmixed.js +116 -0
  218. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/php/js/tokenizephp.js +1208 -0
  219. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/plsql/LICENSE +22 -0
  220. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/plsql/css/plsqlcolors.css +57 -0
  221. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/plsql/index.html +67 -0
  222. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/plsql/js/parseplsql.js +233 -0
  223. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/python/LICENSE +32 -0
  224. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/python/css/pythoncolors.css +58 -0
  225. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/python/index.html +141 -0
  226. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/python/js/parsepython.js +541 -0
  227. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/regex/css/js-regexcolors.css +214 -0
  228. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/regex/css/regexcolors.css +214 -0
  229. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/regex/index.html +114 -0
  230. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/regex/js/parsejavascript_and_regex.js +91 -0
  231. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/regex/js/parseregex-unicode.js +284 -0
  232. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/regex/js/parseregex.js +847 -0
  233. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/regex/js-regex.html +118 -0
  234. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/scheme/LICENSE +23 -0
  235. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/scheme/css/schemecolors.css +45 -0
  236. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/scheme/index.html +82 -0
  237. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/scheme/js/parsescheme.js +428 -0
  238. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/scheme/js/tokenizescheme.js +241 -0
  239. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/sql/LICENSE +22 -0
  240. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/sql/css/sqlcolors.css +59 -0
  241. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/sql/index.html +56 -0
  242. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/sql/js/parsesql.js +267 -0
  243. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/xquery/LICENSE +13 -0
  244. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/xquery/css/xqcolors-dark.css +93 -0
  245. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/xquery/css/xqcolors.css +99 -0
  246. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/xquery/css/xqcolors2.css +96 -0
  247. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/xquery/index.html +552 -0
  248. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/xquery/js/parsexquery.js +234 -0
  249. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/contrib/xquery/js/tokenizexquery.js +457 -0
  250. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/css/baboon.png +0 -0
  251. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/css/baboon_vector.ai +965 -0
  252. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/css/csscolors.css +55 -0
  253. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/css/docs.css +158 -0
  254. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/css/font.js +15 -0
  255. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/css/jscolors.css +59 -0
  256. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/css/people.jpg +0 -0
  257. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/css/sparqlcolors.css +43 -0
  258. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/css/xmlcolors.css +55 -0
  259. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/csstest.html +60 -0
  260. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/faq.html +86 -0
  261. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/favicon.ico +0 -0
  262. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/googleb196c451afc2ee11.html +1 -0
  263. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/googlehostedservice.html +1 -0
  264. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/highlight.html +82 -0
  265. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/htmltest.html +53 -0
  266. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/index.html +254 -0
  267. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/codemirror.js +582 -0
  268. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/editor.js +1670 -0
  269. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/highlight.js +68 -0
  270. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/mirrorframe.js +81 -0
  271. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/parsecss.js +161 -0
  272. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/parsedummy.js +32 -0
  273. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/parsehtmlmixed.js +93 -0
  274. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/parsejavascript.js +359 -0
  275. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/parsesparql.js +162 -0
  276. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/parsexml.js +291 -0
  277. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/select.js +697 -0
  278. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/stringstream.js +159 -0
  279. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/tokenize.js +57 -0
  280. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/tokenizejavascript.js +174 -0
  281. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/undo.js +413 -0
  282. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/unittests.js +44 -0
  283. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/js/util.js +133 -0
  284. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/jstest.html +56 -0
  285. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/manual.html +806 -0
  286. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/mixedtest.html +52 -0
  287. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/sparqltest.html +41 -0
  288. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/story.html +672 -0
  289. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/unittests.html +125 -0
  290. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/editor/xhtmltest.xhtml +50 -0
  291. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/lang/de.js +20 -0
  292. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/codemirror/lang/en.js +20 -0
  293. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/dialogs/sourcepopup.js +102 -0
  294. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/lang/de.js +9 -0
  295. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/lang/en.js +9 -0
  296. data/public/javascripts/erp_app/ckeditor/plugins/sourcepopup/plugin.js +27 -0
  297. data/public/javascripts/erp_app/ckeditor/plugins/specialchar/dialogs/specialchar.js +1 -1
  298. data/public/javascripts/erp_app/ckeditor/plugins/specialchar/lang/en.js +1 -1
  299. data/public/javascripts/erp_app/ckeditor/plugins/table/dialogs/table.js +4 -4
  300. data/public/javascripts/erp_app/ckeditor/plugins/wsc/dialogs/wsc.js +1 -1
  301. data/public/javascripts/erp_app/ckeditor/skins/kama/dialog.css +1 -1
  302. data/public/javascripts/erp_app/ckeditor/skins/kama/editor.css +3 -3
  303. data/public/javascripts/erp_app/ckeditor/skins/office2003/dialog.css +1 -1
  304. data/public/javascripts/erp_app/ckeditor/skins/office2003/editor.css +1 -1
  305. data/public/javascripts/erp_app/ckeditor/skins/v2/dialog.css +1 -1
  306. data/public/javascripts/erp_app/ckeditor/skins/v2/editor.css +1 -1
  307. data/public/javascripts/erp_app/ckeditor/themes/default/theme.js +2 -2
  308. data/public/javascripts/erp_app/ckeditor_example_config_override.js +44 -0
  309. data/public/javascripts/erp_app/desktop/applications/configuration_management/configuration_options_panel.js +229 -0
  310. data/public/javascripts/erp_app/desktop/applications/configuration_management/configuration_tree_panel.js +482 -0
  311. data/public/javascripts/erp_app/desktop/applications/configuration_management/configuration_types_panel.js +425 -0
  312. data/public/javascripts/erp_app/desktop/applications/configuration_management/module.js +95 -0
  313. data/public/javascripts/erp_app/desktop/applications/configuration_management/stores.0.js +68 -0
  314. data/public/javascripts/erp_app/desktop/applications/control_panel/application_management_panel.js +2 -1
  315. data/public/javascripts/erp_app/desktop/applications/control_panel/module.js +48 -47
  316. data/public/javascripts/erp_app/desktop/applications/control_panel/profile_management_panel.js +141 -84
  317. data/public/javascripts/erp_app/desktop/applications/file_manager/module.js +1 -2
  318. data/public/javascripts/erp_app/desktop/applications/scaffold/models_tree_panel.js +1 -2
  319. data/public/javascripts/erp_app/desktop/applications/system_management/application_role_management_panel.js +1 -2
  320. data/public/javascripts/erp_app/desktop/applications/user_management/module.js +10 -6
  321. data/public/javascripts/erp_app/desktop/applications/user_management/role_management_panel.js +3 -9
  322. data/public/javascripts/erp_app/desktop/applications/user_management/user_application_mgt_panel.js +4 -10
  323. data/public/javascripts/erp_app/ecommerce/credit_card_window.js +1 -1
  324. data/public/javascripts/erp_app/jquery_support.js +5 -5
  325. data/public/javascripts/erp_app/login/mobile.js +52 -0
  326. data/public/javascripts/erp_app/mobile/app.js +46 -0
  327. data/public/javascripts/erp_app/mobile/applications/user_management/app/model/user.js +14 -0
  328. data/public/javascripts/erp_app/mobile/applications/user_management/app/store/users.js +19 -0
  329. data/public/javascripts/erp_app/mobile/applications/user_management/app/view/templates.js +24 -0
  330. data/public/javascripts/erp_app/mobile/applications/user_management/app.js +168 -0
  331. data/public/javascripts/erp_app/mobile/mobile_base.js +10 -0
  332. data/public/javascripts/erp_app/organizer/applications/crm/base.js +415 -117
  333. data/public/javascripts/erp_app/organizer/applications/crm/contact_mechanism_grid.js +8 -1
  334. data/public/javascripts/erp_app/organizer/applications/crm/party_grid.js +33 -36
  335. data/public/javascripts/erp_app/organizer/applications/crm/userinfo.js +215 -0
  336. data/public/javascripts/erp_app/organizer/layout.js +9 -11
  337. data/public/javascripts/erp_app/shared/active_ext/active_ext_grid.js +1 -2
  338. data/public/javascripts/erp_app/shared/active_ext/active_ext_grid_panel.js +2 -3
  339. data/public/javascripts/erp_app/shared/compass_ckeditor.js +7 -6
  340. data/public/javascripts/erp_app/shared/compass_codemirror.js +161 -162
  341. data/public/javascripts/erp_app/shared/configuration/configuration_form.js +278 -0
  342. data/public/javascripts/erp_app/shared/configuration/configuration_panel.js +109 -0
  343. data/public/javascripts/erp_app/{coolclock → shared/coolclock}/coolclock.js +0 -0
  344. data/public/javascripts/erp_app/{coolclock → shared/coolclock}/moreskins.js +0 -0
  345. data/public/javascripts/erp_app/{coolclock → shared/coolclock}/tray_clock.js +0 -0
  346. data/public/javascripts/erp_app/shared/dynamic_editable_grid.js +29 -28
  347. data/public/javascripts/erp_app/shared/dynamic_editable_grid_loader_panel.js +3 -3
  348. data/public/javascripts/erp_app/shared/file_manager_tree.js +41 -25
  349. data/public/javascripts/erp_app/shared/file_upload/Ext.ux.AwesomeUploader.js +1 -1
  350. data/public/javascripts/erp_app/shared/file_upload/Ext.ux.XHRUpload.js +1 -1
  351. data/public/javascripts/erp_app/shared/file_upload/upload_window.js +245 -242
  352. data/public/javascripts/erp_app/shared/google_map_panel.js +82 -83
  353. data/public/javascripts/erp_app/shared/notes_grid.js +1 -2
  354. data/public/javascripts/erp_app/shared/preference_form.js +3 -5
  355. data/public/javascripts/erp_app/tinymce/Ext.ux.TinyMCE.js +689 -0
  356. data/public/javascripts/erp_app/tinymce/center_region.js +611 -0
  357. data/public/javascripts/erp_app/utility.js +284 -246
  358. data/public/javascripts/erp_app/widgets.js +39 -35
  359. data/public/javascripts/extjs/Ext.ux.form.MultiSelect.js +422 -0
  360. data/public/javascripts/extjs/ext-all-debug.js +15973 -12927
  361. data/public/javascripts/extjs/ext-all.js +1 -1
  362. data/public/javascripts/extjs/overrides.js +61 -0
  363. data/public/javascripts/sencha_touch/sencha-touch-all-debug.js +78370 -0
  364. data/public/javascripts/sencha_touch/sencha-touch-all.js +15 -0
  365. data/public/stylesheets/erp_app/mobile/applications/user_management/main.css +5 -0
  366. data/public/stylesheets/erp_app/mobile/mobile.css +336 -0
  367. data/public/stylesheets/erp_app/{compass-ext-all.css → shared/compass-ext-all.css} +37 -1
  368. data/public/stylesheets/extjs/resources/css/ext-all-access.css +1 -1
  369. data/public/stylesheets/extjs/resources/css/ext-all-gray.css +1 -1
  370. data/public/stylesheets/extjs/resources/css/ext-all-scoped.css +1 -1
  371. data/public/stylesheets/extjs/resources/css/ext-all.css +1 -1
  372. data/public/stylesheets/extjs/resources/css/ext-ie-scoped.css +1 -1
  373. data/public/stylesheets/extjs/resources/css/ext-ie.css +1 -1
  374. data/public/stylesheets/extjs/resources/css/ext-sandbox.css +1 -1
  375. data/public/stylesheets/extjs/resources/css/ext-standard-scoped.css +1 -1
  376. data/public/stylesheets/extjs/resources/css/ext-standard.css +1 -1
  377. data/public/stylesheets/extjs/resources/sass/ext-all-access.scss +7 -0
  378. data/public/stylesheets/extjs/resources/sass/ext-all-gray.scss +6 -0
  379. data/public/stylesheets/extjs/resources/themes/images/access/boundlist/trigger-arrow.png +0 -0
  380. data/public/stylesheets/extjs/resources/themes/images/access/grid/refresh-disabled.gif +0 -0
  381. data/public/stylesheets/extjs/resources/themes/images/access/tab-bar/{tab-bar-bg.gif → tab-bar-default-bg.gif} +0 -0
  382. data/public/stylesheets/extjs/resources/themes/images/access/tree/drop-above.gif +0 -0
  383. data/public/stylesheets/extjs/resources/themes/images/access/tree/drop-append.gif +0 -0
  384. data/public/stylesheets/extjs/resources/themes/images/access/tree/drop-below.gif +0 -0
  385. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-large-focus-corners.gif +0 -0
  386. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-large-over-corners.gif +0 -0
  387. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-large-pressed-corners.gif +0 -0
  388. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-medium-focus-corners.gif +0 -0
  389. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-medium-over-corners.gif +0 -0
  390. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-medium-pressed-corners.gif +0 -0
  391. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-small-focus-corners.gif +0 -0
  392. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-small-over-corners.gif +0 -0
  393. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-small-pressed-corners.gif +0 -0
  394. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-toolbar-large-focus-corners.gif +0 -0
  395. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-toolbar-large-over-corners.gif +0 -0
  396. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-toolbar-large-pressed-corners.gif +0 -0
  397. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-toolbar-medium-focus-corners.gif +0 -0
  398. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-toolbar-medium-over-corners.gif +0 -0
  399. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-toolbar-medium-pressed-corners.gif +0 -0
  400. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-toolbar-small-focus-corners.gif +0 -0
  401. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-toolbar-small-over-corners.gif +0 -0
  402. data/public/stylesheets/extjs/resources/themes/images/default/btn/btn-default-toolbar-small-pressed-corners.gif +0 -0
  403. data/public/stylesheets/extjs/resources/themes/images/default/form-invalid-tip/form-invalid-tip-corners.gif +0 -0
  404. data/public/stylesheets/extjs/resources/themes/images/default/form-invalid-tip/form-invalid-tip-sides.gif +0 -0
  405. data/public/stylesheets/extjs/resources/themes/images/default/tab/tab-default-bottom-disabled-bg.gif +0 -0
  406. data/public/stylesheets/extjs/resources/themes/images/default/tab/tab-default-bottom-disabled-corners.gif +0 -0
  407. data/public/stylesheets/extjs/resources/themes/images/default/tab/tab-default-bottom-disabled-sides.gif +0 -0
  408. data/public/stylesheets/extjs/resources/themes/images/default/tab/tab-default-top-disabled-bg.gif +0 -0
  409. data/public/stylesheets/extjs/resources/themes/images/default/tab/tab-default-top-disabled-corners.gif +0 -0
  410. data/public/stylesheets/extjs/resources/themes/images/default/tab/tab-default-top-disabled-sides.gif +0 -0
  411. data/public/stylesheets/extjs/resources/themes/images/default/tab-bar/tab-bar-default-bg.gif +0 -0
  412. data/public/stylesheets/extjs/resources/themes/images/default/tip/tip-corners.gif +0 -0
  413. data/public/stylesheets/extjs/resources/themes/images/default/window-header/window-header-default-bottom-sides.gif +0 -0
  414. data/public/stylesheets/extjs/resources/themes/images/default/window-header/window-header-default-left-sides.gif +0 -0
  415. data/public/stylesheets/extjs/resources/themes/images/default/window-header/window-header-default-right-sides.gif +0 -0
  416. data/public/stylesheets/extjs/resources/themes/images/default/window-header/window-header-default-top-corners.gif +0 -0
  417. data/public/stylesheets/extjs/resources/themes/images/default/window-header/window-header-default-top-sides.gif +0 -0
  418. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/_all.scss +3 -0
  419. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/_mixins.scss +6 -3
  420. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/core/_core.scss +17 -17
  421. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/core/_reset.scss +17 -7
  422. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/layout/_layout.scss +10 -6
  423. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/mixins/_frame.scss +4 -4
  424. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/mixins/_reset-extras.scss +144 -0
  425. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/mixins/_theme-background-image.scss +8 -4
  426. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/util/_dragdrop.scss +3 -3
  427. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/util/_messagebox.scss +5 -5
  428. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/util/_resizable.scss +6 -6
  429. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/util/_splitter.scss +8 -8
  430. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/util/_tool.scss +1 -1
  431. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/variables/_core.scss +1 -1
  432. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/variables/_menu.scss +1 -0
  433. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/_button.scss +38 -27
  434. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/_datepicker.scss +7 -7
  435. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/_drawcomponent.scss +1 -5
  436. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/_grid.scss +56 -57
  437. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/_loadmask.scss +1 -1
  438. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/_menu.scss +22 -16
  439. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/_panel.scss +10 -4
  440. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/_progress-bar.scss +2 -1
  441. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/_qtip.scss +1 -1
  442. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/_slider.scss +9 -11
  443. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/_tab.scss +68 -43
  444. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/_tabbar.scss +1 -1
  445. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/_toolbar.scss +3 -3
  446. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/_tree.scss +48 -31
  447. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/form/_all.scss +4 -2
  448. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/form/_checkbox.scss +3 -2
  449. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/form/_checkboxgroup.scss +3 -2
  450. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/form/_field.scss +3 -3
  451. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/form/_fieldset.scss +1 -5
  452. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/form/_htmleditor.scss +16 -15
  453. data/public/stylesheets/extjs/resources/themes/stylesheets/ext4/default/widgets/form/_triggerfield.scss +10 -10
  454. data/public/stylesheets/extjs/resources/themes/templates/resources/sass/config.rb +2 -4
  455. data/public/stylesheets/extjs/resources/themes/templates/resources/sass/my-ext-theme.scss +1 -0
  456. data/public/stylesheets/sencha_touch/resources/css/android.css +1 -0
  457. data/public/stylesheets/sencha_touch/resources/css/apple.css +1 -0
  458. data/public/stylesheets/sencha_touch/resources/css/bb6.css +1 -0
  459. data/public/stylesheets/sencha_touch/resources/css/sencha-touch.css +1 -0
  460. data/public/stylesheets/sencha_touch/resources/css/touch-charts.css +1 -0
  461. data/public/stylesheets/sencha_touch/resources/css-debug/android.css +6757 -0
  462. data/public/stylesheets/sencha_touch/resources/css-debug/apple.css +6766 -0
  463. data/public/stylesheets/sencha_touch/resources/css-debug/bb6.css +6352 -0
  464. data/public/stylesheets/sencha_touch/resources/css-debug/sencha-touch.css +6755 -0
  465. data/public/stylesheets/sencha_touch/resources/images/icon1.png +0 -0
  466. data/public/stylesheets/sencha_touch/resources/images/icon2.png +0 -0
  467. data/public/stylesheets/sencha_touch/resources/images/icon3.png +0 -0
  468. data/public/stylesheets/sencha_touch/resources/images/icon4.png +0 -0
  469. data/public/stylesheets/sencha_touch/resources/images/welcome.png +0 -0
  470. data/public/stylesheets/sencha_touch/resources/sass/android.scss +37 -0
  471. data/public/stylesheets/sencha_touch/resources/sass/apple.scss +39 -0
  472. data/public/stylesheets/sencha_touch/resources/sass/bb6.scss +66 -0
  473. data/public/stylesheets/sencha_touch/resources/sass/config-debug.rb +11 -0
  474. data/public/stylesheets/sencha_touch/resources/sass/config.rb +11 -0
  475. data/public/stylesheets/sencha_touch/resources/sass/sencha-touch.scss +18 -0
  476. data/public/stylesheets/sencha_touch/resources/themes/compass_init.rb +6 -0
  477. data/public/stylesheets/sencha_touch/resources/themes/images/default/check.png +0 -0
  478. data/public/stylesheets/sencha_touch/resources/themes/images/default/clear_icon.png +0 -0
  479. data/public/stylesheets/sencha_touch/resources/themes/images/default/disclosure.png +0 -0
  480. data/public/stylesheets/sencha_touch/resources/themes/images/default/disclosure2.png +0 -0
  481. data/public/stylesheets/sencha_touch/resources/themes/images/default/dotgrid.png +0 -0
  482. data/public/stylesheets/sencha_touch/resources/themes/images/default/loading.gif +0 -0
  483. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/action.png +0 -0
  484. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/add.png +0 -0
  485. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/add1.png +0 -0
  486. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/add_black.png +0 -0
  487. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/address_book.png +0 -0
  488. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/arrow_down.png +0 -0
  489. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/arrow_left.png +0 -0
  490. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/arrow_right.png +0 -0
  491. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/arrow_up.png +0 -0
  492. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/at.png +0 -0
  493. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/atom.png +0 -0
  494. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/attachment.png +0 -0
  495. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/attachment2.png +0 -0
  496. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/attachment3.png +0 -0
  497. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/attachment_black.png +0 -0
  498. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/backspace.png +0 -0
  499. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/battery_full.png +0 -0
  500. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/battery_low.png +0 -0
  501. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/battery_power.png +0 -0
  502. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/blank.png +0 -0
  503. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/bolt.png +0 -0
  504. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/bolt_side.png +0 -0
  505. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/bookmark1.png +0 -0
  506. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/bookmark2.png +0 -0
  507. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/bookmark_black.png +0 -0
  508. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/bookmarks.png +0 -0
  509. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/briefcase1.png +0 -0
  510. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/briefcase2.png +0 -0
  511. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/brightness1.png +0 -0
  512. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/brightness2.png +0 -0
  513. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/broadcast.png +0 -0
  514. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/bug.png +0 -0
  515. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/bulb.png +0 -0
  516. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/bullseye1.png +0 -0
  517. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/bullseye2.png +0 -0
  518. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/calendar.png +0 -0
  519. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/calendar2.png +0 -0
  520. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/calendar_add.png +0 -0
  521. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/card1.png +0 -0
  522. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/card2.png +0 -0
  523. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/chart1.png +0 -0
  524. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/chart2.png +0 -0
  525. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/chart3.png +0 -0
  526. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/chat.png +0 -0
  527. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/chat1.png +0 -0
  528. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/chat2.png +0 -0
  529. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/chat3.png +0 -0
  530. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/chat4.png +0 -0
  531. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/chat_black1.png +0 -0
  532. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/chat_black2.png +0 -0
  533. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/check1.png +0 -0
  534. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/check2.png +0 -0
  535. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/check_black1.png +0 -0
  536. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/check_black2.png +0 -0
  537. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/check_dotted.png +0 -0
  538. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/circle.png +0 -0
  539. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/circle2.png +0 -0
  540. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/clash.png +0 -0
  541. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/cloud.png +0 -0
  542. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/cloud_black.png +0 -0
  543. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/cloud_black_upload1.png +0 -0
  544. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/cloud_black_upload2.png +0 -0
  545. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/cloud_bolt.png +0 -0
  546. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/cloud_download.png +0 -0
  547. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/code1.png +0 -0
  548. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/code2.png +0 -0
  549. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/code3.png +0 -0
  550. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/compass1.png +0 -0
  551. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/compass2.png +0 -0
  552. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/compass3.png +0 -0
  553. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/compose.png +0 -0
  554. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/compose1.png +0 -0
  555. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/compose2.png +0 -0
  556. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/compose3.png +0 -0
  557. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/compose_black.png +0 -0
  558. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/contract.png +0 -0
  559. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/cube.png +0 -0
  560. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/data.png +0 -0
  561. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/delete.png +0 -0
  562. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/delete1.png +0 -0
  563. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/delete_black1.png +0 -0
  564. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/delete_black2.png +0 -0
  565. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/doc.png +0 -0
  566. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/doc2.png +0 -0
  567. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/doc_black.png +0 -0
  568. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/doc_black_landscape.png +0 -0
  569. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/doc_compose1.png +0 -0
  570. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/doc_compose2.png +0 -0
  571. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/doc_delete.png +0 -0
  572. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/doc_down.png +0 -0
  573. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/doc_drawer.png +0 -0
  574. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/doc_list.png +0 -0
  575. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/doc_new.png +0 -0
  576. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/doc_send.png +0 -0
  577. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/doc_up.png +0 -0
  578. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/docs1.png +0 -0
  579. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/docs2.png +0 -0
  580. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/docs_black1.png +0 -0
  581. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/docs_black2.png +0 -0
  582. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/download.png +0 -0
  583. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/download1.png +0 -0
  584. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/download2.png +0 -0
  585. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/download_screen.png +0 -0
  586. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/eject.png +0 -0
  587. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/empty1.png +0 -0
  588. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/empty2.png +0 -0
  589. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/equalizer1.png +0 -0
  590. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/equalizer2.png +0 -0
  591. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/event_complete.png +0 -0
  592. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/expand.png +0 -0
  593. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/favorites.png +0 -0
  594. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/favorites1.png +0 -0
  595. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/favorites_circle.png +0 -0
  596. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/fforward.png +0 -0
  597. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/find.png +0 -0
  598. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/flag.png +0 -0
  599. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/flickr2.png +0 -0
  600. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/folder.png +0 -0
  601. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/folder_add.png +0 -0
  602. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/folder_black.png +0 -0
  603. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/folder_black_open.png +0 -0
  604. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/folder_delete.png +0 -0
  605. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/folder_delete2.png +0 -0
  606. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/folder_lock.png +0 -0
  607. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/folder_open2.png +0 -0
  608. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/font.png +0 -0
  609. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/forbidden.png +0 -0
  610. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/forward_black.png +0 -0
  611. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/globe1.png +0 -0
  612. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/globe2.png +0 -0
  613. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/globe_black.png +0 -0
  614. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/headphones.png +0 -0
  615. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/heart.png +0 -0
  616. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/heart_circle.png +0 -0
  617. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/help.png +0 -0
  618. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/help_black.png +0 -0
  619. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/home.png +0 -0
  620. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/home2.png +0 -0
  621. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/hot.png +0 -0
  622. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/inbox1.png +0 -0
  623. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/inbox2.png +0 -0
  624. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/inbox3.png +0 -0
  625. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/infinite.png +0 -0
  626. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/infinite2.png +0 -0
  627. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/info.png +0 -0
  628. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/info2.png +0 -0
  629. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/info_plain.png +0 -0
  630. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/info_plain2.png +0 -0
  631. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/json.png +0 -0
  632. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/lab.png +0 -0
  633. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/layout.png +0 -0
  634. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/link1.png +0 -0
  635. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/link2.png +0 -0
  636. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/link_black.png +0 -0
  637. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/list.png +0 -0
  638. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/locate.png +0 -0
  639. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/locate1.png +0 -0
  640. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/locate2.png +0 -0
  641. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/locate3.png +0 -0
  642. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/locate4.png +0 -0
  643. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/lock_closed.png +0 -0
  644. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/lock_open.png +0 -0
  645. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/look.png +0 -0
  646. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/loop.png +0 -0
  647. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/loop2.png +0 -0
  648. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/loop_circle.png +0 -0
  649. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/magic.png +0 -0
  650. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/mail.png +0 -0
  651. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/mail1.png +0 -0
  652. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/mail2.png +0 -0
  653. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/mail3.png +0 -0
  654. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/mail4.png +0 -0
  655. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/mail5.png +0 -0
  656. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/maps.png +0 -0
  657. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/mic.png +0 -0
  658. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/minus1.png +0 -0
  659. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/minus2.png +0 -0
  660. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/minus_black1.png +0 -0
  661. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/minus_black2.png +0 -0
  662. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/monitor1.png +0 -0
  663. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/monitor2.png +0 -0
  664. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/monitor3.png +0 -0
  665. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/monitor4.png +0 -0
  666. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/more.png +0 -0
  667. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/mouse.png +0 -0
  668. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/move.png +0 -0
  669. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/music1.png +0 -0
  670. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/music2.png +0 -0
  671. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/nodes1.png +0 -0
  672. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/nodes2.png +0 -0
  673. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/note1.png +0 -0
  674. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/note2.png +0 -0
  675. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/note3.png +0 -0
  676. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/note_black.png +0 -0
  677. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/nuclear.png +0 -0
  678. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/organize.png +0 -0
  679. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/outbox.png +0 -0
  680. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/pause.png +0 -0
  681. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/phone1.png +0 -0
  682. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/phone2.png +0 -0
  683. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/phone_black.png +0 -0
  684. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/phone_ring1.png +0 -0
  685. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/phone_ring2.png +0 -0
  686. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/photo1.png +0 -0
  687. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/photo2.png +0 -0
  688. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/photo3.png +0 -0
  689. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/photo_black1.png +0 -0
  690. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/photo_black2.png +0 -0
  691. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/photos1.png +0 -0
  692. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/photos2.png +0 -0
  693. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/photos4.png +0 -0
  694. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/piechart.png +0 -0
  695. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/play1.png +0 -0
  696. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/play2.png +0 -0
  697. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/play_black1.png +0 -0
  698. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/play_black2.png +0 -0
  699. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/podcast.png +0 -0
  700. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/power socket.png +0 -0
  701. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/power_on.png +0 -0
  702. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/print.png +0 -0
  703. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/print2.png +0 -0
  704. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/quote1.png +0 -0
  705. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/quote2.png +0 -0
  706. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/quote_black1.png +0 -0
  707. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/quote_black2.png +0 -0
  708. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/quote_black3.png +0 -0
  709. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/refresh.png +0 -0
  710. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/refresh1.png +0 -0
  711. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/refresh2.png +0 -0
  712. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/refresh3.png +0 -0
  713. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/refresh5.png +0 -0
  714. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/reply.png +0 -0
  715. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/replytoall.png +0 -0
  716. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/resize.png +0 -0
  717. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/resize_black.png +0 -0
  718. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/rewind.png +0 -0
  719. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/right.png +0 -0
  720. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/right2.png +0 -0
  721. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/rss.png +0 -0
  722. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/rss2.png +0 -0
  723. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/rss_black.png +0 -0
  724. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/rss_black1.png +0 -0
  725. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/rss_black2.png +0 -0
  726. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/screens.png +0 -0
  727. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/search.png +0 -0
  728. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/search1.png +0 -0
  729. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/search2.png +0 -0
  730. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/search_black.png +0 -0
  731. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/server.png +0 -0
  732. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/servers.png +0 -0
  733. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/settings.png +0 -0
  734. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/settings1.png +0 -0
  735. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/settings10.png +0 -0
  736. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/settings11.png +0 -0
  737. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/settings3.png +0 -0
  738. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/settings4.png +0 -0
  739. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/settings5.png +0 -0
  740. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/settings6.png +0 -0
  741. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/settings7.png +0 -0
  742. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/settings8.png +0 -0
  743. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/settings9.png +0 -0
  744. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/settings_black.png +0 -0
  745. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/share.png +0 -0
  746. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/shield1.png +0 -0
  747. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/shield2.png +0 -0
  748. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/shop1.png +0 -0
  749. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/shop2.png +0 -0
  750. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/shuffle.png +0 -0
  751. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/sign_backforth.png +0 -0
  752. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/sign_cross.png +0 -0
  753. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/sign_leftright.png +0 -0
  754. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/sign_leftright2.png +0 -0
  755. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/sign_split.png +0 -0
  756. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/sign_switch.png +0 -0
  757. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/sign_uturn.png +0 -0
  758. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/spaces1.png +0 -0
  759. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/spaces2.png +0 -0
  760. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/speedometer1.png +0 -0
  761. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/speedometer2.png +0 -0
  762. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/speedometer_black1.png +0 -0
  763. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/speedometer_black2.png +0 -0
  764. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/star.png +0 -0
  765. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/stop.png +0 -0
  766. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/stop1.png +0 -0
  767. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/stop2.png +0 -0
  768. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/sync.png +0 -0
  769. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/tabbed_book.png +0 -0
  770. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/tag.png +0 -0
  771. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/tag_black.png +0 -0
  772. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/tags.png +0 -0
  773. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/team.png +0 -0
  774. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/team1.png +0 -0
  775. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/time.png +0 -0
  776. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/time_repeat.png +0 -0
  777. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/trash.png +0 -0
  778. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/trash2.png +0 -0
  779. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/trash_black.png +0 -0
  780. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/tree.png +0 -0
  781. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/tv.png +0 -0
  782. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/tweak.png +0 -0
  783. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/twitter1.png +0 -0
  784. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/twitter2.png +0 -0
  785. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/up1.png +0 -0
  786. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/up2.png +0 -0
  787. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/up_black.png +0 -0
  788. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/upload2.png +0 -0
  789. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/user.png +0 -0
  790. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/user3.png +0 -0
  791. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/user_add.png +0 -0
  792. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/user_business.png +0 -0
  793. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/user_fave.png +0 -0
  794. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/user_list.png +0 -0
  795. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/user_list2.png +0 -0
  796. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/user_remote1.png +0 -0
  797. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/user_remove2.png +0 -0
  798. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/user_send.png +0 -0
  799. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/video.png +0 -0
  800. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/video_black1.png +0 -0
  801. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/video_black2.png +0 -0
  802. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/volume.png +0 -0
  803. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/volume_black.png +0 -0
  804. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/volume_down.png +0 -0
  805. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/volume_mute.png +0 -0
  806. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/volume_up.png +0 -0
  807. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/warming_dotted.png +0 -0
  808. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/warning_black.png +0 -0
  809. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/wifi.png +0 -0
  810. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/wifi2.png +0 -0
  811. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/wifi3.png +0 -0
  812. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/wifi4.png +0 -0
  813. data/public/stylesheets/sencha_touch/resources/themes/images/default/pictos/window.png +0 -0
  814. data/public/stylesheets/sencha_touch/resources/themes/images/default/pullarrow.png +0 -0
  815. data/public/stylesheets/sencha_touch/resources/themes/images/default/select_mask.png +0 -0
  816. data/public/stylesheets/sencha_touch/resources/themes/images/default/tip.png +0 -0
  817. data/public/stylesheets/sencha_touch/resources/themes/images/default/tip_horizontal.png +0 -0
  818. data/public/stylesheets/sencha_touch/resources/themes/images/default/tip_right.png +0 -0
  819. data/public/stylesheets/sencha_touch/resources/themes/images/default/togglebg.png +0 -0
  820. data/public/stylesheets/sencha_touch/resources/themes/images/default/togglemask.png +0 -0
  821. data/public/stylesheets/sencha_touch/resources/themes/images/default/togglethumb.png +0 -0
  822. data/public/stylesheets/sencha_touch/resources/themes/images/default/togglethumbbg.png +0 -0
  823. data/public/stylesheets/sencha_touch/resources/themes/images/default/togglethumbmask.png +0 -0
  824. data/public/stylesheets/sencha_touch/resources/themes/images/default/trackmask_outer.png +0 -0
  825. data/public/stylesheets/sencha_touch/resources/themes/lib/theme_images.rb +18 -0
  826. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/_all.scss +2 -0
  827. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/_core.scss +3 -0
  828. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/_global.scss +2 -0
  829. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/_mixins.scss +196 -0
  830. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/_variables.scss +116 -0
  831. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/_widgets.scss +16 -0
  832. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/core/_core.scss +189 -0
  833. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/core/_layout.scss +362 -0
  834. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/core/_reset.scss +62 -0
  835. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_buttons.scss +354 -0
  836. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_carousel.scss +113 -0
  837. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_form-sliders-basic.scss +102 -0
  838. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_form-sliders.scss +149 -0
  839. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_form.scss +608 -0
  840. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_img.scss +5 -0
  841. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_indexbar.scss +76 -0
  842. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_list.scss +401 -0
  843. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_loading-spinner.scss +121 -0
  844. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_map.scss +11 -0
  845. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_media.scss +21 -0
  846. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_msgbox.scss +94 -0
  847. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_panel.scss +79 -0
  848. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_picker.scss +154 -0
  849. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_sheets.scss +52 -0
  850. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_tabs.scss +269 -0
  851. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_toolbar-forms.scss +182 -0
  852. data/public/stylesheets/sencha_touch/resources/themes/stylesheets/sencha-touch/default/widgets/_toolbar.scss +156 -0
  853. data/public/stylesheets/sencha_touch/resources/themes/templates/project/manifest.rb +1 -0
  854. data/public/stylesheets/sencha_touch/resources/themes/templates/project/sencha-touch.scss +17 -0
  855. metadata +3251 -2688
  856. data/README.rdoc +0 -2
  857. data/config/initializers/erp_app.rb +0 -4
  858. data/lib/erp_app/extensions/active_record/acts_as_app_container.rb +0 -72
  859. data/lib/erp_app/extensions/railties/action_view.rb +0 -110
  860. data/lib/erp_app/widgets/railties/action_view.rb +0 -36
  861. data/lib/erp_app/widgets/railties/engine.rb +0 -55
  862. data/public/images/icons/add/Thumbs.db +0 -0
  863. data/public/images/icons/calendar/Thumbs.db +0 -0
  864. data/public/images/icons/copy/Thumbs.db +0 -0
  865. data/public/images/icons/cut/Thumbs.db +0 -0
  866. data/public/images/icons/delete/Thumbs.db +0 -0
  867. data/public/images/icons/edit/Thumbs.db +0 -0
  868. data/public/images/icons/folder/Thumbs.db +0 -0
  869. data/public/images/icons/gear/Thumbs.db +0 -0
  870. data/public/images/icons/globe/Thumbs.db +0 -0
  871. data/public/images/icons/grid/Thumbs.db +0 -0
  872. data/public/images/icons/help/Thumbs.db +0 -0
  873. data/public/images/icons/information/Thumbs.db +0 -0
  874. data/public/images/icons/key/Thumbs.db +0 -0
  875. data/public/images/icons/log_out/Thumbs.db +0 -0
  876. data/public/images/icons/mail/Thumbs.db +0 -0
  877. data/public/images/icons/new/Thumbs.db +0 -0
  878. data/public/images/icons/next/Thumbs.db +0 -0
  879. data/public/images/icons/open/Thumbs.db +0 -0
  880. data/public/images/icons/paste/Thumbs.db +0 -0
  881. data/public/images/icons/picture/Thumbs.db +0 -0
  882. data/public/images/icons/presentation/Thumbs.db +0 -0
  883. data/public/images/icons/preview/Thumbs.db +0 -0
  884. data/public/images/icons/previous/Thumbs.db +0 -0
  885. data/public/images/icons/print/Thumbs.db +0 -0
  886. data/public/images/icons/properties/Thumbs.db +0 -0
  887. data/public/images/icons/redo/Thumbs.db +0 -0
  888. data/public/images/icons/refresh/Thumbs.db +0 -0
  889. data/public/images/icons/remove/Thumbs.db +0 -0
  890. data/public/images/icons/rename/Thumbs.db +0 -0
  891. data/public/images/icons/save/Thumbs.db +0 -0
  892. data/public/images/icons/search/Thumbs.db +0 -0
  893. data/public/images/icons/send/Thumbs.db +0 -0
  894. data/public/images/icons/settings/Thumbs.db +0 -0
  895. data/public/images/icons/synchronize/Thumbs.db +0 -0
  896. data/public/images/icons/undo/Thumbs.db +0 -0
  897. data/public/images/icons/upload/Thumbs.db +0 -0
  898. data/public/images/icons/user/Thumbs.db +0 -0
  899. data/public/images/icons/zoom_in/Thumbs.db +0 -0
  900. data/public/images/icons/zoom_out/Thumbs.db +0 -0
  901. data/public/javascripts/erp_app/ckeditor/plugins/jwplayer/jwplayer/Thumbs.db +0 -0
  902. data/public/javascripts/erp_app/shared/ajax_pagination.js +0 -33
  903. data/public/stylesheets/extjs/resources/themes/images/access/tab-bar/tab-bar-bg.png +0 -0
  904. data/public/stylesheets/extjs/resources/themes/templates/resources/css/my-ext-theme.css +0 -59
  905. data/spec/dummy/db/schema.rb +0 -709
  906. data/spec/dummy/db/spec.sqlite3 +0 -0
  907. data/spec/dummy/log/RAILS_ENV=spec.log +0 -0
  908. data/spec/dummy/log/development.log +0 -0
  909. data/spec/dummy/log/spec.log +0 -52150
@@ -0,0 +1,1670 @@
1
+ /* The Editor object manages the content of the editable frame. It
2
+ * catches events, colours nodes, and indents lines. This file also
3
+ * holds some functions for transforming arbitrary DOM structures into
4
+ * plain sequences of <span> and <br> elements
5
+ */
6
+
7
+ var internetExplorer = document.selection && window.ActiveXObject && /MSIE/.test(navigator.userAgent);
8
+ var webkit = /AppleWebKit/.test(navigator.userAgent);
9
+ var safari = /Apple Computer, Inc/.test(navigator.vendor);
10
+ var gecko = navigator.userAgent.match(/gecko\/(\d{8})/i);
11
+ if (gecko) gecko = Number(gecko[1]);
12
+ var mac = /Mac/.test(navigator.platform);
13
+
14
+ // TODO this is related to the backspace-at-end-of-line bug. Remove
15
+ // this if Opera gets their act together, make the version check more
16
+ // broad if they don't.
17
+ var brokenOpera = window.opera && /Version\/10.[56]/.test(navigator.userAgent);
18
+ // TODO remove this once WebKit 533 becomes less common.
19
+ var slowWebkit = /AppleWebKit\/533/.test(navigator.userAgent);
20
+
21
+ // Make sure a string does not contain two consecutive 'collapseable'
22
+ // whitespace characters.
23
+ function makeWhiteSpace(n) {
24
+ var buffer = [], nb = true;
25
+ for (; n > 0; n--) {
26
+ buffer.push((nb || n == 1) ? nbsp : " ");
27
+ nb ^= true;
28
+ }
29
+ return buffer.join("");
30
+ }
31
+
32
+ // Create a set of white-space characters that will not be collapsed
33
+ // by the browser, but will not break text-wrapping either.
34
+ function fixSpaces(string) {
35
+ if (string.charAt(0) == " ") string = nbsp + string.slice(1);
36
+ return string.replace(/\t/g, function() {return makeWhiteSpace(indentUnit);})
37
+ .replace(/[ \u00a0]{2,}/g, function(s) {return makeWhiteSpace(s.length);});
38
+ }
39
+
40
+ function cleanText(text) {
41
+ return text.replace(/\u00a0/g, " ").replace(/\u200b/g, "");
42
+ }
43
+
44
+ // Create a SPAN node with the expected properties for document part
45
+ // spans.
46
+ function makePartSpan(value) {
47
+ var text = value;
48
+ if (value.nodeType == 3) text = value.nodeValue;
49
+ else value = document.createTextNode(text);
50
+
51
+ var span = document.createElement("span");
52
+ span.isPart = true;
53
+ span.appendChild(value);
54
+ span.currentText = text;
55
+ return span;
56
+ }
57
+
58
+ function alwaysZero() {return 0;}
59
+
60
+ // On webkit, when the last BR of the document does not have text
61
+ // behind it, the cursor can not be put on the line after it. This
62
+ // makes pressing enter at the end of the document occasionally do
63
+ // nothing (or at least seem to do nothing). To work around it, this
64
+ // function makes sure the document ends with a span containing a
65
+ // zero-width space character. The traverseDOM iterator filters such
66
+ // character out again, so that the parsers won't see them. This
67
+ // function is called from a few strategic places to make sure the
68
+ // zwsp is restored after the highlighting process eats it.
69
+ var webkitLastLineHack = webkit ?
70
+ function(container) {
71
+ var last = container.lastChild;
72
+ if (!last || !last.hackBR) {
73
+ var br = document.createElement("br");
74
+ br.hackBR = true;
75
+ container.appendChild(br);
76
+ }
77
+ } : function() {};
78
+
79
+ function asEditorLines(string) {
80
+ var tab = makeWhiteSpace(indentUnit);
81
+ return map(string.replace(/\t/g, tab).replace(/\u00a0/g, " ").replace(/\r\n?/g, "\n").split("\n"), fixSpaces);
82
+ }
83
+
84
+ var Editor = (function(){
85
+ // The HTML elements whose content should be suffixed by a newline
86
+ // when converting them to flat text.
87
+ var newlineElements = {"P": true, "DIV": true, "LI": true};
88
+
89
+ // Helper function for traverseDOM. Flattens an arbitrary DOM node
90
+ // into an array of textnodes and <br> tags.
91
+ function simplifyDOM(root, atEnd) {
92
+ var result = [];
93
+ var leaving = true;
94
+
95
+ function simplifyNode(node, top) {
96
+ if (node.nodeType == 3) {
97
+ var text = node.nodeValue = fixSpaces(node.nodeValue.replace(/[\r\u200b]/g, "").replace(/\n/g, " "));
98
+ if (text.length) leaving = false;
99
+ result.push(node);
100
+ }
101
+ else if (isBR(node) && node.childNodes.length == 0) {
102
+ leaving = true;
103
+ result.push(node);
104
+ }
105
+ else {
106
+ for (var n = node.firstChild; n; n = n.nextSibling) simplifyNode(n);
107
+ if (!leaving && newlineElements.hasOwnProperty(node.nodeName.toUpperCase())) {
108
+ leaving = true;
109
+ if (!atEnd || !top)
110
+ result.push(document.createElement("br"));
111
+ }
112
+ }
113
+ }
114
+
115
+ simplifyNode(root, true);
116
+ return result;
117
+ }
118
+
119
+ // Creates a MochiKit-style iterator that goes over a series of DOM
120
+ // nodes. The values it yields are strings, the textual content of
121
+ // the nodes. It makes sure that all nodes up to and including the
122
+ // one whose text is being yielded have been 'normalized' to be just
123
+ // <span> and <br> elements.
124
+ function traverseDOM(start){
125
+ var nodeQueue = [];
126
+
127
+ // Create a function that can be used to insert nodes after the
128
+ // one given as argument.
129
+ function pointAt(node){
130
+ var parent = node.parentNode;
131
+ var next = node.nextSibling;
132
+ return function(newnode) {
133
+ parent.insertBefore(newnode, next);
134
+ };
135
+ }
136
+ var point = null;
137
+
138
+ // This an Opera-specific hack -- always insert an empty span
139
+ // between two BRs, because Opera's cursor code gets terribly
140
+ // confused when the cursor is between two BRs.
141
+ var afterBR = true;
142
+
143
+ // Insert a normalized node at the current point. If it is a text
144
+ // node, wrap it in a <span>, and give that span a currentText
145
+ // property -- this is used to cache the nodeValue, because
146
+ // directly accessing nodeValue is horribly slow on some browsers.
147
+ // The dirty property is used by the highlighter to determine
148
+ // which parts of the document have to be re-highlighted.
149
+ function insertPart(part){
150
+ var text = "\n";
151
+ if (part.nodeType == 3) {
152
+ select.snapshotChanged();
153
+ part = makePartSpan(part);
154
+ text = part.currentText;
155
+ afterBR = false;
156
+ }
157
+ else {
158
+ if (afterBR && window.opera)
159
+ point(makePartSpan(""));
160
+ afterBR = true;
161
+ }
162
+ part.dirty = true;
163
+ nodeQueue.push(part);
164
+ point(part);
165
+ return text;
166
+ }
167
+
168
+ // Extract the text and newlines from a DOM node, insert them into
169
+ // the document, and return the textual content. Used to replace
170
+ // non-normalized nodes.
171
+ function writeNode(node, end) {
172
+ var simplified = simplifyDOM(node, end);
173
+ for (var i = 0; i < simplified.length; i++)
174
+ simplified[i] = insertPart(simplified[i]);
175
+ return simplified.join("");
176
+ }
177
+
178
+ // Check whether a node is a normalized <span> element.
179
+ function partNode(node){
180
+ if (node.isPart && node.childNodes.length == 1 && node.firstChild.nodeType == 3) {
181
+ var text = node.firstChild.nodeValue;
182
+ node.dirty = node.dirty || text != node.currentText;
183
+ node.currentText = text;
184
+ return !/[\n\t\r]/.test(node.currentText);
185
+ }
186
+ return false;
187
+ }
188
+
189
+ // Advance to next node, return string for current node.
190
+ function next() {
191
+ if (!start) throw StopIteration;
192
+ var node = start;
193
+ start = node.nextSibling;
194
+
195
+ if (partNode(node)){
196
+ nodeQueue.push(node);
197
+ afterBR = false;
198
+ return node.currentText;
199
+ }
200
+ else if (isBR(node)) {
201
+ if (afterBR && window.opera)
202
+ node.parentNode.insertBefore(makePartSpan(""), node);
203
+ nodeQueue.push(node);
204
+ afterBR = true;
205
+ return "\n";
206
+ }
207
+ else {
208
+ var end = !node.nextSibling;
209
+ point = pointAt(node);
210
+ removeElement(node);
211
+ return writeNode(node, end);
212
+ }
213
+ }
214
+
215
+ // MochiKit iterators are objects with a next function that
216
+ // returns the next value or throws StopIteration when there are
217
+ // no more values.
218
+ return {next: next, nodes: nodeQueue};
219
+ }
220
+
221
+ // Determine the text size of a processed node.
222
+ function nodeSize(node) {
223
+ return isBR(node) ? 1 : node.currentText.length;
224
+ }
225
+
226
+ // Search backwards through the top-level nodes until the next BR or
227
+ // the start of the frame.
228
+ function startOfLine(node) {
229
+ while (node && !isBR(node)) node = node.previousSibling;
230
+ return node;
231
+ }
232
+ function endOfLine(node, container) {
233
+ if (!node) node = container.firstChild;
234
+ else if (isBR(node)) node = node.nextSibling;
235
+
236
+ while (node && !isBR(node)) node = node.nextSibling;
237
+ return node;
238
+ }
239
+
240
+ function time() {return new Date().getTime();}
241
+
242
+ // Client interface for searching the content of the editor. Create
243
+ // these by calling CodeMirror.getSearchCursor. To use, call
244
+ // findNext on the resulting object -- this returns a boolean
245
+ // indicating whether anything was found, and can be called again to
246
+ // skip to the next find. Use the select and replace methods to
247
+ // actually do something with the found locations.
248
+ function SearchCursor(editor, pattern, from, caseFold) {
249
+ this.editor = editor;
250
+ this.history = editor.history;
251
+ this.history.commit();
252
+ this.valid = !!pattern;
253
+ this.atOccurrence = false;
254
+ if (caseFold == undefined) caseFold = typeof pattern == "string" && pattern == pattern.toLowerCase();
255
+
256
+ function getText(node){
257
+ var line = cleanText(editor.history.textAfter(node));
258
+ return (caseFold ? line.toLowerCase() : line);
259
+ }
260
+
261
+ var topPos = {node: null, offset: 0}, self = this;
262
+ if (from && typeof from == "object" && typeof from.character == "number") {
263
+ editor.checkLine(from.line);
264
+ var pos = {node: from.line, offset: from.character};
265
+ this.pos = {from: pos, to: pos};
266
+ }
267
+ else if (from) {
268
+ this.pos = {from: select.cursorPos(editor.container, true) || topPos,
269
+ to: select.cursorPos(editor.container, false) || topPos};
270
+ }
271
+ else {
272
+ this.pos = {from: topPos, to: topPos};
273
+ }
274
+
275
+ if (typeof pattern != "string") { // Regexp match
276
+ this.matches = function(reverse, node, offset) {
277
+ if (reverse) {
278
+ var line = getText(node).slice(0, offset), match = line.match(pattern), start = 0;
279
+ while (match) {
280
+ var ind = line.indexOf(match[0]);
281
+ start += ind;
282
+ line = line.slice(ind + 1);
283
+ var newmatch = line.match(pattern);
284
+ if (newmatch) match = newmatch;
285
+ else break;
286
+ }
287
+ }
288
+ else {
289
+ var line = getText(node).slice(offset), match = line.match(pattern),
290
+ start = match && offset + line.indexOf(match[0]);
291
+ }
292
+ if (match) {
293
+ self.currentMatch = match;
294
+ return {from: {node: node, offset: start},
295
+ to: {node: node, offset: start + match[0].length}};
296
+ }
297
+ };
298
+ return;
299
+ }
300
+
301
+ if (caseFold) pattern = pattern.toLowerCase();
302
+ // Create a matcher function based on the kind of string we have.
303
+ var target = pattern.split("\n");
304
+ this.matches = (target.length == 1) ?
305
+ // For one-line strings, searching can be done simply by calling
306
+ // indexOf or lastIndexOf on the current line.
307
+ function(reverse, node, offset) {
308
+ var line = getText(node), len = pattern.length, match;
309
+ if (reverse ? (offset >= len && (match = line.lastIndexOf(pattern, offset - len)) != -1)
310
+ : (match = line.indexOf(pattern, offset)) != -1)
311
+ return {from: {node: node, offset: match},
312
+ to: {node: node, offset: match + len}};
313
+ } :
314
+ // Multi-line strings require internal iteration over lines, and
315
+ // some clunky checks to make sure the first match ends at the
316
+ // end of the line and the last match starts at the start.
317
+ function(reverse, node, offset) {
318
+ var idx = (reverse ? target.length - 1 : 0), match = target[idx], line = getText(node);
319
+ var offsetA = (reverse ? line.indexOf(match) + match.length : line.lastIndexOf(match));
320
+ if (reverse ? offsetA >= offset || offsetA != match.length
321
+ : offsetA <= offset || offsetA != line.length - match.length)
322
+ return;
323
+
324
+ var pos = node;
325
+ while (true) {
326
+ if (reverse && !pos) return;
327
+ pos = (reverse ? this.history.nodeBefore(pos) : this.history.nodeAfter(pos) );
328
+ if (!reverse && !pos) return;
329
+
330
+ line = getText(pos);
331
+ match = target[reverse ? --idx : ++idx];
332
+
333
+ if (idx > 0 && idx < target.length - 1) {
334
+ if (line != match) return;
335
+ else continue;
336
+ }
337
+ var offsetB = (reverse ? line.lastIndexOf(match) : line.indexOf(match) + match.length);
338
+ if (reverse ? offsetB != line.length - match.length : offsetB != match.length)
339
+ return;
340
+ return {from: {node: reverse ? pos : node, offset: reverse ? offsetB : offsetA},
341
+ to: {node: reverse ? node : pos, offset: reverse ? offsetA : offsetB}};
342
+ }
343
+ };
344
+ }
345
+
346
+ SearchCursor.prototype = {
347
+ findNext: function() {return this.find(false);},
348
+ findPrevious: function() {return this.find(true);},
349
+
350
+ find: function(reverse) {
351
+ if (!this.valid) return false;
352
+
353
+ var self = this, pos = reverse ? this.pos.from : this.pos.to,
354
+ node = pos.node, offset = pos.offset;
355
+ // Reset the cursor if the current line is no longer in the DOM tree.
356
+ if (node && !node.parentNode) {
357
+ node = null; offset = 0;
358
+ }
359
+ function savePosAndFail() {
360
+ var pos = {node: node, offset: offset};
361
+ self.pos = {from: pos, to: pos};
362
+ self.atOccurrence = false;
363
+ return false;
364
+ }
365
+
366
+ while (true) {
367
+ if (this.pos = this.matches(reverse, node, offset)) {
368
+ this.atOccurrence = true;
369
+ return true;
370
+ }
371
+
372
+ if (reverse) {
373
+ if (!node) return savePosAndFail();
374
+ node = this.history.nodeBefore(node);
375
+ offset = this.history.textAfter(node).length;
376
+ }
377
+ else {
378
+ var next = this.history.nodeAfter(node);
379
+ if (!next) {
380
+ offset = this.history.textAfter(node).length;
381
+ return savePosAndFail();
382
+ }
383
+ node = next;
384
+ offset = 0;
385
+ }
386
+ }
387
+ },
388
+
389
+ select: function() {
390
+ if (this.atOccurrence) {
391
+ select.setCursorPos(this.editor.container, this.pos.from, this.pos.to);
392
+ select.scrollToCursor(this.editor.container);
393
+ }
394
+ },
395
+
396
+ replace: function(string) {
397
+ if (this.atOccurrence) {
398
+ var fragments = this.currentMatch;
399
+ if (fragments)
400
+ string = string.replace(/\\(\d)/, function(m, i){return fragments[i];});
401
+ var end = this.editor.replaceRange(this.pos.from, this.pos.to, string);
402
+ this.pos.to = end;
403
+ this.atOccurrence = false;
404
+ }
405
+ },
406
+
407
+ position: function() {
408
+ if (this.atOccurrence)
409
+ return {line: this.pos.from.node, character: this.pos.from.offset};
410
+ }
411
+ };
412
+
413
+ // The Editor object is the main inside-the-iframe interface.
414
+ function Editor(options) {
415
+ this.options = options;
416
+ window.indentUnit = options.indentUnit;
417
+ var container = this.container = document.body;
418
+ this.history = new UndoHistory(container, options.undoDepth, options.undoDelay, this);
419
+ var self = this;
420
+
421
+ if (!Editor.Parser)
422
+ throw "No parser loaded.";
423
+ if (options.parserConfig && Editor.Parser.configure)
424
+ Editor.Parser.configure(options.parserConfig);
425
+
426
+ if (!options.readOnly && !internetExplorer)
427
+ select.setCursorPos(container, {node: null, offset: 0});
428
+
429
+ this.dirty = [];
430
+ this.importCode(options.content || "");
431
+ this.history.onChange = options.onChange;
432
+
433
+ if (!options.readOnly) {
434
+ if (options.continuousScanning !== false) {
435
+ this.scanner = this.documentScanner(options.passTime);
436
+ this.delayScanning();
437
+ }
438
+
439
+ function setEditable() {
440
+ // Use contentEditable instead of designMode on IE, since designMode frames
441
+ // can not run any scripts. It would be nice if we could use contentEditable
442
+ // everywhere, but it is significantly flakier than designMode on every
443
+ // single non-IE browser.
444
+ if (document.body.contentEditable != undefined && internetExplorer)
445
+ document.body.contentEditable = "true";
446
+ else
447
+ document.designMode = "on";
448
+
449
+ // Work around issue where you have to click on the actual
450
+ // body of the document to focus it in IE, making focusing
451
+ // hard when the document is small.
452
+ if (internetExplorer && options.height != "dynamic")
453
+ document.body.style.minHeight = (
454
+ window.frameElement.clientHeight - 2 * document.body.offsetTop - 5) + "px";
455
+
456
+ document.documentElement.style.borderWidth = "0";
457
+ if (!options.textWrapping)
458
+ container.style.whiteSpace = "nowrap";
459
+ }
460
+
461
+ // If setting the frame editable fails, try again when the user
462
+ // focus it (happens when the frame is not visible on
463
+ // initialisation, in Firefox).
464
+ try {
465
+ setEditable();
466
+ }
467
+ catch(e) {
468
+ var focusEvent = addEventHandler(document, "focus", function() {
469
+ focusEvent();
470
+ setEditable();
471
+ }, true);
472
+ }
473
+
474
+ addEventHandler(document, "keydown", method(this, "keyDown"));
475
+ addEventHandler(document, "keypress", method(this, "keyPress"));
476
+ addEventHandler(document, "keyup", method(this, "keyUp"));
477
+
478
+ function cursorActivity() {self.cursorActivity(false);}
479
+ addEventHandler(internetExplorer ? document.body : window, "mouseup", cursorActivity);
480
+ addEventHandler(document.body, "cut", cursorActivity);
481
+
482
+ // workaround for a gecko bug [?] where going forward and then
483
+ // back again breaks designmode (no more cursor)
484
+ if (gecko)
485
+ addEventHandler(window, "pagehide", function(){self.unloaded = true;});
486
+
487
+ addEventHandler(document.body, "paste", function(event) {
488
+ cursorActivity();
489
+ var text = null;
490
+ try {
491
+ var clipboardData = event.clipboardData || window.clipboardData;
492
+ if (clipboardData) text = clipboardData.getData('Text');
493
+ }
494
+ catch(e) {}
495
+ if (text !== null) {
496
+ event.stop();
497
+ self.replaceSelection(text);
498
+ select.scrollToCursor(self.container);
499
+ }
500
+ });
501
+
502
+ if (this.options.autoMatchParens)
503
+ addEventHandler(document.body, "click", method(this, "scheduleParenHighlight"));
504
+ }
505
+ else if (!options.textWrapping) {
506
+ container.style.whiteSpace = "nowrap";
507
+ }
508
+ }
509
+
510
+ function isSafeKey(code) {
511
+ return (code >= 16 && code <= 18) || // shift, control, alt
512
+ (code >= 33 && code <= 40); // arrows, home, end
513
+ }
514
+
515
+ Editor.prototype = {
516
+ // Import a piece of code into the editor.
517
+ importCode: function(code) {
518
+ var lines = asEditorLines(code), chunk = 1000;
519
+ if (!this.options.incrementalLoading || lines.length < chunk) {
520
+ this.history.push(null, null, lines);
521
+ this.history.reset();
522
+ }
523
+ else {
524
+ var cur = 0, self = this;
525
+ function addChunk() {
526
+ var chunklines = lines.slice(cur, cur + chunk);
527
+ chunklines.push("");
528
+ self.history.push(self.history.nodeBefore(null), null, chunklines);
529
+ self.history.reset();
530
+ cur += chunk;
531
+ if (cur < lines.length)
532
+ parent.setTimeout(addChunk, 1000);
533
+ }
534
+ addChunk();
535
+ }
536
+ },
537
+
538
+ // Extract the code from the editor.
539
+ getCode: function() {
540
+ if (!this.container.firstChild)
541
+ return "";
542
+
543
+ var accum = [];
544
+ select.markSelection();
545
+ forEach(traverseDOM(this.container.firstChild), method(accum, "push"));
546
+ select.selectMarked();
547
+ // On webkit, don't count last (empty) line if the webkitLastLineHack BR is present
548
+ if (webkit && this.container.lastChild.hackBR)
549
+ accum.pop();
550
+ webkitLastLineHack(this.container);
551
+ return cleanText(accum.join(""));
552
+ },
553
+
554
+ checkLine: function(node) {
555
+ if (node === false || !(node == null || node.parentNode == this.container || node.hackBR))
556
+ throw parent.CodeMirror.InvalidLineHandle;
557
+ },
558
+
559
+ cursorPosition: function(start) {
560
+ if (start == null) start = true;
561
+ var pos = select.cursorPos(this.container, start);
562
+ if (pos) return {line: pos.node, character: pos.offset};
563
+ else return {line: null, character: 0};
564
+ },
565
+
566
+ firstLine: function() {
567
+ return null;
568
+ },
569
+
570
+ lastLine: function() {
571
+ var last = this.container.lastChild;
572
+ if (last) last = startOfLine(last);
573
+ if (last && last.hackBR) last = startOfLine(last.previousSibling);
574
+ return last;
575
+ },
576
+
577
+ nextLine: function(line) {
578
+ this.checkLine(line);
579
+ var end = endOfLine(line, this.container);
580
+ if (!end || end.hackBR) return false;
581
+ else return end;
582
+ },
583
+
584
+ prevLine: function(line) {
585
+ this.checkLine(line);
586
+ if (line == null) return false;
587
+ return startOfLine(line.previousSibling);
588
+ },
589
+
590
+ visibleLineCount: function() {
591
+ var line = this.container.firstChild;
592
+ while (line && isBR(line)) line = line.nextSibling; // BR heights are unreliable
593
+ if (!line) return false;
594
+ var innerHeight = (window.innerHeight
595
+ || document.documentElement.clientHeight
596
+ || document.body.clientHeight);
597
+ return Math.floor(innerHeight / line.offsetHeight);
598
+ },
599
+
600
+ selectLines: function(startLine, startOffset, endLine, endOffset) {
601
+ this.checkLine(startLine);
602
+ var start = {node: startLine, offset: startOffset}, end = null;
603
+ if (endOffset !== undefined) {
604
+ this.checkLine(endLine);
605
+ end = {node: endLine, offset: endOffset};
606
+ }
607
+ select.setCursorPos(this.container, start, end);
608
+ select.scrollToCursor(this.container);
609
+ },
610
+
611
+ lineContent: function(line) {
612
+ var accum = [];
613
+ for (line = line ? line.nextSibling : this.container.firstChild;
614
+ line && !isBR(line); line = line.nextSibling)
615
+ accum.push(nodeText(line));
616
+ return cleanText(accum.join(""));
617
+ },
618
+
619
+ setLineContent: function(line, content) {
620
+ this.history.commit();
621
+ this.replaceRange({node: line, offset: 0},
622
+ {node: line, offset: this.history.textAfter(line).length},
623
+ content);
624
+ this.addDirtyNode(line);
625
+ this.scheduleHighlight();
626
+ },
627
+
628
+ removeLine: function(line) {
629
+ var node = line ? line.nextSibling : this.container.firstChild;
630
+ while (node) {
631
+ var next = node.nextSibling;
632
+ removeElement(node);
633
+ if (isBR(node)) break;
634
+ node = next;
635
+ }
636
+ this.addDirtyNode(line);
637
+ this.scheduleHighlight();
638
+ },
639
+
640
+ insertIntoLine: function(line, position, content) {
641
+ var before = null;
642
+ if (position == "end") {
643
+ before = endOfLine(line, this.container);
644
+ }
645
+ else {
646
+ for (var cur = line ? line.nextSibling : this.container.firstChild; cur; cur = cur.nextSibling) {
647
+ if (position == 0) {
648
+ before = cur;
649
+ break;
650
+ }
651
+ var text = nodeText(cur);
652
+ if (text.length > position) {
653
+ before = cur.nextSibling;
654
+ content = text.slice(0, position) + content + text.slice(position);
655
+ removeElement(cur);
656
+ break;
657
+ }
658
+ position -= text.length;
659
+ }
660
+ }
661
+
662
+ var lines = asEditorLines(content);
663
+ for (var i = 0; i < lines.length; i++) {
664
+ if (i > 0) this.container.insertBefore(document.createElement("BR"), before);
665
+ this.container.insertBefore(makePartSpan(lines[i]), before);
666
+ }
667
+ this.addDirtyNode(line);
668
+ this.scheduleHighlight();
669
+ },
670
+
671
+ // Retrieve the selected text.
672
+ selectedText: function() {
673
+ var h = this.history;
674
+ h.commit();
675
+
676
+ var start = select.cursorPos(this.container, true),
677
+ end = select.cursorPos(this.container, false);
678
+ if (!start || !end) return "";
679
+
680
+ if (start.node == end.node)
681
+ return h.textAfter(start.node).slice(start.offset, end.offset);
682
+
683
+ var text = [h.textAfter(start.node).slice(start.offset)];
684
+ for (var pos = h.nodeAfter(start.node); pos != end.node; pos = h.nodeAfter(pos))
685
+ text.push(h.textAfter(pos));
686
+ text.push(h.textAfter(end.node).slice(0, end.offset));
687
+ return cleanText(text.join("\n"));
688
+ },
689
+
690
+ // Replace the selection with another piece of text.
691
+ replaceSelection: function(text) {
692
+ this.history.commit();
693
+
694
+ var start = select.cursorPos(this.container, true),
695
+ end = select.cursorPos(this.container, false);
696
+ if (!start || !end) return;
697
+
698
+ end = this.replaceRange(start, end, text);
699
+ select.setCursorPos(this.container, end);
700
+ webkitLastLineHack(this.container);
701
+ },
702
+
703
+ cursorCoords: function(start, internal) {
704
+ var sel = select.cursorPos(this.container, start);
705
+ if (!sel) return null;
706
+ var off = sel.offset, node = sel.node, self = this;
707
+ function measureFromNode(node, xOffset) {
708
+ var y = -(document.body.scrollTop || document.documentElement.scrollTop || 0),
709
+ x = -(document.body.scrollLeft || document.documentElement.scrollLeft || 0) + xOffset;
710
+ forEach([node, internal ? null : window.frameElement], function(n) {
711
+ while (n) {x += n.offsetLeft; y += n.offsetTop;n = n.offsetParent;}
712
+ });
713
+ return {x: x, y: y, yBot: y + node.offsetHeight};
714
+ }
715
+ function withTempNode(text, f) {
716
+ var node = document.createElement("SPAN");
717
+ node.appendChild(document.createTextNode(text));
718
+ try {return f(node);}
719
+ finally {if (node.parentNode) node.parentNode.removeChild(node);}
720
+ }
721
+
722
+ while (off) {
723
+ node = node ? node.nextSibling : this.container.firstChild;
724
+ var txt = nodeText(node);
725
+ if (off < txt.length)
726
+ return withTempNode(txt.substr(0, off), function(tmp) {
727
+ tmp.style.position = "absolute"; tmp.style.visibility = "hidden";
728
+ tmp.className = node.className;
729
+ self.container.appendChild(tmp);
730
+ return measureFromNode(node, tmp.offsetWidth);
731
+ });
732
+ off -= txt.length;
733
+ }
734
+ if (node && isSpan(node))
735
+ return measureFromNode(node, node.offsetWidth);
736
+ else if (node && node.nextSibling && isSpan(node.nextSibling))
737
+ return measureFromNode(node.nextSibling, 0);
738
+ else
739
+ return withTempNode("\u200b", function(tmp) {
740
+ if (node) node.parentNode.insertBefore(tmp, node.nextSibling);
741
+ else self.container.insertBefore(tmp, self.container.firstChild);
742
+ return measureFromNode(tmp, 0);
743
+ });
744
+ },
745
+
746
+ reroutePasteEvent: function() {
747
+ if (this.capturingPaste || window.opera || (gecko && gecko >= 20101026)) return;
748
+ this.capturingPaste = true;
749
+ var te = window.frameElement.CodeMirror.textareaHack;
750
+ var coords = this.cursorCoords(true, true);
751
+ te.style.top = coords.y + "px";
752
+ if (internetExplorer) {
753
+ var snapshot = select.getBookmark(this.container);
754
+ if (snapshot) this.selectionSnapshot = snapshot;
755
+ }
756
+ parent.focus();
757
+ te.value = "";
758
+ te.focus();
759
+
760
+ var self = this;
761
+ parent.setTimeout(function() {
762
+ self.capturingPaste = false;
763
+ window.focus();
764
+ if (self.selectionSnapshot) // IE hack
765
+ window.select.setBookmark(self.container, self.selectionSnapshot);
766
+ var text = te.value;
767
+ if (text) {
768
+ self.replaceSelection(text);
769
+ select.scrollToCursor(self.container);
770
+ }
771
+ }, 10);
772
+ },
773
+
774
+ replaceRange: function(from, to, text) {
775
+ var lines = asEditorLines(text);
776
+ lines[0] = this.history.textAfter(from.node).slice(0, from.offset) + lines[0];
777
+ var lastLine = lines[lines.length - 1];
778
+ lines[lines.length - 1] = lastLine + this.history.textAfter(to.node).slice(to.offset);
779
+ var end = this.history.nodeAfter(to.node);
780
+ this.history.push(from.node, end, lines);
781
+ return {node: this.history.nodeBefore(end),
782
+ offset: lastLine.length};
783
+ },
784
+
785
+ getSearchCursor: function(string, fromCursor, caseFold) {
786
+ return new SearchCursor(this, string, fromCursor, caseFold);
787
+ },
788
+
789
+ // Re-indent the whole buffer
790
+ reindent: function() {
791
+ if (this.container.firstChild)
792
+ this.indentRegion(null, this.container.lastChild);
793
+ },
794
+
795
+ reindentSelection: function(direction) {
796
+ if (!select.somethingSelected()) {
797
+ this.indentAtCursor(direction);
798
+ }
799
+ else {
800
+ var start = select.selectionTopNode(this.container, true),
801
+ end = select.selectionTopNode(this.container, false);
802
+ if (start === false || end === false) return;
803
+ this.indentRegion(start, end, direction);
804
+ }
805
+ },
806
+
807
+ grabKeys: function(eventHandler, filter) {
808
+ this.frozen = eventHandler;
809
+ this.keyFilter = filter;
810
+ },
811
+ ungrabKeys: function() {
812
+ this.frozen = "leave";
813
+ },
814
+
815
+ setParser: function(name, parserConfig) {
816
+ Editor.Parser = window[name];
817
+ parserConfig = parserConfig || this.options.parserConfig;
818
+ if (parserConfig && Editor.Parser.configure)
819
+ Editor.Parser.configure(parserConfig);
820
+
821
+ if (this.container.firstChild) {
822
+ forEach(this.container.childNodes, function(n) {
823
+ if (n.nodeType != 3) n.dirty = true;
824
+ });
825
+ this.addDirtyNode(this.firstChild);
826
+ this.scheduleHighlight();
827
+ }
828
+ },
829
+
830
+ // Intercept enter and tab, and assign their new functions.
831
+ keyDown: function(event) {
832
+ if (this.frozen == "leave") {this.frozen = null; this.keyFilter = null;}
833
+ if (this.frozen && (!this.keyFilter || this.keyFilter(event.keyCode, event))) {
834
+ event.stop();
835
+ this.frozen(event);
836
+ return;
837
+ }
838
+
839
+ var code = event.keyCode;
840
+ // Don't scan when the user is typing.
841
+ this.delayScanning();
842
+ // Schedule a paren-highlight event, if configured.
843
+ if (this.options.autoMatchParens)
844
+ this.scheduleParenHighlight();
845
+
846
+ // The various checks for !altKey are there because AltGr sets both
847
+ // ctrlKey and altKey to true, and should not be recognised as
848
+ // Control.
849
+ if (code == 13) { // enter
850
+ if (event.ctrlKey && !event.altKey) {
851
+ this.reparseBuffer();
852
+ }
853
+ else {
854
+ select.insertNewlineAtCursor();
855
+ var mode = this.options.enterMode;
856
+ if (mode != "flat") this.indentAtCursor(mode == "keep" ? "keep" : undefined);
857
+ select.scrollToCursor(this.container);
858
+ }
859
+ event.stop();
860
+ }
861
+ else if (code == 9 && this.options.tabMode != "default" && !event.ctrlKey) { // tab
862
+ this.handleTab(!event.shiftKey);
863
+ event.stop();
864
+ }
865
+ else if (code == 32 && event.shiftKey && this.options.tabMode == "default") { // space
866
+ this.handleTab(true);
867
+ event.stop();
868
+ }
869
+ else if (code == 36 && !event.shiftKey && !event.ctrlKey) { // home
870
+ if (this.home()) event.stop();
871
+ }
872
+ else if (code == 35 && !event.shiftKey && !event.ctrlKey) { // end
873
+ if (this.end()) event.stop();
874
+ }
875
+ // Only in Firefox is the default behavior for PgUp/PgDn correct.
876
+ else if (code == 33 && !event.shiftKey && !event.ctrlKey && !gecko) { // PgUp
877
+ if (this.pageUp()) event.stop();
878
+ }
879
+ else if (code == 34 && !event.shiftKey && !event.ctrlKey && !gecko) { // PgDn
880
+ if (this.pageDown()) event.stop();
881
+ }
882
+ else if ((code == 219 || code == 221) && event.ctrlKey && !event.altKey) { // [, ]
883
+ this.highlightParens(event.shiftKey, true);
884
+ event.stop();
885
+ }
886
+ else if (event.metaKey && !event.shiftKey && (code == 37 || code == 39)) { // Meta-left/right
887
+ var cursor = select.selectionTopNode(this.container);
888
+ if (cursor === false || !this.container.firstChild) return;
889
+
890
+ if (code == 37) select.focusAfterNode(startOfLine(cursor), this.container);
891
+ else {
892
+ var end = endOfLine(cursor, this.container);
893
+ select.focusAfterNode(end ? end.previousSibling : this.container.lastChild, this.container);
894
+ }
895
+ event.stop();
896
+ }
897
+ else if ((event.ctrlKey || event.metaKey) && !event.altKey) {
898
+ if ((event.shiftKey && code == 90) || code == 89) { // shift-Z, Y
899
+ select.scrollToNode(this.history.redo());
900
+ event.stop();
901
+ }
902
+ else if (code == 90 || (safari && code == 8)) { // Z, backspace
903
+ select.scrollToNode(this.history.undo());
904
+ event.stop();
905
+ }
906
+ else if (code == 83 && this.options.saveFunction) { // S
907
+ this.options.saveFunction();
908
+ event.stop();
909
+ }
910
+ else if (code == 86 && !mac) { // V
911
+ this.reroutePasteEvent();
912
+ }
913
+ }
914
+ },
915
+
916
+ // Check for characters that should re-indent the current line,
917
+ // and prevent Opera from handling enter and tab anyway.
918
+ keyPress: function(event) {
919
+ var electric = this.options.electricChars && Editor.Parser.electricChars, self = this;
920
+ // Hack for Opera, and Firefox on OS X, in which stopping a
921
+ // keydown event does not prevent the associated keypress event
922
+ // from happening, so we have to cancel enter and tab again
923
+ // here.
924
+ if ((this.frozen && (!this.keyFilter || this.keyFilter(event.keyCode || event.code, event))) ||
925
+ event.code == 13 || (event.code == 9 && this.options.tabMode != "default") ||
926
+ (event.code == 32 && event.shiftKey && this.options.tabMode == "default"))
927
+ event.stop();
928
+ else if (mac && (event.ctrlKey || event.metaKey) && event.character == "v") {
929
+ this.reroutePasteEvent();
930
+ }
931
+ else if (electric && electric.indexOf(event.character) != -1)
932
+ parent.setTimeout(function(){self.indentAtCursor(null);}, 0);
933
+ // Work around a bug where pressing backspace at the end of a
934
+ // line, or delete at the start, often causes the cursor to jump
935
+ // to the start of the line in Opera 10.60.
936
+ else if (brokenOpera) {
937
+ if (event.code == 8) { // backspace
938
+ var sel = select.selectionTopNode(this.container), self = this,
939
+ next = sel ? sel.nextSibling : this.container.firstChild;
940
+ if (sel !== false && next && isBR(next))
941
+ parent.setTimeout(function(){
942
+ if (select.selectionTopNode(self.container) == next)
943
+ select.focusAfterNode(next.previousSibling, self.container);
944
+ }, 20);
945
+ }
946
+ else if (event.code == 46) { // delete
947
+ var sel = select.selectionTopNode(this.container), self = this;
948
+ if (sel && isBR(sel)) {
949
+ parent.setTimeout(function(){
950
+ if (select.selectionTopNode(self.container) != sel)
951
+ select.focusAfterNode(sel, self.container);
952
+ }, 20);
953
+ }
954
+ }
955
+ }
956
+ // In 533.* WebKit versions, when the document is big, typing
957
+ // something at the end of a line causes the browser to do some
958
+ // kind of stupid heavy operation, creating delays of several
959
+ // seconds before the typed characters appear. This very crude
960
+ // hack inserts a temporary zero-width space after the cursor to
961
+ // make it not be at the end of the line.
962
+ else if (slowWebkit) {
963
+ var sel = select.selectionTopNode(this.container),
964
+ next = sel ? sel.nextSibling : this.container.firstChild;
965
+ // Doesn't work on empty lines, for some reason those always
966
+ // trigger the delay.
967
+ if (sel && next && isBR(next) && !isBR(sel)) {
968
+ var cheat = document.createTextNode("\u200b");
969
+ this.container.insertBefore(cheat, next);
970
+ parent.setTimeout(function() {
971
+ if (cheat.nodeValue == "\u200b") removeElement(cheat);
972
+ else cheat.nodeValue = cheat.nodeValue.replace("\u200b", "");
973
+ }, 20);
974
+ }
975
+ }
976
+
977
+ // Magic incantation that works abound a webkit bug when you
978
+ // can't type on a blank line following a line that's wider than
979
+ // the window.
980
+ if (webkit && !this.options.textWrapping)
981
+ setTimeout(function () {
982
+ var node = select.selectionTopNode(self.container, true);
983
+ if (node && node.nodeType == 3 && node.previousSibling && isBR(node.previousSibling)
984
+ && node.nextSibling && isBR(node.nextSibling))
985
+ node.parentNode.replaceChild(document.createElement("BR"), node.previousSibling);
986
+ }, 50);
987
+ },
988
+
989
+ // Mark the node at the cursor dirty when a non-safe key is
990
+ // released.
991
+ keyUp: function(event) {
992
+ this.cursorActivity(isSafeKey(event.keyCode));
993
+ },
994
+
995
+ // Indent the line following a given <br>, or null for the first
996
+ // line. If given a <br> element, this must have been highlighted
997
+ // so that it has an indentation method. Returns the whitespace
998
+ // element that has been modified or created (if any).
999
+ indentLineAfter: function(start, direction) {
1000
+ function whiteSpaceAfter(node) {
1001
+ var ws = node ? node.nextSibling : self.container.firstChild;
1002
+ if (!ws || !hasClass(ws, "whitespace")) return null;
1003
+ return ws;
1004
+ }
1005
+
1006
+ // whiteSpace is the whitespace span at the start of the line,
1007
+ // or null if there is no such node.
1008
+ var self = this, whiteSpace = whiteSpaceAfter(start);
1009
+ var newIndent = 0, curIndent = whiteSpace ? whiteSpace.currentText.length : 0;
1010
+
1011
+ var firstText = whiteSpace ? whiteSpace.nextSibling : (start ? start.nextSibling : this.container.firstChild);
1012
+ if (direction == "keep") {
1013
+ if (start) {
1014
+ var prevWS = whiteSpaceAfter(startOfLine(start.previousSibling))
1015
+ if (prevWS) newIndent = prevWS.currentText.length;
1016
+ }
1017
+ }
1018
+ else {
1019
+ // Sometimes the start of the line can influence the correct
1020
+ // indentation, so we retrieve it.
1021
+ var nextChars = (start && firstText && firstText.currentText) ? firstText.currentText : "";
1022
+
1023
+ // Ask the lexical context for the correct indentation, and
1024
+ // compute how much this differs from the current indentation.
1025
+ if (direction != null && this.options.tabMode == "shift")
1026
+ newIndent = direction ? curIndent + indentUnit : Math.max(0, curIndent - indentUnit)
1027
+ else if (start)
1028
+ newIndent = start.indentation(nextChars, curIndent, direction, firstText);
1029
+ else if (Editor.Parser.firstIndentation)
1030
+ newIndent = Editor.Parser.firstIndentation(nextChars, curIndent, direction, firstText);
1031
+ }
1032
+
1033
+ var indentDiff = newIndent - curIndent;
1034
+
1035
+ // If there is too much, this is just a matter of shrinking a span.
1036
+ if (indentDiff < 0) {
1037
+ if (newIndent == 0) {
1038
+ if (firstText) select.snapshotMove(whiteSpace.firstChild, firstText.firstChild || firstText, 0);
1039
+ removeElement(whiteSpace);
1040
+ whiteSpace = null;
1041
+ }
1042
+ else {
1043
+ select.snapshotMove(whiteSpace.firstChild, whiteSpace.firstChild, indentDiff, true);
1044
+ whiteSpace.currentText = makeWhiteSpace(newIndent);
1045
+ whiteSpace.firstChild.nodeValue = whiteSpace.currentText;
1046
+ }
1047
+ }
1048
+ // Not enough...
1049
+ else if (indentDiff > 0) {
1050
+ // If there is whitespace, we grow it.
1051
+ if (whiteSpace) {
1052
+ whiteSpace.currentText = makeWhiteSpace(newIndent);
1053
+ whiteSpace.firstChild.nodeValue = whiteSpace.currentText;
1054
+ select.snapshotMove(whiteSpace.firstChild, whiteSpace.firstChild, indentDiff, true);
1055
+ }
1056
+ // Otherwise, we have to add a new whitespace node.
1057
+ else {
1058
+ whiteSpace = makePartSpan(makeWhiteSpace(newIndent));
1059
+ whiteSpace.className = "whitespace";
1060
+ if (start) insertAfter(whiteSpace, start);
1061
+ else this.container.insertBefore(whiteSpace, this.container.firstChild);
1062
+ select.snapshotMove(firstText && (firstText.firstChild || firstText),
1063
+ whiteSpace.firstChild, newIndent, false, true);
1064
+ }
1065
+ }
1066
+ // Make sure cursor ends up after the whitespace
1067
+ else if (whiteSpace) {
1068
+ select.snapshotMove(whiteSpace.firstChild, whiteSpace.firstChild, newIndent, false);
1069
+ }
1070
+ if (indentDiff != 0) this.addDirtyNode(start);
1071
+ },
1072
+
1073
+ // Re-highlight the selected part of the document.
1074
+ highlightAtCursor: function() {
1075
+ var pos = select.selectionTopNode(this.container, true);
1076
+ var to = select.selectionTopNode(this.container, false);
1077
+ if (pos === false || to === false) return false;
1078
+
1079
+ select.markSelection();
1080
+ if (this.highlight(pos, endOfLine(to, this.container), true, 20) === false)
1081
+ return false;
1082
+ select.selectMarked();
1083
+ return true;
1084
+ },
1085
+
1086
+ // When tab is pressed with text selected, the whole selection is
1087
+ // re-indented, when nothing is selected, the line with the cursor
1088
+ // is re-indented.
1089
+ handleTab: function(direction) {
1090
+ if (this.options.tabMode == "spaces")
1091
+ select.insertTabAtCursor();
1092
+ else
1093
+ this.reindentSelection(direction);
1094
+ },
1095
+
1096
+ // Custom home behaviour that doesn't land the cursor in front of
1097
+ // leading whitespace unless pressed twice.
1098
+ home: function() {
1099
+ var cur = select.selectionTopNode(this.container, true), start = cur;
1100
+ if (cur === false || !(!cur || cur.isPart || isBR(cur)) || !this.container.firstChild)
1101
+ return false;
1102
+
1103
+ while (cur && !isBR(cur)) cur = cur.previousSibling;
1104
+ var next = cur ? cur.nextSibling : this.container.firstChild;
1105
+ if (next && next != start && next.isPart && hasClass(next, "whitespace"))
1106
+ select.focusAfterNode(next, this.container);
1107
+ else
1108
+ select.focusAfterNode(cur, this.container);
1109
+
1110
+ select.scrollToCursor(this.container);
1111
+ return true;
1112
+ },
1113
+
1114
+ // Some browsers (Opera) don't manage to handle the end key
1115
+ // properly in the face of vertical scrolling.
1116
+ end: function() {
1117
+ var cur = select.selectionTopNode(this.container, true);
1118
+ if (cur === false) return false;
1119
+ cur = endOfLine(cur, this.container);
1120
+ if (!cur) return false;
1121
+ select.focusAfterNode(cur.previousSibling, this.container);
1122
+ select.scrollToCursor(this.container);
1123
+ return true;
1124
+ },
1125
+
1126
+ pageUp: function() {
1127
+ var line = this.cursorPosition().line, scrollAmount = this.visibleLineCount();
1128
+ if (line === false || scrollAmount === false) return false;
1129
+ // Try to keep one line on the screen.
1130
+ scrollAmount -= 2;
1131
+ for (var i = 0; i < scrollAmount; i++) {
1132
+ line = this.prevLine(line);
1133
+ if (line === false) break;
1134
+ }
1135
+ if (i == 0) return false; // Already at first line
1136
+ select.setCursorPos(this.container, {node: line, offset: 0});
1137
+ select.scrollToCursor(this.container);
1138
+ return true;
1139
+ },
1140
+
1141
+ pageDown: function() {
1142
+ var line = this.cursorPosition().line, scrollAmount = this.visibleLineCount();
1143
+ if (line === false || scrollAmount === false) return false;
1144
+ // Try to move to the last line of the current page.
1145
+ scrollAmount -= 2;
1146
+ for (var i = 0; i < scrollAmount; i++) {
1147
+ var nextLine = this.nextLine(line);
1148
+ if (nextLine === false) break;
1149
+ line = nextLine;
1150
+ }
1151
+ if (i == 0) return false; // Already at last line
1152
+ select.setCursorPos(this.container, {node: line, offset: 0});
1153
+ select.scrollToCursor(this.container);
1154
+ return true;
1155
+ },
1156
+
1157
+ // Delay (or initiate) the next paren highlight event.
1158
+ scheduleParenHighlight: function() {
1159
+ if (this.parenEvent) parent.clearTimeout(this.parenEvent);
1160
+ var self = this;
1161
+ this.parenEvent = parent.setTimeout(function(){self.highlightParens();}, 300);
1162
+ },
1163
+
1164
+ // Take the token before the cursor. If it contains a character in
1165
+ // '()[]{}', search for the matching paren/brace/bracket, and
1166
+ // highlight them in green for a moment, or red if no proper match
1167
+ // was found.
1168
+ highlightParens: function(jump, fromKey) {
1169
+ var self = this, mark = this.options.markParen;
1170
+ if (typeof mark == "string") mark = [mark, mark];
1171
+ // give the relevant nodes a colour.
1172
+ function highlight(node, ok) {
1173
+ if (!node) return;
1174
+ if (!mark) {
1175
+ node.style.fontWeight = "bold";
1176
+ node.style.color = ok ? "#8F8" : "#F88";
1177
+ }
1178
+ else if (mark.call) mark(node, ok);
1179
+ else node.className += " " + mark[ok ? 0 : 1];
1180
+ }
1181
+ function unhighlight(node) {
1182
+ if (!node) return;
1183
+ if (mark && !mark.call)
1184
+ removeClass(removeClass(node, mark[0]), mark[1]);
1185
+ else if (self.options.unmarkParen)
1186
+ self.options.unmarkParen(node);
1187
+ else {
1188
+ node.style.fontWeight = "";
1189
+ node.style.color = "";
1190
+ }
1191
+ }
1192
+ if (!fromKey && self.highlighted) {
1193
+ unhighlight(self.highlighted[0]);
1194
+ unhighlight(self.highlighted[1]);
1195
+ }
1196
+
1197
+ if (!window || !window.parent || !window.select) return;
1198
+ // Clear the event property.
1199
+ if (this.parenEvent) parent.clearTimeout(this.parenEvent);
1200
+ this.parenEvent = null;
1201
+
1202
+ // Extract a 'paren' from a piece of text.
1203
+ function paren(node) {
1204
+ if (node.currentText) {
1205
+ var match = node.currentText.match(/^[\s\u00a0]*([\(\)\[\]{}])[\s\u00a0]*$/);
1206
+ return match && match[1];
1207
+ }
1208
+ }
1209
+ // Determine the direction a paren is facing.
1210
+ function forward(ch) {
1211
+ return /[\(\[\{]/.test(ch);
1212
+ }
1213
+
1214
+ var ch, cursor = select.selectionTopNode(this.container, true);
1215
+ if (!cursor || !this.highlightAtCursor()) return;
1216
+ cursor = select.selectionTopNode(this.container, true);
1217
+ if (!(cursor && ((ch = paren(cursor)) || (cursor = cursor.nextSibling) && (ch = paren(cursor)))))
1218
+ return;
1219
+ // We only look for tokens with the same className.
1220
+ var className = cursor.className, dir = forward(ch), match = matching[ch];
1221
+
1222
+ // Since parts of the document might not have been properly
1223
+ // highlighted, and it is hard to know in advance which part we
1224
+ // have to scan, we just try, and when we find dirty nodes we
1225
+ // abort, parse them, and re-try.
1226
+ function tryFindMatch() {
1227
+ var stack = [], ch, ok = true;
1228
+ for (var runner = cursor; runner; runner = dir ? runner.nextSibling : runner.previousSibling) {
1229
+ if (runner.className == className && isSpan(runner) && (ch = paren(runner))) {
1230
+ if (forward(ch) == dir)
1231
+ stack.push(ch);
1232
+ else if (!stack.length)
1233
+ ok = false;
1234
+ else if (stack.pop() != matching[ch])
1235
+ ok = false;
1236
+ if (!stack.length) break;
1237
+ }
1238
+ else if (runner.dirty || !isSpan(runner) && !isBR(runner)) {
1239
+ return {node: runner, status: "dirty"};
1240
+ }
1241
+ }
1242
+ return {node: runner, status: runner && ok};
1243
+ }
1244
+
1245
+ while (true) {
1246
+ var found = tryFindMatch();
1247
+ if (found.status == "dirty") {
1248
+ this.highlight(found.node, endOfLine(found.node));
1249
+ // Needed because in some corner cases a highlight does not
1250
+ // reach a node.
1251
+ found.node.dirty = false;
1252
+ continue;
1253
+ }
1254
+ else {
1255
+ highlight(cursor, found.status);
1256
+ highlight(found.node, found.status);
1257
+ if (fromKey)
1258
+ parent.setTimeout(function() {unhighlight(cursor); unhighlight(found.node);}, 500);
1259
+ else
1260
+ self.highlighted = [cursor, found.node];
1261
+ if (jump && found.node)
1262
+ select.focusAfterNode(found.node.previousSibling, this.container);
1263
+ break;
1264
+ }
1265
+ }
1266
+ },
1267
+
1268
+ // Adjust the amount of whitespace at the start of the line that
1269
+ // the cursor is on so that it is indented properly.
1270
+ indentAtCursor: function(direction) {
1271
+ if (!this.container.firstChild) return;
1272
+ // The line has to have up-to-date lexical information, so we
1273
+ // highlight it first.
1274
+ if (!this.highlightAtCursor()) return;
1275
+ var cursor = select.selectionTopNode(this.container, false);
1276
+ // If we couldn't determine the place of the cursor,
1277
+ // there's nothing to indent.
1278
+ if (cursor === false)
1279
+ return;
1280
+ select.markSelection();
1281
+ this.indentLineAfter(startOfLine(cursor), direction);
1282
+ select.selectMarked();
1283
+ },
1284
+
1285
+ // Indent all lines whose start falls inside of the current
1286
+ // selection.
1287
+ indentRegion: function(start, end, direction) {
1288
+ var current = (start = startOfLine(start)), before = start && startOfLine(start.previousSibling);
1289
+ if (!isBR(end)) end = endOfLine(end, this.container);
1290
+ this.addDirtyNode(start);
1291
+
1292
+ do {
1293
+ var next = endOfLine(current, this.container);
1294
+ if (current) this.highlight(before, next, true);
1295
+ this.indentLineAfter(current, direction);
1296
+ before = current;
1297
+ current = next;
1298
+ } while (current != end);
1299
+ select.setCursorPos(this.container, {node: start, offset: 0}, {node: end, offset: 0});
1300
+ },
1301
+
1302
+ // Find the node that the cursor is in, mark it as dirty, and make
1303
+ // sure a highlight pass is scheduled.
1304
+ cursorActivity: function(safe) {
1305
+ // pagehide event hack above
1306
+ if (this.unloaded) {
1307
+ window.document.designMode = "off";
1308
+ window.document.designMode = "on";
1309
+ this.unloaded = false;
1310
+ }
1311
+
1312
+ if (internetExplorer) {
1313
+ this.container.createTextRange().execCommand("unlink");
1314
+ clearTimeout(this.saveSelectionSnapshot);
1315
+ var self = this;
1316
+ this.saveSelectionSnapshot = setTimeout(function() {
1317
+ var snapshot = select.getBookmark(self.container);
1318
+ if (snapshot) self.selectionSnapshot = snapshot;
1319
+ }, 200);
1320
+ }
1321
+
1322
+ var activity = this.options.onCursorActivity;
1323
+ if (!safe || activity) {
1324
+ var cursor = select.selectionTopNode(this.container, false);
1325
+ if (cursor === false || !this.container.firstChild) return;
1326
+ cursor = cursor || this.container.firstChild;
1327
+ if (activity) activity(cursor);
1328
+ if (!safe) {
1329
+ this.scheduleHighlight();
1330
+ this.addDirtyNode(cursor);
1331
+ }
1332
+ }
1333
+ },
1334
+
1335
+ reparseBuffer: function() {
1336
+ forEach(this.container.childNodes, function(node) {node.dirty = true;});
1337
+ if (this.container.firstChild)
1338
+ this.addDirtyNode(this.container.firstChild);
1339
+ },
1340
+
1341
+ // Add a node to the set of dirty nodes, if it isn't already in
1342
+ // there.
1343
+ addDirtyNode: function(node) {
1344
+ node = node || this.container.firstChild;
1345
+ if (!node) return;
1346
+
1347
+ for (var i = 0; i < this.dirty.length; i++)
1348
+ if (this.dirty[i] == node) return;
1349
+
1350
+ if (node.nodeType != 3)
1351
+ node.dirty = true;
1352
+ this.dirty.push(node);
1353
+ },
1354
+
1355
+ allClean: function() {
1356
+ return !this.dirty.length;
1357
+ },
1358
+
1359
+ // Cause a highlight pass to happen in options.passDelay
1360
+ // milliseconds. Clear the existing timeout, if one exists. This
1361
+ // way, the passes do not happen while the user is typing, and
1362
+ // should as unobtrusive as possible.
1363
+ scheduleHighlight: function() {
1364
+ // Timeouts are routed through the parent window, because on
1365
+ // some browsers designMode windows do not fire timeouts.
1366
+ var self = this;
1367
+ parent.clearTimeout(this.highlightTimeout);
1368
+ this.highlightTimeout = parent.setTimeout(function(){self.highlightDirty();}, this.options.passDelay);
1369
+ },
1370
+
1371
+ // Fetch one dirty node, and remove it from the dirty set.
1372
+ getDirtyNode: function() {
1373
+ while (this.dirty.length > 0) {
1374
+ var found = this.dirty.pop();
1375
+ // IE8 sometimes throws an unexplainable 'invalid argument'
1376
+ // exception for found.parentNode
1377
+ try {
1378
+ // If the node has been coloured in the meantime, or is no
1379
+ // longer in the document, it should not be returned.
1380
+ while (found && found.parentNode != this.container)
1381
+ found = found.parentNode;
1382
+ if (found && (found.dirty || found.nodeType == 3))
1383
+ return found;
1384
+ } catch (e) {}
1385
+ }
1386
+ return null;
1387
+ },
1388
+
1389
+ // Pick dirty nodes, and highlight them, until options.passTime
1390
+ // milliseconds have gone by. The highlight method will continue
1391
+ // to next lines as long as it finds dirty nodes. It returns
1392
+ // information about the place where it stopped. If there are
1393
+ // dirty nodes left after this function has spent all its lines,
1394
+ // it shedules another highlight to finish the job.
1395
+ highlightDirty: function(force) {
1396
+ // Prevent FF from raising an error when it is firing timeouts
1397
+ // on a page that's no longer loaded.
1398
+ if (!window || !window.parent || !window.select) return false;
1399
+
1400
+ if (!this.options.readOnly) select.markSelection();
1401
+ var start, endTime = force ? null : time() + this.options.passTime;
1402
+ while ((time() < endTime || force) && (start = this.getDirtyNode())) {
1403
+ var result = this.highlight(start, endTime);
1404
+ if (result && result.node && result.dirty)
1405
+ this.addDirtyNode(result.node.nextSibling);
1406
+ }
1407
+ if (!this.options.readOnly) select.selectMarked();
1408
+ if (start) this.scheduleHighlight();
1409
+ return this.dirty.length == 0;
1410
+ },
1411
+
1412
+ // Creates a function that, when called through a timeout, will
1413
+ // continuously re-parse the document.
1414
+ documentScanner: function(passTime) {
1415
+ var self = this, pos = null;
1416
+ return function() {
1417
+ // FF timeout weirdness workaround.
1418
+ if (!window || !window.parent || !window.select) return;
1419
+ // If the current node is no longer in the document... oh
1420
+ // well, we start over.
1421
+ if (pos && pos.parentNode != self.container)
1422
+ pos = null;
1423
+ select.markSelection();
1424
+ var result = self.highlight(pos, time() + passTime, true);
1425
+ select.selectMarked();
1426
+ var newPos = result ? (result.node && result.node.nextSibling) : null;
1427
+ pos = (pos == newPos) ? null : newPos;
1428
+ self.delayScanning();
1429
+ };
1430
+ },
1431
+
1432
+ // Starts the continuous scanning process for this document after
1433
+ // a given interval.
1434
+ delayScanning: function() {
1435
+ if (this.scanner) {
1436
+ parent.clearTimeout(this.documentScan);
1437
+ this.documentScan = parent.setTimeout(this.scanner, this.options.continuousScanning);
1438
+ }
1439
+ },
1440
+
1441
+ // The function that does the actual highlighting/colouring (with
1442
+ // help from the parser and the DOM normalizer). Its interface is
1443
+ // rather overcomplicated, because it is used in different
1444
+ // situations: ensuring that a certain line is highlighted, or
1445
+ // highlighting up to X milliseconds starting from a certain
1446
+ // point. The 'from' argument gives the node at which it should
1447
+ // start. If this is null, it will start at the beginning of the
1448
+ // document. When a timestamp is given with the 'target' argument,
1449
+ // it will stop highlighting at that time. If this argument holds
1450
+ // a DOM node, it will highlight until it reaches that node. If at
1451
+ // any time it comes across two 'clean' lines (no dirty nodes), it
1452
+ // will stop, except when 'cleanLines' is true. maxBacktrack is
1453
+ // the maximum number of lines to backtrack to find an existing
1454
+ // parser instance. This is used to give up in situations where a
1455
+ // highlight would take too long and freeze the browser interface.
1456
+ highlight: function(from, target, cleanLines, maxBacktrack){
1457
+ var container = this.container, self = this, active = this.options.activeTokens;
1458
+ var endTime = (typeof target == "number" ? target : null);
1459
+
1460
+ if (!container.firstChild)
1461
+ return false;
1462
+ // Backtrack to the first node before from that has a partial
1463
+ // parse stored.
1464
+ while (from && (!from.parserFromHere || from.dirty)) {
1465
+ if (maxBacktrack != null && isBR(from) && (--maxBacktrack) < 0)
1466
+ return false;
1467
+ from = from.previousSibling;
1468
+ }
1469
+ // If we are at the end of the document, do nothing.
1470
+ if (from && !from.nextSibling)
1471
+ return false;
1472
+
1473
+ // Check whether a part (<span> node) and the corresponding token
1474
+ // match.
1475
+ function correctPart(token, part){
1476
+ return !part.reduced && part.currentText == token.value && part.className == token.style;
1477
+ }
1478
+ // Shorten the text associated with a part by chopping off
1479
+ // characters from the front. Note that only the currentText
1480
+ // property gets changed. For efficiency reasons, we leave the
1481
+ // nodeValue alone -- we set the reduced flag to indicate that
1482
+ // this part must be replaced.
1483
+ function shortenPart(part, minus){
1484
+ part.currentText = part.currentText.substring(minus);
1485
+ part.reduced = true;
1486
+ }
1487
+ // Create a part corresponding to a given token.
1488
+ function tokenPart(token){
1489
+ var part = makePartSpan(token.value);
1490
+ part.className = token.style;
1491
+ return part;
1492
+ }
1493
+
1494
+ function maybeTouch(node) {
1495
+ if (node) {
1496
+ var old = node.oldNextSibling;
1497
+ if (lineDirty || old === undefined || node.nextSibling != old)
1498
+ self.history.touch(node);
1499
+ node.oldNextSibling = node.nextSibling;
1500
+ }
1501
+ else {
1502
+ var old = self.container.oldFirstChild;
1503
+ if (lineDirty || old === undefined || self.container.firstChild != old)
1504
+ self.history.touch(null);
1505
+ self.container.oldFirstChild = self.container.firstChild;
1506
+ }
1507
+ }
1508
+
1509
+ // Get the token stream. If from is null, we start with a new
1510
+ // parser from the start of the frame, otherwise a partial parse
1511
+ // is resumed.
1512
+ var traversal = traverseDOM(from ? from.nextSibling : container.firstChild),
1513
+ stream = stringStream(traversal),
1514
+ parsed = from ? from.parserFromHere(stream) : Editor.Parser.make(stream);
1515
+
1516
+ function surroundedByBRs(node) {
1517
+ return (node.previousSibling == null || isBR(node.previousSibling)) &&
1518
+ (node.nextSibling == null || isBR(node.nextSibling));
1519
+ }
1520
+
1521
+ // parts is an interface to make it possible to 'delay' fetching
1522
+ // the next DOM node until we are completely done with the one
1523
+ // before it. This is necessary because often the next node is
1524
+ // not yet available when we want to proceed past the current
1525
+ // one.
1526
+ var parts = {
1527
+ current: null,
1528
+ // Fetch current node.
1529
+ get: function(){
1530
+ if (!this.current)
1531
+ this.current = traversal.nodes.shift();
1532
+ return this.current;
1533
+ },
1534
+ // Advance to the next part (do not fetch it yet).
1535
+ next: function(){
1536
+ this.current = null;
1537
+ },
1538
+ // Remove the current part from the DOM tree, and move to the
1539
+ // next.
1540
+ remove: function(){
1541
+ container.removeChild(this.get());
1542
+ this.current = null;
1543
+ },
1544
+ // Advance to the next part that is not empty, discarding empty
1545
+ // parts.
1546
+ getNonEmpty: function(){
1547
+ var part = this.get();
1548
+ // Allow empty nodes when they are alone on a line, needed
1549
+ // for the FF cursor bug workaround (see select.js,
1550
+ // insertNewlineAtCursor).
1551
+ while (part && isSpan(part) && part.currentText == "") {
1552
+ // Leave empty nodes that are alone on a line alone in
1553
+ // Opera, since that browsers doesn't deal well with
1554
+ // having 2 BRs in a row.
1555
+ if (window.opera && surroundedByBRs(part)) {
1556
+ this.next();
1557
+ part = this.get();
1558
+ }
1559
+ else {
1560
+ var old = part;
1561
+ this.remove();
1562
+ part = this.get();
1563
+ // Adjust selection information, if any. See select.js for details.
1564
+ select.snapshotMove(old.firstChild, part && (part.firstChild || part), 0);
1565
+ }
1566
+ }
1567
+
1568
+ return part;
1569
+ }
1570
+ };
1571
+
1572
+ var lineDirty = false, prevLineDirty = true, lineNodes = 0;
1573
+
1574
+ // This forEach loops over the tokens from the parsed stream, and
1575
+ // at the same time uses the parts object to proceed through the
1576
+ // corresponding DOM nodes.
1577
+ forEach(parsed, function(token){
1578
+ var part = parts.getNonEmpty();
1579
+
1580
+ if (token.value == "\n"){
1581
+ // The idea of the two streams actually staying synchronized
1582
+ // is such a long shot that we explicitly check.
1583
+ if (!isBR(part))
1584
+ throw "Parser out of sync. Expected BR.";
1585
+
1586
+ if (part.dirty || !part.indentation) lineDirty = true;
1587
+ maybeTouch(from);
1588
+ from = part;
1589
+
1590
+ // Every <br> gets a copy of the parser state and a lexical
1591
+ // context assigned to it. The first is used to be able to
1592
+ // later resume parsing from this point, the second is used
1593
+ // for indentation.
1594
+ part.parserFromHere = parsed.copy();
1595
+ part.indentation = token.indentation || alwaysZero;
1596
+ part.dirty = false;
1597
+
1598
+ // If the target argument wasn't an integer, go at least
1599
+ // until that node.
1600
+ if (endTime == null && part == target) throw StopIteration;
1601
+
1602
+ // A clean line with more than one node means we are done.
1603
+ // Throwing a StopIteration is the way to break out of a
1604
+ // MochiKit forEach loop.
1605
+ if ((endTime != null && time() >= endTime) || (!lineDirty && !prevLineDirty && lineNodes > 1 && !cleanLines))
1606
+ throw StopIteration;
1607
+ prevLineDirty = lineDirty; lineDirty = false; lineNodes = 0;
1608
+ parts.next();
1609
+ }
1610
+ else {
1611
+ if (!isSpan(part))
1612
+ throw "Parser out of sync. Expected SPAN.";
1613
+ if (part.dirty)
1614
+ lineDirty = true;
1615
+ lineNodes++;
1616
+
1617
+ // If the part matches the token, we can leave it alone.
1618
+ if (correctPart(token, part)){
1619
+ if (active && part.dirty) active(part, token, self);
1620
+ part.dirty = false;
1621
+ parts.next();
1622
+ }
1623
+ // Otherwise, we have to fix it.
1624
+ else {
1625
+ lineDirty = true;
1626
+ // Insert the correct part.
1627
+ var newPart = tokenPart(token);
1628
+ container.insertBefore(newPart, part);
1629
+ if (active) active(newPart, token, self);
1630
+ var tokensize = token.value.length;
1631
+ var offset = 0;
1632
+ // Eat up parts until the text for this token has been
1633
+ // removed, adjusting the stored selection info (see
1634
+ // select.js) in the process.
1635
+ while (tokensize > 0) {
1636
+ part = parts.get();
1637
+ var partsize = part.currentText.length;
1638
+ select.snapshotReplaceNode(part.firstChild, newPart.firstChild, tokensize, offset);
1639
+ if (partsize > tokensize){
1640
+ shortenPart(part, tokensize);
1641
+ tokensize = 0;
1642
+ }
1643
+ else {
1644
+ tokensize -= partsize;
1645
+ offset += partsize;
1646
+ parts.remove();
1647
+ }
1648
+ }
1649
+ }
1650
+ }
1651
+ });
1652
+ maybeTouch(from);
1653
+ webkitLastLineHack(this.container);
1654
+
1655
+ // The function returns some status information that is used by
1656
+ // hightlightDirty to determine whether and where it has to
1657
+ // continue.
1658
+ return {node: parts.getNonEmpty(),
1659
+ dirty: lineDirty};
1660
+ }
1661
+ };
1662
+
1663
+ return Editor;
1664
+ })();
1665
+
1666
+ addEventHandler(window, "load", function() {
1667
+ var CodeMirror = window.frameElement.CodeMirror;
1668
+ var e = CodeMirror.editor = new Editor(CodeMirror.options);
1669
+ parent.setTimeout(method(CodeMirror, "init"), 0);
1670
+ });