spiderfw 0.6.27 → 0.6.28

Sign up to get free protection for your applications and to get access to all the features.
Files changed (179) hide show
  1. data/CHANGELOG +4 -0
  2. data/VERSION +1 -1
  3. data/apps/core/admin/admin.rb +6 -2
  4. data/apps/core/admin/controllers/admin_controller.rb +10 -3
  5. data/apps/core/admin/controllers/app_admin_controller.rb +15 -0
  6. data/apps/core/admin/public/css/sass/admin.css +29 -33
  7. data/apps/core/admin/public/css/sass/grid.css +14 -0
  8. data/apps/core/admin/public/sass/admin.scss +3 -2
  9. data/apps/core/admin/views/admin.layout.shtml +1 -0
  10. data/apps/core/auth/controllers/mixins/auth_helper.rb +15 -5
  11. data/apps/core/components/assets.rb +60 -41
  12. data/apps/core/components/public/js/jquery/jquery-1.8.3.js +9472 -0
  13. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/jquery.ui.core.js +1 -1
  14. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/button_bg.png +0 -0
  15. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/datepicker.gif +0 -0
  16. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/icon_sprite.png +0 -0
  17. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/progress_bar.gif +0 -0
  18. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/slider_h_bg.gif +0 -0
  19. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/slider_handles.png +0 -0
  20. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/slider_v_bg.gif +0 -0
  21. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/tab_bg.gif +0 -0
  22. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/the_gradient.gif +0 -0
  23. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-anim_basic_16x16.gif +0 -0
  24. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
  25. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
  26. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_flat_10_000000_40x100.png +0 -0
  27. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
  28. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
  29. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
  30. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
  31. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
  32. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
  33. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_222222_256x240.png +0 -0
  34. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_228ef1_256x240.png +0 -0
  35. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_ef8c08_256x240.png +0 -0
  36. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_ffd27a_256x240.png +0 -0
  37. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_ffffff_256x240.png +0 -0
  38. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/jquery-ui.custom.css +528 -0
  39. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-af.js +23 -0
  40. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ar-DZ.js +23 -0
  41. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ar.js +23 -0
  42. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-az.js +23 -0
  43. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-be.js +23 -0
  44. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-bg.js +24 -0
  45. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-bs.js +23 -0
  46. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ca.js +23 -0
  47. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-cs.js +23 -0
  48. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-cy-GB.js +23 -0
  49. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-da.js +23 -0
  50. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-de.js +23 -0
  51. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-el.js +23 -0
  52. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-en-AU.js +23 -0
  53. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-en-GB.js +23 -0
  54. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-en-NZ.js +23 -0
  55. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-eo.js +23 -0
  56. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-es.js +23 -0
  57. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-et.js +23 -0
  58. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-eu.js +23 -0
  59. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fa.js +59 -0
  60. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fi.js +23 -0
  61. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fo.js +23 -0
  62. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fr-CA.js +23 -0
  63. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fr-CH.js +23 -0
  64. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fr.js +25 -0
  65. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-gl.js +23 -0
  66. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-he.js +23 -0
  67. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hi.js +23 -0
  68. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hr.js +23 -0
  69. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hu.js +23 -0
  70. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hy.js +23 -0
  71. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-id.js +23 -0
  72. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-is.js +23 -0
  73. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-it.js +23 -0
  74. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ja.js +23 -0
  75. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ka.js +21 -0
  76. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-kk.js +23 -0
  77. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-km.js +23 -0
  78. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ko.js +23 -0
  79. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ky.js +24 -0
  80. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-lb.js +23 -0
  81. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-lt.js +23 -0
  82. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-lv.js +23 -0
  83. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-mk.js +23 -0
  84. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ml.js +23 -0
  85. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ms.js +23 -0
  86. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nb.js +22 -0
  87. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nl-BE.js +23 -0
  88. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nl.js +23 -0
  89. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nn.js +22 -0
  90. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-no.js +23 -0
  91. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-pl.js +23 -0
  92. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-pt-BR.js +23 -0
  93. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-pt.js +22 -0
  94. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-rm.js +21 -0
  95. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ro.js +26 -0
  96. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ru.js +23 -0
  97. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sk.js +23 -0
  98. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sl.js +24 -0
  99. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sq.js +23 -0
  100. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sr-SR.js +23 -0
  101. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sr.js +23 -0
  102. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sv.js +23 -0
  103. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ta.js +23 -0
  104. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-th.js +23 -0
  105. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-tj.js +23 -0
  106. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-tr.js +23 -0
  107. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-uk.js +24 -0
  108. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-vi.js +23 -0
  109. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-zh-CN.js +23 -0
  110. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-zh-HK.js +23 -0
  111. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-zh-TW.js +23 -0
  112. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.accordion.js +571 -0
  113. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.autocomplete.js +614 -0
  114. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.button.js +419 -0
  115. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.core.js +324 -0
  116. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.datepicker.js +2044 -0
  117. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.dialog.js +767 -0
  118. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.draggable.js +941 -0
  119. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.droppable.js +364 -0
  120. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-blind.js +82 -0
  121. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-bounce.js +113 -0
  122. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-clip.js +67 -0
  123. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-drop.js +65 -0
  124. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-explode.js +97 -0
  125. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-fade.js +30 -0
  126. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-fold.js +76 -0
  127. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-highlight.js +50 -0
  128. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-pulsate.js +63 -0
  129. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-scale.js +318 -0
  130. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-shake.js +74 -0
  131. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-slide.js +64 -0
  132. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-transfer.js +47 -0
  133. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect.js +1259 -0
  134. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.menu.js +621 -0
  135. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.mouse.js +169 -0
  136. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.position.js +497 -0
  137. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.progressbar.js +145 -0
  138. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.resizable.js +963 -0
  139. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.selectable.js +269 -0
  140. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.slider.js +641 -0
  141. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.sortable.js +1236 -0
  142. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.spinner.js +492 -0
  143. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.tabs.js +846 -0
  144. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.tooltip.js +400 -0
  145. data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.widget.js +521 -0
  146. data/apps/core/components/public/js/jquery/plugins/bsmselect/js/jquery.bsmselect.js +3 -1
  147. data/apps/core/components/public/js/plugins/sortable.js +5 -5
  148. data/apps/core/components/widgets/month_calendar/month_calendar.shtml +1 -1
  149. data/apps/core/components/widgets/table/table.rb +18 -5
  150. data/apps/core/forms/public/date_time.js +3 -0
  151. data/apps/core/forms/widgets/form/form.rb +1 -1
  152. data/apps/core/forms/widgets/inputs/date_time/date_time.rb +5 -0
  153. data/apps/core/forms/widgets/inputs/file_input/file_input.rb +1 -1
  154. data/apps/core/forms/widgets/inputs/select/select.rb +11 -16
  155. data/apps/messenger/config/options.rb +5 -5
  156. data/apps/messenger/controllers/messenger_admin_controller.rb +1 -1
  157. data/apps/messenger/controllers/messenger_controller.rb +1 -1
  158. data/apps/messenger/lib/backends/mobyt.rb +1 -1
  159. data/apps/messenger/messenger.rb +4 -2
  160. data/apps/messenger/views/admin/index.shtml +1 -1
  161. data/lib/spiderfw/controller/dispatcher.rb +5 -5
  162. data/lib/spiderfw/controller/mixins/visual.rb +10 -8
  163. data/lib/spiderfw/http/http.rb +1 -1
  164. data/lib/spiderfw/model/base_model.rb +2 -2
  165. data/lib/spiderfw/model/mappers/db_mapper.rb +4 -2
  166. data/lib/spiderfw/model/mixins/tree.rb +4 -5
  167. data/lib/spiderfw/model/model.rb +2 -1
  168. data/lib/spiderfw/model/storage/db/adapters/mysql.rb +18 -20
  169. data/lib/spiderfw/model/storage/db/adapters/oracle.rb +1 -1
  170. data/lib/spiderfw/spider.rb +5 -1
  171. data/lib/spiderfw/templates/blocks/layout_assets.rb +5 -2
  172. data/lib/spiderfw/templates/layout.rb +7 -3
  173. data/lib/spiderfw/templates/template.rb +8 -1
  174. data/lib/spiderfw/utils/monkey/date_time.rb +7 -5
  175. data/lib/spiderfw/utils/monkey/module.rb +12 -0
  176. metadata +373 -157
  177. data/lib/spiderfw/model/storage/db/connectors/mysql.rb +0 -16
  178. data/lib/spiderfw/model/storage/db/connectors/mysql2.rb +0 -9
  179. /data/apps/core/admin/public/img/{icons-s845a69dd9f.png → icons-s8b18557db6.png} +0 -0
