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
@@ -58,7 +58,9 @@ module Spider; module Forms
58
58
  tree_el = @model.elements_array.select{ |el| el.association == :tree }.first
59
59
  end
60
60
  if tree_el
61
- @scene.data = @scene.data.model.send("#{tree_el.name}_all", @scene.data.condition)
61
+ #chiamata al metodo modificata dopo modifica in tree.rb nel define_method senza la condizione
62
+ #@scene.data = @scene.data.model.send("#{tree_el.name}_all", @scene.data.condition)
63
+ @scene.data = @scene.data.model.send("#{tree_el.name}_all")
62
64
  @scene.data.reject!{ |obj| obj == @form.obj } if @form && @form.obj
63
65
  @scene.tree_depth = tree_el.attributes[:tree_depth]
64
66
  end
@@ -66,25 +68,25 @@ module Spider; module Forms
66
68
  if @value
67
69
  val = @multiple ? @value : [@value]
68
70
  val.each do |v|
69
- @scene.selected[@model.primary_keys.map{|k| v.get(k) }.join(',')] = true
71
+ @scene.selected[obj_to_key_str(v)] = true
70
72
  end
71
73
  end
72
74
  @scene.data.each_index do |i|
73
- @scene.values[i] = @model.primary_keys.map{|k| @scene.data[i][k] }.join(',')
75
+ @scene.values[i] = obj_to_key_str(@scene.data[i])
74
76
  end
75
77
  super
76
78
  end
77
79
 
78
80
 
79
81
  def value=(val)
80
- if (val.nil? || (val.is_a?(String) && val.empty?))
82
+ if val.blank?
81
83
  @value = nil
82
84
  return
83
85
  end
84
- if (val.is_a?(@model) || val.is_a?(Spider::Model::QuerySet))
86
+ if val.is_a?(@model) || val.is_a?(Spider::Model::QuerySet)
85
87
  return super
86
88
  else
87
- if (@multiple)
89
+ if @multiple
88
90
  val = [val] unless val.is_a?(Array)
89
91
  qs = Spider::Model::QuerySet.static(@model)
90
92
  val.each do |v|
@@ -99,22 +101,15 @@ module Spider; module Forms
99
101
  end
100
102
 
101
103
  def obj_to_key_str(obj)
102
- @model.primary_keys.map{|k| obj.get(k) }.join(',')
104
+ obj.keys_string
103
105
  end
104
106
 
105
107
  def str_to_pks(val)
106
- if (val.is_a?(String))
107
- parts = val.split(',')
108
- pk = {}
109
- @model.primary_keys.each{ |k| pk[k.name] = parts.shift}
110
- else
111
- pk = val
112
- end
113
- return pk
108
+ val.is_a?(String) ? @model.split_keys_string(val) : val
114
109
  end
115
110
 
116
111
  def connection_condition
117
- if (@connections && @form)
112
+ if @connections && @form
118
113
  conn_cond = Spider::Model::Condition.and
119
114
  conn_param = params['connected'] || {}
120
115
  @connections.each do |el, conn|
@@ -16,22 +16,22 @@ module Spider
16
16
  config_option 'messenger.queue.run_every', _("Time in seconds between queue runs"), :type => Fixnum, :default => 60
17
17
 
18
18
  config_option 'messenger.email.backends', _("The backends to use for sending mail (if more than one)"), :type => Array,
19
- :default => lambda{ Spider.conf.get('messenger.email.backend') ? [Spider.conf.get('messenger.email.backend')] : [] }
19
+ :default => Proc.new{ Spider.conf.get('messenger.email.backend') ? [Spider.conf.get('messenger.email.backend')] : [] }
20
20
  config_option 'messenger.email.backend', _("The backend to use for sending sms"), :type => String, :default => 'smtp'
21
21
 
22
22
  config_option 'messenger.sms.backends', _("The backends to use for sending sms (if more than one)"), :type => Array,
23
- :default => lambda{ Spider.conf.get('messenger.sms.backend') ? [Spider.conf.get('messenger.sms.backend')] : [] }
23
+ :default => Proc.new{ Spider.conf.get('messenger.sms.backend') ? [Spider.conf.get('messenger.sms.backend')] : [] }
24
24
  config_option 'messenger.sms.backend', _("The backend to use for sending sms"), :type => String
