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,767 @@
1
+ /*!
2
+ * jQuery UI Dialog @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/dialog/
10
+ *
11
+ * Depends:
12
+ * jquery.ui.core.js
13
+ * jquery.ui.widget.js
14
+ * jquery.ui.button.js
15
+ * jquery.ui.draggable.js
16
+ * jquery.ui.mouse.js
17
+ * jquery.ui.position.js
18
+ * jquery.ui.resizable.js
19
+ */
20
+ (function( $, undefined ) {
21
+
22
+ var sizeRelatedOptions = {
23
+ buttons: true,
24
+ height: true,
25
+ maxHeight: true,
26
+ maxWidth: true,
27
+ minHeight: true,
28
+ minWidth: true,
29
+ width: true
30
+ },
31
+ resizableRelatedOptions = {
32
+ maxHeight: true,
33
+ maxWidth: true,
34
+ minHeight: true,
35
+ minWidth: true
36
+ };
37
+
38
+ $.widget( "ui.dialog", {
39
+ version: "@VERSION",
40
+ options: {
41
+ appendTo: "body",
42
+ autoOpen: true,
43
+ buttons: [],
44
+ closeOnEscape: true,
45
+ closeText: "close",
46
+ dialogClass: "",
47
+ draggable: true,
48
+ hide: null,
49
+ height: "auto",
50
+ maxHeight: null,
51
+ maxWidth: null,
52
+ minHeight: 150,
53
+ minWidth: 150,
54
+ modal: false,
55
+ position: {
56
+ my: "center",
57
+ at: "center",
58
+ of: window,
59
+ collision: "fit",
60
+ // Ensure the titlebar is always visible
61
+ using: function( pos ) {
62
+ var topOffset = $( this ).css( pos ).offset().top;
63
+ if ( topOffset < 0 ) {
64
+ $( this ).css( "top", pos.top - topOffset );
65
+ }
66
+ }
67
+ },
68
+ resizable: true,
69
+ show: null,
70
+ title: null,
71
+ width: 300,
72
+
73
+ // callbacks
74
+ beforeClose: null,
75
+ close: null,
76
+ drag: null,
77
+ dragStart: null,
78
+ dragStop: null,
79
+ focus: null,
80
+ open: null,
81
+ resize: null,
82
+ resizeStart: null,
83
+ resizeStop: null
84
+ },
85
+
86
+ _create: function() {
87
+ this.originalCss = {
88
+ display: this.element[0].style.display,
89
+ width: this.element[0].style.width,
90
+ minHeight: this.element[0].style.minHeight,
91
+ maxHeight: this.element[0].style.maxHeight,
92
+ height: this.element[0].style.height
93
+ };
94
+ this.originalPosition = {
95
+ parent: this.element.parent(),
96
+ index: this.element.parent().children().index( this.element )
97
+ };
98
+ this.originalTitle = this.element.attr("title");
99
+ this.options.title = this.options.title || this.originalTitle;
100
+
101
+ this._createWrapper();
102
+
103
+ this.element
104
+ .show()
105
+ .removeAttr("title")
106
+ .addClass("ui-dialog-content ui-widget-content")
107
+ .appendTo( this.uiDialog );
108
+
109
+ this._createTitlebar();
110
+ this._createButtonPane();
111
+
112
+ if ( this.options.draggable && $.fn.draggable ) {
113
+ this._makeDraggable();
114
+ }
115
+ if ( this.options.resizable && $.fn.resizable ) {
116
+ this._makeResizable();
117
+ }
118
+
119
+ this._isOpen = false;
120
+ },
121
+
122
+ _init: function() {
123
+ if ( this.options.autoOpen ) {
124
+ this.open();
125
+ }
126
+ },
127
+
128
+ _appendTo: function() {
129
+ var element = this.options.appendTo;
130
+ if ( element && (element.jquery || element.nodeType) ) {
131
+ return $( element );
132
+ }
133
+ return this.document.find( element || "body" ).eq( 0 );
134
+ },
135
+
136
+ _destroy: function() {
137
+ var next,
138
+ originalPosition = this.originalPosition;
139
+
140
+ this._destroyOverlay();
141
+
142
+ this.element
143
+ .removeUniqueId()
144
+ .removeClass("ui-dialog-content ui-widget-content")
145
+ .css( this.originalCss )
146
+ // Without detaching first, the following becomes really slow
147
+ .detach();
148
+
149
+ this.uiDialog.stop( true, true ).remove();
150
+
151
+ if ( this.originalTitle ) {
152
+ this.element.attr( "title", this.originalTitle );
153
+ }
154
+
155
+ next = originalPosition.parent.children().eq( originalPosition.index );
156
+ // Don't try to place the dialog next to itself (#8613)
157
+ if ( next.length && next[0] !== this.element[0] ) {
158
+ next.before( this.element );
159
+ } else {
160
+ originalPosition.parent.append( this.element );
161
+ }
162
+ },
163
+
164
+ widget: function() {
165
+ return this.uiDialog;
166
+ },
167
+
168
+ disable: $.noop,
169
+ enable: $.noop,
170
+
171
+ close: function( event ) {
172
+ var that = this;
173
+
174
+ if ( !this._isOpen || this._trigger( "beforeClose", event ) === false ) {
175
+ return;
176
+ }
177
+
178
+ this._isOpen = false;
179
+ this._destroyOverlay();
180
+
181
+ if ( !this.opener.filter(":focusable").focus().length ) {
182
+ // Hiding a focused element doesn't trigger blur in WebKit
183
+ // so in case we have nothing to focus on, explicitly blur the active element
184
+ // https://bugs.webkit.org/show_bug.cgi?id=47182
185
+ $( this.document[0].activeElement ).blur();
186
+ }
187
+
188
+ this._hide( this.uiDialog, this.options.hide, function() {
189
+ that._trigger( "close", event );
190
+ });
191
+ },
192
+
193
+ isOpen: function() {
194
+ return this._isOpen;
195
+ },
196
+
197
+ moveToTop: function() {
198
+ this._moveToTop();
199
+ },
200
+
201
+ _moveToTop: function( event, silent ) {
202
+ var moved = !!this.uiDialog.nextAll(":visible").insertBefore( this.uiDialog ).length;
203
+ if ( moved && !silent ) {
204
+ this._trigger( "focus", event );
205
+ }
206
+ return moved;
207
+ },
208
+
209
+ open: function() {
210
+ if ( this._isOpen ) {
211
+ if ( this._moveToTop() ) {
212
+ this._focusTabbable();
213
+ }
214
+ return;
215
+ }
216
+
217
+ this.opener = $( this.document[0].activeElement );
218
+
219
+ this._size();
220
+ this._position();
221
+ this._createOverlay();
222
+ this._moveToTop( null, true );
223
+ this._show( this.uiDialog, this.options.show );
224
+
225
+ this._focusTabbable();
226
+
227
+ this._isOpen = true;
228
+ this._trigger("open");
229
+ this._trigger("focus");
230
+ },
231
+
232
+ _focusTabbable: function() {
233
+ // Set focus to the first match:
234
+ // 1. First element inside the dialog matching [autofocus]
235
+ // 2. Tabbable element inside the content element
236
+ // 3. Tabbable element inside the buttonpane
237
+ // 4. The close button
238
+ // 5. The dialog itself
239
+ var hasFocus = this.element.find("[autofocus]");
240
+ if ( !hasFocus.length ) {
241
+ hasFocus = this.element.find(":tabbable");
242
+ }
243
+ if ( !hasFocus.length ) {
244
+ hasFocus = this.uiDialogButtonPane.find(":tabbable");
245
+ }
246
+ if ( !hasFocus.length ) {
247
+ hasFocus = this.uiDialogTitlebarClose.filter(":tabbable");
248
+ }
249
+ if ( !hasFocus.length ) {
250
+ hasFocus = this.uiDialog;
251
+ }
252
+ hasFocus.eq( 0 ).focus();
253
+ },
254
+
255
+ _keepFocus: function( event ) {
256
+ function checkFocus() {
257
+ var activeElement = this.document[0].activeElement,
258
+ isActive = this.uiDialog[0] === activeElement ||
259
+ $.contains( this.uiDialog[0], activeElement );
260
+ if ( !isActive ) {
261
+ this._focusTabbable();
262
+ }
263
+ }
264
+ event.preventDefault();
265
+ checkFocus.call( this );
266
+ // support: IE
267
+ // IE <= 8 doesn't prevent moving focus even with event.preventDefault()
268
+ // so we check again later
269
+ this._delay( checkFocus );
270
+ },
271
+
272
+ _createWrapper: function() {
273
+ this.uiDialog = $("<div>")
274
+ .addClass( "ui-dialog ui-widget ui-widget-content ui-corner-all ui-front " +
275
+ this.options.dialogClass )
276
+ .hide()
277
+ .attr({
278
+ // Setting tabIndex makes the div focusable
279
+ tabIndex: -1,
280
+ role: "dialog"
281
+ })
282
+ .appendTo( this._appendTo() );
283
+
284
+ this._on( this.uiDialog, {
285
+ keydown: function( event ) {
286
+ if ( this.options.closeOnEscape && !event.isDefaultPrevented() && event.keyCode &&
287
+ event.keyCode === $.ui.keyCode.ESCAPE ) {
288
+ event.preventDefault();
289
+ this.close( event );
290
+ return;
291
+ }
292
+
293
+ // prevent tabbing out of dialogs
294
+ if ( event.keyCode !== $.ui.keyCode.TAB ) {
295
+ return;
296
+ }
297
+ var tabbables = this.uiDialog.find(":tabbable"),
298
+ first = tabbables.filter(":first"),
299
+ last = tabbables.filter(":last");
300
+
301
+ if ( ( event.target === last[0] || event.target === this.uiDialog[0] ) && !event.shiftKey ) {
302
+ first.focus( 1 );
303
+ event.preventDefault();
304
+ } else if ( ( event.target === first[0] || event.target === this.uiDialog[0] ) && event.shiftKey ) {
305
+ last.focus( 1 );
306
+ event.preventDefault();
307
+ }
308
+ },
309
+ mousedown: function( event ) {
310
+ if ( this._moveToTop( event ) ) {
311
+ this._focusTabbable();
312
+ }
313
+ }
314
+ });
315
+
316
+ // We assume that any existing aria-describedby attribute means
317
+ // that the dialog content is marked up properly
318
+ // otherwise we brute force the content as the description
319
+ if ( !this.element.find("[aria-describedby]").length ) {
320
+ this.uiDialog.attr({
321
+ "aria-describedby": this.element.uniqueId().attr("id")
322
+ });
323
+ }
324
+ },
325
+
326
+ _createTitlebar: function() {
327
+ var uiDialogTitle;
328
+
329
+ this.uiDialogTitlebar = $("<div>")
330
+ .addClass("ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix")
331
+ .prependTo( this.uiDialog );
332
+ this._on( this.uiDialogTitlebar, {
333
+ mousedown: function( event ) {
334
+ // Don't prevent click on close button (#8838)
335
+ // Focusing a dialog that is partially scrolled out of view
336
+ // causes the browser to scroll it into view, preventing the click event
337
+ if ( !$( event.target ).closest(".ui-dialog-titlebar-close") ) {
338
+ // Dialog isn't getting focus when dragging (#8063)
339
+ this.uiDialog.focus();
340
+ }
341
+ }
342
+ });
343
+
344
+ this.uiDialogTitlebarClose = $("<button></button>")
345
+ .button({
346
+ label: this.options.closeText,
347
+ icons: {
348
+ primary: "ui-icon-closethick"
349
+ },
350
+ text: false
351
+ })
352
+ .addClass("ui-dialog-titlebar-close")
353
+ .appendTo( this.uiDialogTitlebar );
354
+ this._on( this.uiDialogTitlebarClose, {
355
+ click: function( event ) {
356
+ event.preventDefault();
357
+ this.close( event );
358
+ }
359
+ });
360
+
361
+ uiDialogTitle = $("<span>")
362
+ .uniqueId()
363
+ .addClass("ui-dialog-title")
364
+ .prependTo( this.uiDialogTitlebar );
365
+ this._title( uiDialogTitle );
366
+
367
+ this.uiDialog.attr({
368
+ "aria-labelledby": uiDialogTitle.attr("id")
369
+ });
370
+ },
371
+
372
+ _title: function( title ) {
373
+ if ( !this.options.title ) {
374
+ title.html("&#160;");
375
+ }
376
+ title.text( this.options.title );
377
+ },
378
+
379
+ _createButtonPane: function() {
380
+ this.uiDialogButtonPane = $("<div>")
381
+ .addClass("ui-dialog-buttonpane ui-widget-content ui-helper-clearfix");
382
+
383
+ this.uiButtonSet = $("<div>")
384
+ .addClass("ui-dialog-buttonset")
385
+ .appendTo( this.uiDialogButtonPane );
386
+
387
+ this._createButtons();
388
+ },
389
+
390
+ _createButtons: function() {
391
+ var that = this,
392
+ buttons = this.options.buttons;
393
+
394
+ // if we already have a button pane, remove it
395
+ this.uiDialogButtonPane.remove();
396
+ this.uiButtonSet.empty();
397
+
398
+ if ( $.isEmptyObject( buttons ) ) {
399
+ this.uiDialog.removeClass("ui-dialog-buttons");
400
+ return;
401
+ }
402
+
403
+ $.each( buttons, function( name, props ) {
404
+ var click, buttonOptions;
405
+ props = $.isFunction( props ) ?
406
+ { click: props, text: name } :
407
+ props;
408
+ // Default to a non-submitting button
409
+ props = $.extend( { type: "button" }, props );
410
+ // Change the context for the click callback to be the main element
411
+ click = props.click;
412
+ props.click = function() {
413
+ click.apply( that.element[0], arguments );
414
+ };
415
+ buttonOptions = {
416
+ icons: props.icons,
417
+ text: props.showText
418
+ };
419
+ delete props.icons;
420
+ delete props.showText;
421
+ $( "<button></button>", props )
422
+ .button( buttonOptions )
423
+ .appendTo( that.uiButtonSet );
424
+ });
425
+ this.uiDialog.addClass("ui-dialog-buttons");
426
+ this.uiDialogButtonPane.appendTo( this.uiDialog );
427
+ },
428
+
429
+ _makeDraggable: function() {
430
+ var that = this,
431
+ options = this.options;
432
+
433
+ function filteredUi( ui ) {
434
+ return {
435
+ position: ui.position,
436
+ offset: ui.offset
437
+ };
438
+ }
439
+
440
+ this.uiDialog.draggable({
441
+ cancel: ".ui-dialog-content, .ui-dialog-titlebar-close",
442
+ handle: ".ui-dialog-titlebar",
443
+ containment: "document",
444
+ start: function( event, ui ) {
445
+ $( this ).addClass("ui-dialog-dragging");
446
+ that._trigger( "dragStart", event, filteredUi( ui ) );
447
+ },
448
+ drag: function( event, ui ) {
449
+ that._trigger( "drag", event, filteredUi( ui ) );
450
+ },
451
+ stop: function( event, ui ) {
452
+ options.position = [
453
+ ui.position.left - that.document.scrollLeft(),
454
+ ui.position.top - that.document.scrollTop()
455
+ ];
456
+ $( this ).removeClass("ui-dialog-dragging");
457
+ that._trigger( "dragStop", event, filteredUi( ui ) );
458
+ }
459
+ });
460
+ },
461
+
462
+ _makeResizable: function() {
463
+ var that = this,
464
+ options = this.options,
465
+ handles = options.resizable,
466
+ // .ui-resizable has position: relative defined in the stylesheet
467
+ // but dialogs have to use absolute or fixed positioning
468
+ position = this.uiDialog.css("position"),
469
+ resizeHandles = typeof handles === "string" ?
470
+ handles :
471
+ "n,e,s,w,se,sw,ne,nw";
472
+
473
+ function filteredUi( ui ) {
474
+ return {
475
+ originalPosition: ui.originalPosition,
476
+ originalSize: ui.originalSize,
477
+ position: ui.position,
478
+ size: ui.size
479
+ };
480
+ }
481
+
482
+ this.uiDialog.resizable({
483
+ cancel: ".ui-dialog-content",
484
+ containment: "document",
485
+ alsoResize: this.element,
486
+ maxWidth: options.maxWidth,
487
+ maxHeight: options.maxHeight,
488
+ minWidth: options.minWidth,
489
+ minHeight: this._minHeight(),
490
+ handles: resizeHandles,
491
+ start: function( event, ui ) {
492
+ $( this ).addClass("ui-dialog-resizing");
493
+ that._trigger( "resizeStart", event, filteredUi( ui ) );
494
+ },
495
+ resize: function( event, ui ) {
496
+ that._trigger( "resize", event, filteredUi( ui ) );
497
+ },
498
+ stop: function( event, ui ) {
499
+ options.height = $( this ).height();
500
+ options.width = $( this ).width();
501
+ $( this ).removeClass("ui-dialog-resizing");
502
+ that._trigger( "resizeStop", event, filteredUi( ui ) );
503
+ }
504
+ })
505
+ .css( "position", position );
506
+ },
507
+
508
+ _minHeight: function() {
509
+ var options = this.options;
510
+
511
+ return options.height === "auto" ?
512
+ options.minHeight :
513
+ Math.min( options.minHeight, options.height );
514
+ },
515
+
516
+ _position: function() {
517
+ // Need to show the dialog to get the actual offset in the position plugin
518
+ var isVisible = this.uiDialog.is(":visible");
519
+ if ( !isVisible ) {
520
+ this.uiDialog.show();
521
+ }
522
+ this.uiDialog.position( this.options.position );
523
+ if ( !isVisible ) {
524
+ this.uiDialog.hide();
525
+ }
526
+ },
527
+
528
+ _setOptions: function( options ) {
529
+ var that = this,
530
+ resize = false,
531
+ resizableOptions = {};
532
+
533
+ $.each( options, function( key, value ) {
534
+ that._setOption( key, value );
535
+
536
+ if ( key in sizeRelatedOptions ) {
537
+ resize = true;
538
+ }
539
+ if ( key in resizableRelatedOptions ) {
540
+ resizableOptions[ key ] = value;
541
+ }
542
+ });
543
+
544
+ if ( resize ) {
545
+ this._size();
546
+ this._position();
547
+ }
548
+ if ( this.uiDialog.is(":data(ui-resizable)") ) {
549
+ this.uiDialog.resizable( "option", resizableOptions );
550
+ }
551
+ },
552
+
553
+ _setOption: function( key, value ) {
554
+ /*jshint maxcomplexity:15*/
555
+ var isDraggable, isResizable,
556
+ uiDialog = this.uiDialog;
557
+
558
+ if ( key === "dialogClass" ) {
559
+ uiDialog
560
+ .removeClass( this.options.dialogClass )
561
+ .addClass( value );
562
+ }
563
+
564
+ if ( key === "disabled" ) {
565
+ return;
566
+ }
567
+
568
+ this._super( key, value );
569
+
570
+ if ( key === "appendTo" ) {
571
+ this.uiDialog.appendTo( this._appendTo() );
572
+ }
573
+
574
+ if ( key === "buttons" ) {
575
+ this._createButtons();
576
+ }
577
+
578
+ if ( key === "closeText" ) {
579
+ this.uiDialogTitlebarClose.button({
580
+ // Ensure that we always pass a string
581
+ label: "" + value
582
+ });
583
+ }
584
+
585
+ if ( key === "draggable" ) {
586
+ isDraggable = uiDialog.is(":data(ui-draggable)");
587
+ if ( isDraggable && !value ) {
588
+ uiDialog.draggable("destroy");
589
+ }
590
+
591
+ if ( !isDraggable && value ) {
592
+ this._makeDraggable();
593
+ }
594
+ }
595
+
596
+ if ( key === "position" ) {
597
+ this._position();
598
+ }
599
+
600
+ if ( key === "resizable" ) {
601
+ // currently resizable, becoming non-resizable
602
+ isResizable = uiDialog.is(":data(ui-resizable)");
603
+ if ( isResizable && !value ) {
604
+ uiDialog.resizable("destroy");
605
+ }
606
+
607
+ // currently resizable, changing handles
608
+ if ( isResizable && typeof value === "string" ) {
609
+ uiDialog.resizable( "option", "handles", value );
610
+ }
611
+
612
+ // currently non-resizable, becoming resizable
613
+ if ( !isResizable && value !== false ) {
614
+ this._makeResizable();
615
+ }
616
+ }
617
+
618
+ if ( key === "title" ) {
619
+ this._title( this.uiDialogTitlebar.find(".ui-dialog-title") );
620
+ }
621
+ },
622
+
623
+ _size: function() {
624
+ // If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
625
+ // divs will both have width and height set, so we need to reset them
626
+ var nonContentHeight, minContentHeight, maxContentHeight,
627
+ options = this.options;
628
+
629
+ // Reset content sizing
630
+ this.element.show().css({
631
+ width: "auto",
632
+ minHeight: 0,
633
+ maxHeight: "none",
634
+ height: 0
635
+ });
636
+
637
+ if ( options.minWidth > options.width ) {
638
+ options.width = options.minWidth;
639
+ }
640
+
641
+ // reset wrapper sizing
642
+ // determine the height of all the non-content elements
643
+ nonContentHeight = this.uiDialog.css({
644
+ height: "auto",
645
+ width: options.width
646
+ })
647
+ .outerHeight();
648
+ minContentHeight = Math.max( 0, options.minHeight - nonContentHeight );
649
+ maxContentHeight = typeof options.maxHeight === "number" ?
650
+ Math.max( 0, options.maxHeight - nonContentHeight ) :
651
+ "none";
652
+
653
+ if ( options.height === "auto" ) {
654
+ this.element.css({
655
+ minHeight: minContentHeight,
656
+ maxHeight: maxContentHeight,
657
+ height: "auto"
658
+ });
659
+ } else {
660
+ this.element.height( Math.max( 0, options.height - nonContentHeight ) );
661
+ }
662
+
663
+ if (this.uiDialog.is(":data(ui-resizable)") ) {
664
+ this.uiDialog.resizable( "option", "minHeight", this._minHeight() );
665
+ }
666
+ },
667
+
668
+ _createOverlay: function() {
669
+ if ( !this.options.modal ) {
670
+ return;
671
+ }
672
+
673
+ if ( !$.ui.dialog.overlayInstances ) {
674
+ // Prevent use of anchors and inputs.
675
+ // We use a delay in case the overlay is created from an
676
+ // event that we're going to be cancelling. (#2804)
677
+ this._delay(function() {
678
+ // Handle .dialog().dialog("close") (#4065)
679
+ if ( $.ui.dialog.overlayInstances ) {
680
+ this._on( this.document, {
681
+ focusin: function( event ) {
682
+ if ( !$( event.target ).closest(".ui-dialog").length ) {
683
+ event.preventDefault();
684
+ $(".ui-dialog:visible:last .ui-dialog-content")
685
+ .data("ui-dialog")._focusTabbable();
686
+ }
687
+ }
688
+ });
689
+ }
690
+ });
691
+ }
692
+
693
+ this.overlay = $("<div>")
694
+ .addClass("ui-widget-overlay ui-front")
695
+ .appendTo( this.document[0].body );
696
+ this._on( this.overlay, {
697
+ mousedown: "_keepFocus"
698
+ });
699
+ $.ui.dialog.overlayInstances++;
700
+ },
701
+
702
+ _destroyOverlay: function() {
703
+ if ( !this.options.modal ) {
704
+ return;
705
+ }
706
+
707
+ $.ui.dialog.overlayInstances--;
708
+ if ( !$.ui.dialog.overlayInstances ) {
709
+ this._off( this.document, "focusin" );
710
+ }
711
+ this.overlay.remove();
712
+ }
713
+ });
714
+
715
+ $.ui.dialog.overlayInstances = 0;
716
+
717
+ // DEPRECATED
718
+ if ( $.uiBackCompat !== false ) {
719
+ // position option with array notation
720
+ // just override with old implementation
721
+ $.widget( "ui.dialog", $.ui.dialog, {
722
+ _position: function() {
723
+ var position = this.options.position,
724
+ myAt = [],
725
+ offset = [ 0, 0 ],
726
+ isVisible;
727
+
728
+ if ( position ) {
729
+ if ( typeof position === "string" || (typeof position === "object" && "0" in position ) ) {
730
+ myAt = position.split ? position.split(" ") : [ position[0], position[1] ];
731
+ if ( myAt.length === 1 ) {
732
+ myAt[1] = myAt[0];
733
+ }
734
+
735
+ $.each( [ "left", "top" ], function( i, offsetPosition ) {
736
+ if ( +myAt[ i ] === myAt[ i ] ) {
737
+ offset[ i ] = myAt[ i ];
738
+ myAt[ i ] = offsetPosition;
739
+ }
740
+ });
741
+
742
+ position = {
743
+ my: myAt[0] + (offset[0] < 0 ? offset[0] : "+" + offset[0]) + " " +
744
+ myAt[1] + (offset[1] < 0 ? offset[1] : "+" + offset[1]),
745
+ at: myAt.join(" ")
746
+ };
747
+ }
748
+
749
+ position = $.extend( {}, $.ui.dialog.prototype.options.position, position );
750
+ } else {
751
+ position = $.ui.dialog.prototype.options.position;
752
+ }
753
+
754
+ // need to show the dialog to get the actual offset in the position plugin
755
+ isVisible = this.uiDialog.is(":visible");
756
+ if ( !isVisible ) {
757
+ this.uiDialog.show();
758
+ }
759
+ this.uiDialog.position( position );
760
+ if ( !isVisible ) {
761
+ this.uiDialog.hide();
762
+ }
763
+ }
764
+ });
765
+ }
766
+
767
+ }( jQuery ) );