@@ -0,0 +1,571 @@
1
+ /*!
2
+ * jQuery UI Accordion @VERSION
3
+ * http://jqueryui.com
4
+ *
5
+ * Copyright 2012 jQuery Foundation and other contributors
6
+ * Released under the MIT license.
7
+ * http://jquery.org/license
8
+ *
9
+ * http://api.jqueryui.com/accordion/
10
+ *
11
+ * Depends:
12
+ * jquery.ui.core.js
13
+ * jquery.ui.widget.js
14
+ */
15
+ (function( $, undefined ) {
16
+
17
+ var uid = 0,
18
+ hideProps = {},
19
+ showProps = {};
20
+
21
+ hideProps.height = hideProps.paddingTop = hideProps.paddingBottom =
22
+ hideProps.borderTopWidth = hideProps.borderBottomWidth = "hide";
23
+ showProps.height = showProps.paddingTop = showProps.paddingBottom =
24
+ showProps.borderTopWidth = showProps.borderBottomWidth = "show";
25
+
26
+ $.widget( "ui.accordion", {
27
+ version: "@VERSION",
28
+ options: {
29
+ active: 0,
30
+ animate: {},
31
+ collapsible: false,
32
+ event: "click",
33
+ header: "> li > :first-child,> :not(li):even",
34
+ heightStyle: "auto",
35
+ icons: {
36
+ activeHeader: "ui-icon-triangle-1-s",
37
+ header: "ui-icon-triangle-1-e"
38
+ },
39
+
40
+ // callbacks
41
+ activate: null,
42
+ beforeActivate: null
43
+ },
44
+
45
+ _create: function() {
46
+ var options = this.options;
47
+ this.prevShow = this.prevHide = $();
48
+ this.element.addClass( "ui-accordion ui-widget ui-helper-reset" )
49
+ // ARIA
50
+ .attr( "role", "tablist" );
51
+
52
+ // don't allow collapsible: false and active: false / null
53
+ if ( !options.collapsible && (options.active === false || options.active == null) ) {
54
+ options.active = 0;
55
+ }
56
+
57
+ this._processPanels();
58
+ // handle negative values
59
+ if ( options.active < 0 ) {
60
+ options.active += this.headers.length;
61
+ }
62
+ this._refresh();
63
+ },
64
+
65
+ _getCreateEventData: function() {
66
+ return {
67
+ header: this.active,
68
+ content: !this.active.length ? $() : this.active.next()
69
+ };
70
+ },
71
+
72
+ _createIcons: function() {
73
+ var icons = this.options.icons;
74
+ if ( icons ) {
75
+ $( "<span>" )
76
+ .addClass( "ui-accordion-header-icon ui-icon " + icons.header )
77
+ .prependTo( this.headers );
78
+ this.active.children( ".ui-accordion-header-icon" )
79
+ .removeClass( icons.header )
80
+ .addClass( icons.activeHeader );
81
+ this.headers.addClass( "ui-accordion-icons" );
82
+ }
83
+ },
84
+
85
+ _destroyIcons: function() {
86
+ this.headers
87
+ .removeClass( "ui-accordion-icons" )
88
+ .children( ".ui-accordion-header-icon" )
89
+ .remove();
90
+ },
91
+
92
+ _destroy: function() {
93
+ var contents;
94
+
95
+ // clean up main element
96
+ this.element
97
+ .removeClass( "ui-accordion ui-widget ui-helper-reset" )
98
+ .removeAttr( "role" );
99
+
100
+ // clean up headers
101
+ this.headers
102
+ .removeClass( "ui-accordion-header ui-accordion-header-active ui-helper-reset ui-state-default ui-corner-all ui-state-active ui-state-disabled ui-corner-top" )
103
+ .removeAttr( "role" )
104
+ .removeAttr( "aria-selected" )
105
+ .removeAttr( "aria-controls" )
106
+ .removeAttr( "tabIndex" )
107
+ .each(function() {
108
+ if ( /^ui-accordion/.test( this.id ) ) {
109
+ this.removeAttribute( "id" );
110
+ }
111
+ });
112
+ this._destroyIcons();
113
+
114
+ // clean up content panels
115
+ contents = this.headers.next()
116
+ .css( "display", "" )
117
+ .removeAttr( "role" )
118
+ .removeAttr( "aria-expanded" )
119
+ .removeAttr( "aria-hidden" )
120
+ .removeAttr( "aria-labelledby" )
121
+ .removeClass( "ui-helper-reset ui-widget-content ui-corner-bottom ui-accordion-content ui-accordion-content-active ui-state-disabled" )
122
+ .each(function() {
123
+ if ( /^ui-accordion/.test( this.id ) ) {
124
+ this.removeAttribute( "id" );
125
+ }
126
+ });
127
+ if ( this.options.heightStyle !== "content" ) {
128
+ contents.css( "height", "" );
129
+ }
130
+ },
131
+
132
+ _setOption: function( key, value ) {
133
+ if ( key === "active" ) {
134
+ // _activate() will handle invalid values and update this.options
135
+ this._activate( value );
136
+ return;
137
+ }
138
+
139
+ if ( key === "event" ) {
140
+ if ( this.options.event ) {
141
+ this._off( this.headers, this.options.event );
142
+ }
143
+ this._setupEvents( value );
144
+ }
145
+
146
+ this._super( key, value );
147
+
148
+ // setting collapsible: false while collapsed; open first panel
149
+ if ( key === "collapsible" && !value && this.options.active === false ) {
150
+ this._activate( 0 );
151
+ }
152
+
153
+ if ( key === "icons" ) {
154
+ this._destroyIcons();
155
+ if ( value ) {
156
+ this._createIcons();
157
+ }
158
+ }
159
+
160
+ // #5332 - opacity doesn't cascade to positioned elements in IE
161
+ // so we need to add the disabled class to the headers and panels
162
+ if ( key === "disabled" ) {
163
+ this.headers.add( this.headers.next() )
164
+ .toggleClass( "ui-state-disabled", !!value );
165
+ }
166
+ },
167
+
168
+ _keydown: function( event ) {
169
+ /*jshint maxcomplexity:15*/
170
+ if ( event.altKey || event.ctrlKey ) {
171
+ return;
172
+ }
173
+
174
+ var keyCode = $.ui.keyCode,
175
+ length = this.headers.length,
176
+ currentIndex = this.headers.index( event.target ),
177
+ toFocus = false;
178
+
179
+ switch ( event.keyCode ) {
180
+ case keyCode.RIGHT:
181
+ case keyCode.DOWN:
182
+ toFocus = this.headers[ ( currentIndex + 1 ) % length ];
183
+ break;
184
+ case keyCode.LEFT:
185
+ case keyCode.UP:
186
+ toFocus = this.headers[ ( currentIndex - 1 + length ) % length ];
187
+ break;
188
+ case keyCode.SPACE:
189
+ case keyCode.ENTER:
190
+ this._eventHandler( event );
191
+ break;
192
+ case keyCode.HOME:
193
+ toFocus = this.headers[ 0 ];
194
+ break;
195
+ case keyCode.END:
196
+ toFocus = this.headers[ length - 1 ];
197
+ break;
198
+ }
199
+
200
+ if ( toFocus ) {
201
+ $( event.target ).attr( "tabIndex", -1 );
202
+ $( toFocus ).attr( "tabIndex", 0 );
203
+ toFocus.focus();
204
+ event.preventDefault();
205
+ }
206
+ },
207
+
208
+ _panelKeyDown : function( event ) {
209
+ if ( event.keyCode === $.ui.keyCode.UP && event.ctrlKey ) {
210
+ $( event.currentTarget ).prev().focus();
211
+ }
212
+ },
213
+
214
+ refresh: function() {
215
+ var options = this.options;
216
+ this._processPanels();
217
+
218
+ // was collapsed or no panel
219
+ if ( ( options.active === false && options.collapsible === true ) || !this.headers.length ) {
220
+ options.active = false;
221
+ this.active = $();
222
+ // active false only when collapsible is true
223
+ } if ( options.active === false ) {
224
+ this._activate( 0 );
225
+ // was active, but active panel is gone
226
+ } else if ( this.active.length && !$.contains( this.element[ 0 ], this.active[ 0 ] ) ) {
227
+ // all remaining panel are disabled
228
+ if ( this.headers.length === this.headers.find(".ui-state-disabled").length ) {
229
+ options.active = false;
230
+ this.active = $();
231
+ // activate previous panel
232
+ } else {
233
+ this._activate( Math.max( 0, options.active - 1 ) );
234
+ }
235
+ // was active, active panel still exists
236
+ } else {
237
+ // make sure active index is correct
238
+ options.active = this.headers.index( this.active );
239
+ }
240
+
241
+ this._destroyIcons();
242
+
243
+ this._refresh();
244
+ },
245
+
246
+ _processPanels: function() {
247
+ this.headers = this.element.find( this.options.header )
248
+ .addClass( "ui-accordion-header ui-helper-reset ui-state-default ui-corner-all" );
249
+
250
+ this.headers.next()
251
+ .addClass( "ui-accordion-content ui-helper-reset ui-widget-content ui-corner-bottom" )
252
+ .filter(":not(.ui-accordion-content-active)")
253
+ .hide();
254
+ },
255
+
256
+ _refresh: function() {
257
+ var maxHeight,
258
+ options = this.options,
259
+ heightStyle = options.heightStyle,
260
+ parent = this.element.parent(),
261
+ accordionId = this.accordionId = "ui-accordion-" +
262
+ (this.element.attr( "id" ) || ++uid);
263
+
264
+ this.active = this._findActive( options.active )
265
+ .addClass( "ui-accordion-header-active ui-state-active" )
266
+ .toggleClass( "ui-corner-all ui-corner-top" );
267
+ this.active.next()
268
+ .addClass( "ui-accordion-content-active" )
269
+ .show();
270
+
271
+ this.headers
272
+ .attr( "role", "tab" )
273
+ .each(function( i ) {
274
+ var header = $( this ),
275
+ headerId = header.attr( "id" ),
276
+ panel = header.next(),
277
+ panelId = panel.attr( "id" );
278
+ if ( !headerId ) {
279
+ headerId = accordionId + "-header-" + i;
280
+ header.attr( "id", headerId );
281
+ }
282
+ if ( !panelId ) {
283
+ panelId = accordionId + "-panel-" + i;
284
+ panel.attr( "id", panelId );
285
+ }
286
+ header.attr( "aria-controls", panelId );
287
+ panel.attr( "aria-labelledby", headerId );
288
+ })
289
+ .next()
290
+ .attr( "role", "tabpanel" );
291
+
292
+ this.headers
293
+ .not( this.active )
294
+ .attr({
295
+ "aria-selected": "false",
296
+ tabIndex: -1
297
+ })
298
+ .next()
299
+ .attr({
300
+ "aria-expanded": "false",
301
+ "aria-hidden": "true"
302
+ })
303
+ .hide();
304
+
305
+ // make sure at least one header is in the tab order
306
+ if ( !this.active.length ) {
307
+ this.headers.eq( 0 ).attr( "tabIndex", 0 );
308
+ } else {
309
+ this.active.attr({
310
+ "aria-selected": "true",
311
+ tabIndex: 0
312
+ })
313
+ .next()
314
+ .attr({
315
+ "aria-expanded": "true",
316
+ "aria-hidden": "false"
317
+ });
318
+ }
319
+
320
+ this._createIcons();
321
+
322
+ this._setupEvents( options.event );
323
+
324
+ if ( heightStyle === "fill" ) {
325
+ maxHeight = parent.height();
326
+ this.element.siblings( ":visible" ).each(function() {
327
+ var elem = $( this ),
328
+ position = elem.css( "position" );
329
+
330
+ if ( position === "absolute" || position === "fixed" ) {
331
+ return;
332
+ }
333
+ maxHeight -= elem.outerHeight( true );
334
+ });
335
+
336
+ this.headers.each(function() {
337
+ maxHeight -= $( this ).outerHeight( true );
338
+ });
339
+
340
+ this.headers.next()
341
+ .each(function() {
342
+ $( this ).height( Math.max( 0, maxHeight -
343
+ $( this ).innerHeight() + $( this ).height() ) );
344
+ })
345
+ .css( "overflow", "auto" );
346
+ } else if ( heightStyle === "auto" ) {
347
+ maxHeight = 0;
348
+ this.headers.next()
349
+ .each(function() {
350
+ maxHeight = Math.max( maxHeight, $( this ).css( "height", "" ).height() );
351
+ })
352
+ .height( maxHeight );
353
+ }
354
+ },
355
+
356
+ _activate: function( index ) {
357
+ var active = this._findActive( index )[ 0 ];
358
+
359
+ // trying to activate the already active panel
360
+ if ( active === this.active[ 0 ] ) {
361
+ return;
362
+ }
363
+
364
+ // trying to collapse, simulate a click on the currently active header
365
+ active = active || this.active[ 0 ];
366
+
367
+ this._eventHandler({
368
+ target: active,
369
+ currentTarget: active,
370
+ preventDefault: $.noop
371
+ });
372
+ },
373
+
374
+ _findActive: function( selector ) {
375
+ return typeof selector === "number" ? this.headers.eq( selector ) : $();
376
+ },
377
+
378
+ _setupEvents: function( event ) {
379
+ var events = {
380
+ keydown: "_keydown"
381
+ };
382
+ if ( event ) {
383
+ $.each( event.split(" "), function( index, eventName ) {
384
+ events[ eventName ] = "_eventHandler";
385
+ });
386
+ }
387
+
388
+ this._off( this.headers.add( this.headers.next() ) );
389
+ this._on( this.headers, events );
390
+ this._on( this.headers.next(), { keydown: "_panelKeyDown" });
391
+ this._hoverable( this.headers );
392
+ this._focusable( this.headers );
393
+ },
394
+
395
+ _eventHandler: function( event ) {
396
+ var options = this.options,
397
+ active = this.active,
398
+ clicked = $( event.currentTarget ),
399
+ clickedIsActive = clicked[ 0 ] === active[ 0 ],
400
+ collapsing = clickedIsActive && options.collapsible,
401
+ toShow = collapsing ? $() : clicked.next(),
402
+ toHide = active.next(),
403
+ eventData = {
404
+ oldHeader: active,
405
+ oldPanel: toHide,
406
+ newHeader: collapsing ? $() : clicked,
407
+ newPanel: toShow
408
+ };
409
+
410
+ event.preventDefault();
411
+
412
+ if (
413
+ // click on active header, but not collapsible
414
+ ( clickedIsActive && !options.collapsible ) ||
415
+ // allow canceling activation
416
+ ( this._trigger( "beforeActivate", event, eventData ) === false ) ) {
417
+ return;
418
+ }
419
+
420
+ options.active = collapsing ? false : this.headers.index( clicked );
421
+
422
+ // when the call to ._toggle() comes after the class changes
423
+ // it causes a very odd bug in IE 8 (see #6720)
424
+ this.active = clickedIsActive ? $() : clicked;
425
+ this._toggle( eventData );
426
+
427
+ // switch classes
428
+ // corner classes on the previously active header stay after the animation
429
+ active.removeClass( "ui-accordion-header-active ui-state-active" );
430
+ if ( options.icons ) {
431
+ active.children( ".ui-accordion-header-icon" )
432
+ .removeClass( options.icons.activeHeader )
433
+ .addClass( options.icons.header );
434
+ }
435
+
436
+ if ( !clickedIsActive ) {
437
+ clicked
438
+ .removeClass( "ui-corner-all" )
439
+ .addClass( "ui-accordion-header-active ui-state-active ui-corner-top" );
440
+ if ( options.icons ) {
441
+ clicked.children( ".ui-accordion-header-icon" )
442
+ .removeClass( options.icons.header )
443
+ .addClass( options.icons.activeHeader );
444
+ }
445
+
446
+ clicked
447
+ .next()
448
+ .addClass( "ui-accordion-content-active" );
449
+ }
450
+ },
451
+
452
+ _toggle: function( data ) {
453
+ var toShow = data.newPanel,
454
+ toHide = this.prevShow.length ? this.prevShow : data.oldPanel;
455
+
456
+ // handle activating a panel during the animation for another activation
457
+ this.prevShow.add( this.prevHide ).stop( true, true );
458
+ this.prevShow = toShow;
459
+ this.prevHide = toHide;
460
+
461
+ if ( this.options.animate ) {
462
+ this._animate( toShow, toHide, data );
463
+ } else {
464
+ toHide.hide();
465
+ toShow.show();
466
+ this._toggleComplete( data );
467
+ }
468
+
469
+ toHide.attr({
470
+ "aria-expanded": "false",
471
+ "aria-hidden": "true"
472
+ });
473
+ toHide.prev().attr( "aria-selected", "false" );
474
+ // if we're switching panels, remove the old header from the tab order
475
+ // if we're opening from collapsed state, remove the previous header from the tab order
476
+ // if we're collapsing, then keep the collapsing header in the tab order
477
+ if ( toShow.length && toHide.length ) {
478
+ toHide.prev().attr( "tabIndex", -1 );
479
+ } else if ( toShow.length ) {
480
+ this.headers.filter(function() {
481
+ return $( this ).attr( "tabIndex" ) === 0;
482
+ })
483
+ .attr( "tabIndex", -1 );
484
+ }
485
+
486
+ toShow
487
+ .attr({
488
+ "aria-expanded": "true",
489
+ "aria-hidden": "false"
490
+ })
491
+ .prev()
492
+ .attr({
493
+ "aria-selected": "true",
494
+ tabIndex: 0
495
+ });
496
+ },
497
+
498
+ _animate: function( toShow, toHide, data ) {
499
+ var total, easing, duration,
500
+ that = this,
501
+ adjust = 0,
502
+ down = toShow.length &&
503
+ ( !toHide.length || ( toShow.index() < toHide.index() ) ),
504
+ animate = this.options.animate || {},
505
+ options = down && animate.down || animate,
506
+ complete = function() {
507
+ that._toggleComplete( data );
508
+ };
509
+
510
+ if ( typeof options === "number" ) {
511
+ duration = options;
512
+ }
513
+ if ( typeof options === "string" ) {
514
+ easing = options;
515
+ }
516
+ // fall back from options to animation in case of partial down settings
517
+ easing = easing || options.easing || animate.easing;
518
+ duration = duration || options.duration || animate.duration;
519
+
520
+ if ( !toHide.length ) {
521
+ return toShow.animate( showProps, duration, easing, complete );
522
+ }
523
+ if ( !toShow.length ) {
524
+ return toHide.animate( hideProps, duration, easing, complete );
525
+ }
526
+
527
+ total = toShow.show().outerHeight();
528
+ toHide.animate( hideProps, {
529
+ duration: duration,
530
+ easing: easing,
531
+ step: function( now, fx ) {
532
+ fx.now = Math.round( now );
533
+ }
534
+ });
535
+ toShow
536
+ .hide()
537
+ .animate( showProps, {
538
+ duration: duration,
539
+ easing: easing,
540
+ complete: complete,
541
+ step: function( now, fx ) {
542
+ fx.now = Math.round( now );
543
+ if ( fx.prop !== "height" ) {
544
+ adjust += fx.now;
545
+ } else if ( that.options.heightStyle !== "content" ) {
546
+ fx.now = Math.round( total - toHide.outerHeight() - adjust );
547
+ adjust = 0;
548
+ }
549
+ }
550
+ });
551
+ },
552
+
553
+ _toggleComplete: function( data ) {
554
+ var toHide = data.oldPanel;
555
+
556
+ toHide
557
+ .removeClass( "ui-accordion-content-active" )
558
+ .prev()
559
+ .removeClass( "ui-corner-top" )
560
+ .addClass( "ui-corner-all" );
561
+
562
+ // Work around for rendering bug in IE (#5421)
563
+ if ( toHide.length ) {
564
+ toHide.parent()[0].className = toHide.parent()[0].className;
565
+ }
566
+
567
+ this._trigger( "activate", null, data );
568
+ }
569
+ });
570
+
571
+ })( jQuery );