25
25
  config_option 'messenger.sms.retries', _("How many times to retry sending an sms"), :type => Fixnum, :default => 5
26
26
  config_option 'messenger.sms.retry_time', _("Seconds to wait until retry (will be incremented at each retry)"),
27
27
  :type => Fixnum, :default => 10
28
28
  config_option 'messenger.smstools.path_spool', _("The path to the smstools 'spool' folder"), :default => '/var/spool/sms'
29
29
  config_option 'messenger.smstools.path_outgoing', _("The path to the smstools 'outgoing' folder"),
30
- :default => lambda{ File.join(Spider.conf.get('messenger.smstools.path_spool'), 'outgoing')}
30
+ :default => Proc.new{ File.join(Spider.conf.get('messenger.smstools.path_spool'), 'outgoing')}
31
31
  config_option 'messenger.smstools.path_failed', _("The path to the smstools 'failed' folder"),
32
- :default => lambda{ File.join(Spider.conf.get('messenger.smstools.path_spool'), 'failed')}
32
+ :default => Proc.new{ File.join(Spider.conf.get('messenger.smstools.path_spool'), 'failed')}
33
33
  config_option 'messenger.smstools.path_sent', _("The path to the smstools 'sent' folder"),
34
- :default => lambda{ File.join(Spider.conf.get('messenger.smstools.path_sent'), 'sent')}
34
+ :default => Proc.new{ File.join(Spider.conf.get('messenger.smstools.path_sent'), 'sent')}
35
35
  config_option 'messenger.smstools.remove_failed', _("Whether to remove failed messages from the smstools failed folder"),
36
36
  :type => Spider::Bool, :default => true
37
37
  config_option 'messenger.smstools.remove_sent', _("Whether to remove failed messages from the smstools sent folder"),
@@ -4,7 +4,7 @@ module Spider; module Messenger
4
4
  layout ['/core/admin/admin', 'admin/_admin'], :assets => 'messenger'
5
5
 
6
6
  Messenger.queues.keys.each do |queue|
7
- route queue.to_s, :queue, :do => lambda{ |action| @queue = action.to_sym }
7
+ route queue.to_s, :queue, :do => Proc.new{ |action| @queue = action.to_sym }
8
8
  end
9
9
 
10
10
  def before(action='', *params)
@@ -6,7 +6,7 @@ module Spider; module Messenger
6
6
  layout [:spider_admin, 'messenger.layout']
7
7
 
8
8
  Messenger.queues.keys.each do |queue|
9
- route queue.to_s, self, :do => lambda{ |action| @queue = @dispatch_action }
9
+ route queue.to_s, self, :do => Proc.new{ |action| @queue = @dispatch_action }
10
10
  end
11
11
 
12
12
  def before(action='', *params)
@@ -35,7 +35,7 @@ module Spider::Messenger
35
35
  case response
36
36
  when Net::HTTPSuccess
37
37
  if response.body !~ /^OK/
38
- raise response.body
38
+ raise response.body.to_s
39
39
  else
40
40
  return true
41
41
  end
@@ -108,8 +108,10 @@ module Spider
108
108
 
109
109
  end
110
110
  ensure
111
- File.open(lock_file, 'r'){ |f| f.flock File::LOCK_UN }
112
- File.unlink(lock_file)
111
+ if File.exists?(lock_file)
112
+ File.open(lock_file, 'r'){ |f| f.flock File::LOCK_UN }
113
+ File.unlink(lock_file)
114
+ end
113
115
  end
114
116
  end
115
117
  end
@@ -2,7 +2,7 @@
2
2
  <h3>_(Queues)</h3>
3
3
  <ul>
4
4
  <li sp:each="@queues |name|">
5
- <a href="{ @controller[:url] }/{ name }">{ @queue_info[name][:label] }</a>:
5
+ <a href="{ Spider::Messenger::AdminController.http_url }/{ name }">{ @queue_info[name][:label] }</a>:
6
6
  <ul>
7
7
  <li>_(Sent messages): <span class="label success">{ @queue_info[name][:sent] }</span></li>
8
8
  <li>_(Queued messages): <span class="label warning">{ @queue_info[name][:queued] }</span></li>
@@ -109,7 +109,7 @@ module Spider
109
109
  end
110
110
 
111
111
  def dispatcher_get_route(path)
112
- route = get_route(path)
112
+ route = get_route(path)
113
113
  return route if !route || route.obj
