spiderfw 0.6.27 → 0.6.28
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +4 -0
- data/VERSION +1 -1
- data/apps/core/admin/admin.rb +6 -2
- data/apps/core/admin/controllers/admin_controller.rb +10 -3
- data/apps/core/admin/controllers/app_admin_controller.rb +15 -0
- data/apps/core/admin/public/css/sass/admin.css +29 -33
- data/apps/core/admin/public/css/sass/grid.css +14 -0
- data/apps/core/admin/public/sass/admin.scss +3 -2
- data/apps/core/admin/views/admin.layout.shtml +1 -0
- data/apps/core/auth/controllers/mixins/auth_helper.rb +15 -5
- data/apps/core/components/assets.rb +60 -41
- data/apps/core/components/public/js/jquery/jquery-1.8.3.js +9472 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/jquery.ui.core.js +1 -1
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/button_bg.png +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/datepicker.gif +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/icon_sprite.png +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/progress_bar.gif +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/slider_h_bg.gif +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/slider_handles.png +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/slider_v_bg.gif +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/tab_bg.gif +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/the_gradient.gif +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-anim_basic_16x16.gif +0 -0
- 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
- 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
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- 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
- 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
- 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
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_222222_256x240.png +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_228ef1_256x240.png +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_ef8c08_256x240.png +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_ffd27a_256x240.png +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/images/ui-icons_ffffff_256x240.png +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/css/Aristo/jquery-ui.custom.css +528 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-af.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ar-DZ.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ar.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-az.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-be.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-bg.js +24 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-bs.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ca.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-cs.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-cy-GB.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-da.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-de.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-el.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-en-AU.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-en-GB.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-en-NZ.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-eo.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-es.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-et.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-eu.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fa.js +59 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fi.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fo.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fr-CA.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fr-CH.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-fr.js +25 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-gl.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-he.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hi.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hr.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hu.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-hy.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-id.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-is.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-it.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ja.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ka.js +21 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-kk.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-km.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ko.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ky.js +24 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-lb.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-lt.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-lv.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-mk.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ml.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ms.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nb.js +22 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nl-BE.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nl.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-nn.js +22 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-no.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-pl.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-pt-BR.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-pt.js +22 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-rm.js +21 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ro.js +26 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ru.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sk.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sl.js +24 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sq.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sr-SR.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sr.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-sv.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-ta.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-th.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-tj.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-tr.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-uk.js +24 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-vi.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-zh-CN.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-zh-HK.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/i18n/jquery.ui.datepicker-zh-TW.js +23 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.accordion.js +571 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.autocomplete.js +614 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.button.js +419 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.core.js +324 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.datepicker.js +2044 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.dialog.js +767 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.draggable.js +941 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.droppable.js +364 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-blind.js +82 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-bounce.js +113 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-clip.js +67 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-drop.js +65 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-explode.js +97 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-fade.js +30 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-fold.js +76 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-highlight.js +50 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-pulsate.js +63 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-scale.js +318 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-shake.js +74 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-slide.js +64 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect-transfer.js +47 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.effect.js +1259 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.menu.js +621 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.mouse.js +169 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.position.js +497 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.progressbar.js +145 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.resizable.js +963 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.selectable.js +269 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.slider.js +641 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.sortable.js +1236 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.spinner.js +492 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.tabs.js +846 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.tooltip.js +400 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.9.2/ui/jquery.ui.widget.js +521 -0
- data/apps/core/components/public/js/jquery/plugins/bsmselect/js/jquery.bsmselect.js +3 -1
- data/apps/core/components/public/js/plugins/sortable.js +5 -5
- data/apps/core/components/widgets/month_calendar/month_calendar.shtml +1 -1
- data/apps/core/components/widgets/table/table.rb +18 -5
- data/apps/core/forms/public/date_time.js +3 -0
- data/apps/core/forms/widgets/form/form.rb +1 -1
- data/apps/core/forms/widgets/inputs/date_time/date_time.rb +5 -0
- data/apps/core/forms/widgets/inputs/file_input/file_input.rb +1 -1
- data/apps/core/forms/widgets/inputs/select/select.rb +11 -16
- data/apps/messenger/config/options.rb +5 -5
- data/apps/messenger/controllers/messenger_admin_controller.rb +1 -1
- data/apps/messenger/controllers/messenger_controller.rb +1 -1
- data/apps/messenger/lib/backends/mobyt.rb +1 -1
- data/apps/messenger/messenger.rb +4 -2
- data/apps/messenger/views/admin/index.shtml +1 -1
- data/lib/spiderfw/controller/dispatcher.rb +5 -5
- data/lib/spiderfw/controller/mixins/visual.rb +10 -8
- data/lib/spiderfw/http/http.rb +1 -1
- data/lib/spiderfw/model/base_model.rb +2 -2
- data/lib/spiderfw/model/mappers/db_mapper.rb +4 -2
- data/lib/spiderfw/model/mixins/tree.rb +4 -5
- data/lib/spiderfw/model/model.rb +2 -1
- data/lib/spiderfw/model/storage/db/adapters/mysql.rb +18 -20
- data/lib/spiderfw/model/storage/db/adapters/oracle.rb +1 -1
- data/lib/spiderfw/spider.rb +5 -1
- data/lib/spiderfw/templates/blocks/layout_assets.rb +5 -2
- data/lib/spiderfw/templates/layout.rb +7 -3
- data/lib/spiderfw/templates/template.rb +8 -1
- data/lib/spiderfw/utils/monkey/date_time.rb +7 -5
- data/lib/spiderfw/utils/monkey/module.rb +12 -0
- metadata +373 -157
- data/lib/spiderfw/model/storage/db/connectors/mysql.rb +0 -16
- data/lib/spiderfw/model/storage/db/connectors/mysql2.rb +0 -9
- /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
|
-
|
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[
|
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] = @
|
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
|
82
|
+
if val.blank?
|
81
83
|
@value = nil
|
82
84
|
return
|
83
85
|
end
|
84
|
-
if
|
86
|
+
if val.is_a?(@model) || val.is_a?(Spider::Model::QuerySet)
|
85
87
|
return super
|
86
88
|
else
|
87
|
-
if
|
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
|
-
|
104
|
+
obj.keys_string
|
103
105
|
end
|
104
106
|
|
105
107
|
def str_to_pks(val)
|
106
|
-
|
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
|
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 =>
|
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 =>
|
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 =>
|
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 =>
|
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 =>
|
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 =>
|
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 =>
|
9
|
+
route queue.to_s, self, :do => Proc.new{ |action| @queue = @dispatch_action }
|
10
10
|
end
|
11
11
|
|
12
12
|
def before(action='', *params)
|
data/apps/messenger/messenger.rb
CHANGED
@@ -108,8 +108,10 @@ module Spider
|
|
108
108
|
|
109
109
|
end
|
110
110
|
ensure
|
111
|
-
File.
|
112
|
-
|
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="{
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
149
|
-
|
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
|
-
|
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
|
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
|
data/lib/spiderfw/http/http.rb
CHANGED
@@ -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
|
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.
|
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 ==
|
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
|
-
|
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
|
-
|
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
|
data/lib/spiderfw/model/model.rb
CHANGED
@@ -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
|
-
|
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=
|
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
|
-
|
346
|
-
|
347
|
-
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
-
|
355
|
-
|
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
|
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
|
|
data/lib/spiderfw/spider.rb
CHANGED
@@ -1086,7 +1086,11 @@ module Spider
|
|
1086
1086
|
# @return [void]
|
1087
1087
|
def init_ruby_debug
|
1088
1088
|
begin
|
1089
|
-
|
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}
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
44
|
-
|
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
|