114
114
  obj = dispatched_object(route)
115
115
  obj.dispatch_previous = self if obj.respond_to?(:dispatch_previous=) && obj != self
@@ -124,13 +124,13 @@ module Spider
124
124
 
125
125
  # Looks in defined routes, and returns the first matching Route for path.
126
126
  def get_route(path)
127
- path ||= ''
127
+ path ||= ''
128
128
  r = routes + self.class.routes
129
129
  if nil_route = self.class.nil_route
130
130
  r << [nil, nil_route[0], nil_route[1]]
131
131
  end
132
132
  r.each do |route|
133
- try, dest, options = route
133
+ try, dest, options = route
134
134
  action = nil
135
135
  nil_route = false
136
136
  next if options[:http_method] && @request.http_method != options[:http_method]
@@ -145,8 +145,8 @@ module Spider
145
145
  test_path = path.downcase
146
146
  try.downcase!
147
147
  end
148
- if (test_path[0..(try.length-1)] == try)
149
- action = path[(try.length)..-1]
148
+ if (test_path == try || (test_path[0..(try.length-1)] == try && (try[-1].chr == '/' || test_path[try.length].chr == '/')))
149
+ action = path[(try.length)..-1]
150
150
  matched = try
151
151
  end
152
152
  when Regexp
@@ -29,9 +29,10 @@ module Spider; module ControllerMixins
29
29
  obj = n_route.obj if n_route
30
30
  if obj.is_a?(Visual) && !(obj.respond_to?(:serving_static?) && obj.serving_static?)
31
31
  set_layout = @layout
32
+ layout_params = self.class.layout_params[@layout]
32
33
  if set_layout
33
34
  set_layout = [set_layout] unless set_layout.is_a?(Array)
34
- set_layout.map{ |l| self.class.load_layout(l) }
35
+ set_layout.map{ |l| self.class.load_layout(l, layout_params) }
35
36
  obj.dispatcher_layout = set_layout
36
37
  end
37
38
  end
@@ -206,8 +207,8 @@ module Spider; module ControllerMixins
206
207
  return template
207
208
  end
208
209
 
209
- def init_layout(layout)
210
- l = layout.is_a?(Layout) ? layout : self.class.load_layout(layout)
210
+ def init_layout(layout, params={})
211
+ l = layout.is_a?(Layout) ? layout : self.class.load_layout(layout, params)
211
212
  prepare_template(l)
212
213
  return l
213
214
  end
@@ -226,12 +227,14 @@ module Spider; module ControllerMixins
226
227
  layout = nil
227
228
  unless options.key?(:layout) && !options[:layout]
228
229
  chosen_layouts = options[:layout] || @layout
230
+ layout_params = self.class.layout_params[chosen_layouts]
229
231
  chosen_layouts = [chosen_layouts] if chosen_layouts && !chosen_layouts.is_a?(Array)
230
232
  if (chosen_layouts)
231
233
  t = template
232
234
  layout = nil
233
235
  (chosen_layouts.length-1).downto(0) do |i|
234
- layout = init_layout(chosen_layouts[i])
236
+ l_params = layout_params if layout_params && i == 0
237
+ layout = init_layout(chosen_layouts[i], layout_params)
235
238
  layout.template = t
236
239
  t = layout
237
240
  end
@@ -587,11 +590,11 @@ module Spider; module ControllerMixins
587
590
  return false
588
591
  end
589
592
 
590
- def load_layout(path)
593
+ def load_layout(path, params={})
591
594
  unless respond_to?(:layout_path)
592
595
  raise NotImplementedError, "The layout_path class method must be implemented by object using the Visual mixin, but #{self} does not"
593
596
  end
594
- params = self.layout_params[path] || {}
597
+ params ||= self.layout_params[path] || {}
595
598
  if (path.is_a?(Symbol))
596
599
  path = Spider::Layout.named_layouts[path]
597
600
  end
@@ -604,8 +607,7 @@ module Spider; module ControllerMixins
604
607
  layout.only_asset_profiles(params[:only_asset_profiles]) if params[:only_asset_profiles]
605
608
  layout
606
609
  end
607
-
608
-
610
+
609
611
  def current_default_template
610
612
  Spider::Inflector.underscore(self.to_s.split('::')[-1])
611
613
  end
@@ -253,7 +253,7 @@ module Spider
253
253
  content_length -= boundary_size
254
254
  status = input.read(boundary_size)
255
255
  raise ArgumentError, "bad content body:\n'#{status}' should == '#{boundary + EOL}'" unless status == boundary + EOL
256
- rx = /(?:#{EOL})?#{Regexp.quote(boundary,'n')}(#{EOL}|--)/
256
+ rx = /(?:#{EOL})?#{Regexp.quote(boundary)}(#{EOL}|--)/
257
257
  files = []
258
258
  loop {
259
259
  head = nil
@@ -274,7 +274,7 @@ module Spider; module Model
274
274
  if (attributes[:through])
275
275
  assoc_type = attributes[:through]
276
276
  create_junction = false
277
- elsif (first_model.const_defined?(assoc_type_name) )
277
+ elsif (first_model.constant_defined?(assoc_type_name) )
278
278
  assoc_type = first_model.const_get(assoc_type_name)
279
279
  if (!assoc_type.attributes[:sub_model]) # other kind of inline model
280
280
  assoc_type_name += 'Junction'
@@ -2426,7 +2426,7 @@ module Spider; module Model
2426
2426
  val ? "#{name.to_json}: #{val.to_json}" : nil
2427
2427
  else
2428
2428
  val = get(name)
2429
- if (el.type == 'text' || el.type == 'longText')
2429
+ if (el.type == String || el.type == Text)
2430
2430
  val = ic.iconv(val + ' ')[0..-2]
2431
2431
  end
2432
2432
  val = val.to_json
@@ -1015,7 +1015,8 @@ module Spider; module Model; module Mappers
1015
1015
  set = obj.send("#{element.name}_junction")
1016
1016
  end
1017
1017
  delete_ass = nil
1018
- if set.modified # queryset modified
1018
+ #if set.modified # queryset modified
1019
+ if set.modified && obj.primary_keys_set? # queryset modified
1019
1020
  delete_ass = MapperTask.new(obj, :delete_associations, :element => element.name)
1020
1021
  deps << [task, delete_ass]
1021
1022
  end
@@ -1047,7 +1048,8 @@ module Spider; module Model; module Mappers
1047
1048
  end
1048
1049
  else
1049
1050
  el_val.set_modified(element.reverse)
1050
- deps << [task, MapperTask.new(el_val, :save)]
1051
+ #deps << [task, MapperTask.new(el_val, :save)]
1052
+ deps << [MapperTask.new(el_val, :save), task]
1051
1053
  end
1052
1054
  end
1053
1055
  end
@@ -103,7 +103,7 @@ module Spider; module Model
103
103
  @elements[name].attributes[:queryset_module] = qs_module
104
104
 
105
105
  def extend_queryset(qs)
106
- super
106
+ super
107
107
  @elements.each do |name, el|
108
108
  qs_module = el.attributes[:queryset_module]
109
109
  qs.extend(qs_module) if qs_module
@@ -111,7 +111,6 @@ module Spider; module Model
111
111
  end
112
112
 
113
113
  (class << self; self; end).instance_eval do
114
-
115
114
  define_method("#{name}_roots") do
116
115
  QuerySet.autoloading(self).send("#{name}_roots")
117
116
  end
@@ -120,9 +119,9 @@ module Spider; module Model
120
119
  QuerySet.autoloading(self).send("#{name}_leafs")
121
120
 
122
121
  end
123
-
124
- define_method("#{name}_all") do
125
- qs = QuerySet.static(self)
122
+ #TODO:la condizione non viene gestita, tolta per problemi in ruby 1.9.3 nel rebuild_menu
123
+ define_method("#{name}_all") do #|condition|
124
+ qs = QuerySet.static(self)
126
125
  self.send("#{name}_roots").each do |root|
127
126
  ta = root.tree_all(name)
128
127
  qs += ta if ta
@@ -256,7 +256,8 @@ module Spider
256
256
  unless (options[:no_sync])
257
257
  Spider::Logger.debug("SYNCING #{m}")
258
258
  m.mapper.sync_schema(force, options) if m.mapper.respond_to?(:sync_schema)
259
- end
259
+ m.after_sync if m.respond_to?(:after_sync)
260
+ end
260
261
  if (options[:drop_tables] && m.mapper.respond_to?(:schema))
261
262
  storages << m.mapper.storage unless storages.include?(m.mapper.storage)
262
263
  tables += m.mapper.schema.get_schemas.keys
@@ -73,7 +73,7 @@ module Spider; module Model; module Storage; module Db
73
73
 
74
74
  class << self; attr_reader :reserved_kewords, :type_synonyms, :safe_conversions, :field_types, :field_flags end
75
75
 
76
- def self.new_connection(host=nil, user=nil, passwd=nil, db=nil, port=nil, sock=nil, flag=nil)
76
+ def self.new_connection(host=nil, user=nil, passwd=nil, db=nil, port=nil, sock=nil, flag=0)
77
77
  conn = ::Mysql.new(host, user, passwd, db, port.to_i, sock, flag)
78
78
  conn.autocommit(true)
79
79
  conn.query("SET NAMES 'utf8'")
@@ -342,17 +342,23 @@ module Spider; module Model; module Storage; module Db
342
342
  nil # done in add field or alter field
343
343
  end
344
344
 
345
- def function(func)
346
- return super unless func.func_name == :concat
347
- fields = func.elements.map{ |func_el|
348
- if (func_el.is_a?(Spider::QueryFuncs::Function))
349
- function(func_el)
350
- else
351
- func.mapper_fields[func_el]
352
- end
353
- }
354
- return "CONCAT(#{fields.map{ |f| "COALESCE(#{f}, '')" }.join(', ')})"
355
- end
345
+ def function(func)
346
+ case func.func_name
347
+ when :rownum
348
+ "if(@rn, @rn:=@rn+1, @rn:=1)-1"
349
+ when :concat
350
+ fields = func.elements.map{ |func_el|
351
+ if (func_el.is_a?(Spider::QueryFuncs::Function))
352
+ function(func_el)
353
+ else
354
+ func.mapper_fields[func_el.to_s]
355
+ end
356
+ }
357
+ "CONCAT(#{fields.map{ |f| "COALESCE(#{f}, '')" }.join(', ')})"
358
+ else
359
+ super
360
+ end
361
+ end
356
362
 
357
363
  ##############################################################
358
364
  # Methods to get information from the db #
@@ -521,14 +527,6 @@ module Spider; module Model; module Storage; module Db
521
527
  return db_attributes
522
528
  end
523
529
 
524
- def function(func)
525
- case func.func_name
526
- when :rownum
527
- "if(@rn, @rn:=@rn+1, @rn:=1)-1"
528
- else
529
- super
530
- end
531
- end
532
530
 
533
531
  def schema_field_int_equal?(current, field)
534
532
  # FIXME
@@ -130,7 +130,7 @@ module Spider; module Model; module Storage; module Db
130
130
  end
131
131
  field_expr = field.is_a?(FieldExpression) ? field.expression : field.to_s
132
132
 
133
- unless query[:keys].include?(field) || field.is_a?(FieldExpression)
133
+ unless field.is_a?(FieldFunction) || field.is_a?(FieldExpression) || query[:keys].include?(field)
134
134
  transformed = "O#{replace_cnt += 1}"
135
135
  query[:order_replacements][field.to_s] = transformed
136
136
 
@@ -1086,7 +1086,11 @@ module Spider
1086
1086
  # @return [void]
1087
1087
  def init_ruby_debug
1088
1088
  begin
1089
- require 'ruby-debug'
1089
+ begin
1090
+ require 'ruby-debug'
1091
+ rescue
1092
+ require 'debugger'
1093
+ end
1090
1094
  if File.exists?(File.join($SPIDER_RUN_PATH,'tmp', 'debug.txt'))
1091
1095
  Debugger.wait_connection = true
1092
1096
  Debugger.start_remote
@@ -7,9 +7,12 @@ module Spider; module TemplateBlocks
7
7
  def compile(options={})
8
8
  init = ""
9
9
  c = ""
10
- type = @el.get_attribute('type')
10
+ type = @el.get_attribute('type') || 'nil'
11
+ prefix = @el.get_attribute('prefix')
11
12
  c += "output_assets"
12
- c+= "(:#{type})" if type
13
+ c+= "(:#{type}"
14
+ c += ", :prefix => '#{prefix}'" if prefix
15
+ c += ")"
13
16
  c += "\n"
14
17
  return CompiledBlock.new(init, c)
15
18
  end
@@ -481,12 +481,14 @@ module Spider
481
481
  end
482
482
  end
483
483
 
484
- def output_assets(type=nil)
484
+ def output_assets(type=nil, options={})
485
485
  types = type ? [type] : self.assets.keys
486
486
  if types.include?(:js)
487
487
  self.assets[:js].each do |ass|
488
488
  ass = {:src => ass} if ass.is_a?(String)
489
- $out << "<script type=\"text/javascript\" src=\"#{ass[:src]}\"></script>\n"
489
+ src = ass[:src]
490
+ src = "#{options[:prefix]}#{ass[:src]}" if options[:prefix] && !src =~ /^http/
491
+ $out << "<script type=\"text/javascript\" src=\"#{src}\"></script>\n"
490
492
  end
491
493
  unless @not_first_js
492
494
  $out << "<script type=\"text/javascript\">"
@@ -503,7 +505,9 @@ module Spider
503
505
  self.assets[:css].each do |ass|
504
506
  ass = {:src => ass} if ass.is_a?(String)
505
507
  rel = ass[:rel] || 'stylesheet'
506
- link = "<link rel=\"#{rel}\" type=\"text/css\" href=\"#{ass[:src]}\""
508
+ src = ass[:src]
509
+ src = "#{options[:prefix]}#{ass[:src]}" if options[:prefix] && !src =~ /^http/
510
+ link = "<link rel=\"#{rel}\" type=\"text/css\" href=\"#{src}\""
507
511
  link += " media=\"#{ass[:media]}\"" if ass[:media]
508
512
  link += ">\n"
509
513
  if ass[:if_ie_lte]
@@ -569,7 +569,14 @@ module Spider
569
569
  ass.set_attribute('home', 'true')
570
570
  else
571
571
  # ass.set_attribute('src', "/#{resource.definer.relative_path}/#{ass_src}")
572
- ass.set_attribute('app', resource.definer.relative_path)
572
+ res_rel_path = if resource.definer.respond_to?(:app)
573
+ resource.definer.app.relative_path
574
+ elsif resource.definer.respond_to?(:relative_path)
575
+ resource.definer.relative_path
576
+ else
577
+ nil
578
+ end
579
+ ass.set_attribute('app', res_rel_path) if res_rel_path
573
580
  end
574
581
  end
575
582
  assets_html += ass.to_html
@@ -9,8 +9,8 @@ class Date
9
9
  end
10
10
 
11
11
  # Converts to a Time object in the local timezone.
12
- def to_local_time
13
- conv_to_time(new_offset(DateTime.now.offset), :local)
12
+ def to_local_time
13
+ conv_to_time(new_offset(DateTime.now.offset), :local)
14
14
  end
15
15
 
16
16
  def to_date
@@ -40,8 +40,10 @@ class Date
40
40
  private
41
41
  def conv_to_time(dest, method)
42
42
  #Convert a fraction of a day to a number of microseconds
43
- usec = (dest.send(:sec_fraction) * 60 * 60 * 24 * (10**6)).to_i
44
- if dest.respond_to?(:hour)
43
+ #usec calcolato così da problemi in ruby 1.9
44
+ #usec = (dest.send(:sec_fraction) * 60 * 60 * 24 * (10**6)).to_i
45
+ usec = (dest.send(:sec_fraction) * 1000).to_i
46
+ if dest.respond_to?(:hour)
45
47
  Time.send(method, dest.year, dest.month, dest.day, dest.hour, dest.min, dest.sec, usec)
46
48
  else
47
49
  Time.send(method, dest.year, dest.month, dest.day)
@@ -65,4 +67,4 @@ class Time
65
67
  #
66
68
  # end
67
69
 
68
- end
70
+ end
@@ -26,5 +26,17 @@ class Module #:nodoc:
26
26
  end
27
27
  mod.const_set(parts[-1].to_sym, val)
28
28
  end
29
+
30
+ # const_defined? in Ruby 1.9 behaves differently in terms
31
+ # of which class hierarchy it polls for nested namespaces
32
+ #
33
+ # See http://redmine.ruby-lang.org/issues/show/1915
34
+ def constant_defined?(const)
35
+ if ::RUBY_VERSION =~ /1.9/
36
+ const_defined?(const, false)
37
+ else
38
+ const_defined?(const)
39
+ end
40
+ end
29
41
 
30
42
  end