spiderfw 0.5.19 → 0.6.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +7 -0
- data/VERSION +1 -1
- data/apps/core/auth/lib/rbac.rb +7 -2
- data/apps/core/auth/models/mixins/rbac_provider.rb +66 -4
- data/apps/core/components/assets.rb +63 -33
- data/apps/core/components/public/js/jquery/{jquery-1.4.3.js → jquery-1.5.2.js} +2617 -1126
- data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/overlay/overlay.apple.js +155 -0
- data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/overlay/overlay.js +293 -0
- data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/scrollable/scrollable.js +335 -0
- data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/tabs/tabs.css +59 -0
- data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/tabs/tabs.js +283 -0
- data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/toolbox/toolbox.expose.js +224 -0
- data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/tooltip/tooltip.dynamic.js +150 -0
- data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/tooltip/tooltip.js +343 -0
- data/apps/core/components/public/js/jquery/jquery-tools-1.2.5/tooltip/tooltip.slide.js +78 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/button_bg.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/datepicker.gif +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/icon_sprite.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/progress_bar.gif +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/slider_h_bg.gif +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/slider_handles.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/slider_v_bg.gif +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/tab_bg.gif +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/the_gradient.gif +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-anim_basic_16x16.gif +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_diagonals-thick_18_b81900_40x40.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_diagonals-thick_20_666666_40x40.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_flat_10_000000_40x100.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_glass_100_f6f6f6_1x400.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_glass_100_fdf5ce_1x400.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_glass_65_ffffff_1x400.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_gloss-wave_35_f6a828_500x100.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_highlight-soft_100_eeeeee_1x100.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-bg_highlight-soft_75_ffe45c_1x100.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-icons_222222_256x240.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-icons_228ef1_256x240.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-icons_ef8c08_256x240.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-icons_ffd27a_256x240.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/images/ui-icons_ffffff_256x240.png +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4 → jquery-ui-1.8.11}/css/Aristo/jquery-ui.custom.css +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-af.js +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-ar-DZ.js +23 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ar.js +7 -8
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-az.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-bg.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-bs.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ca.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-cs.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-da.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-de.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-el.js +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-en-AU.js +23 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-en-GB.js +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-en-NZ.js +23 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-eo.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-es.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-et.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-eu.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-fa.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-fi.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-fo.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-fr-CH.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-fr.js +12 -10
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-gl.js +23 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-he.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-hr.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-hu.js +1 -1
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-hy.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-id.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-is.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-it.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ja.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ko.js +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-kz.js +23 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-lt.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-lv.js +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-ml.js +23 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ms.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-nl.js +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-no.js +23 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-pl.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-pt-BR.js +0 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-pt.js +22 -0
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-rm.js +21 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ro.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ru.js +1 -1
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-sk.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-sl.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-sq.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-sr-SR.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-sr.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-sv.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-ta.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-th.js +1 -1
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/i18n/jquery.ui.datepicker-tj.js +23 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-tr.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-uk.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-vi.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-zh-CN.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-zh-HK.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/i18n/jquery.ui.datepicker-zh-TW.js +0 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.blind.js +3 -3
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.bounce.js +3 -3
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.clip.js +3 -3
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.core.js +48 -15
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.drop.js +3 -3
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.explode.js +2 -2
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/jquery.effects.fade.js +32 -0
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.fold.js +3 -3
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.highlight.js +2 -2
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.pulsate.js +2 -2
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.scale.js +4 -4
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.shake.js +3 -3
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.slide.js +4 -4
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.effects.transfer.js +2 -2
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.accordion.js +33 -20
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.autocomplete.js +104 -42
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.button.js +35 -13
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.core.js +111 -84
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.datepicker.js +87 -46
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.dialog.js +105 -75
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.draggable.js +17 -15
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.droppable.js +5 -5
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.mouse.js +16 -11
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.position.js +51 -32
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.progressbar.js +24 -10
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.resizable.js +7 -7
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.selectable.js +3 -3
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.slider.js +9 -7
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.sortable.js +22 -20
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.tabs.js +15 -14
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → jquery-ui-1.8.11}/ui/jquery.ui.widget.js +50 -25
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → plugins/bsmselect}/GPL-LICENSE.txt +1 -1
- data/apps/core/components/public/js/jquery/{jquery-ui-1.8.4/development-bundle → plugins/bsmselect}/MIT-LICENSE.txt +3 -7
- data/apps/core/components/public/js/jquery/plugins/bsmselect/README.md +185 -0
- data/apps/core/components/public/js/jquery/plugins/bsmselect/css/jquery.bsmselect.css +64 -0
- data/apps/core/components/public/js/jquery/plugins/bsmselect/js/jquery.bsmselect.compatibility.js +60 -0
- data/apps/core/components/public/js/jquery/plugins/bsmselect/js/jquery.bsmselect.js +381 -0
- data/apps/core/components/public/js/jquery/plugins/bsmselect/js/jquery.bsmselect.sortable.js +49 -0
- data/apps/core/components/public/js/plugins/sortable.js +16 -7
- data/apps/core/components/public/js/spider.js +60 -41
- data/apps/core/components/widgets/admin/admin.shtml +1 -1
- data/apps/core/components/widgets/list/list.shtml +2 -2
- data/apps/core/components/widgets/month_calendar/month_calendar.shtml +23 -20
- data/apps/core/components/widgets/switcher/switcher.rb +77 -21
- data/apps/core/components/widgets/switcher/templates/default.shtml +8 -0
- data/apps/core/components/widgets/switcher/templates/table.shtml +15 -0
- data/apps/core/components/widgets/table/table.rb +4 -1
- data/apps/core/components/widgets/table/table.shtml +10 -8
- data/apps/core/forms/public/css/form.css +9 -1
- data/apps/core/forms/public/date_time.js +14 -2
- data/apps/core/forms/public/input.js +1 -1
- data/apps/core/forms/public/select.js +4 -3
- data/apps/core/forms/tags/element_row.erb +11 -2
- data/apps/core/forms/widgets/inputs/date_time/date_time.rb +9 -0
- data/apps/core/forms/widgets/inputs/date_time/date_time.shtml +1 -1
- data/apps/core/forms/widgets/inputs/html_area/html_area.shtml +2 -2
- data/apps/core/forms/widgets/inputs/input/input.rb +0 -3
- data/apps/core/forms/widgets/inputs/select/select.shtml +2 -2
- data/apps/messenger/backends/email/sendmail.rb +20 -0
- data/apps/messenger/backends/email/smtp.rb +12 -14
- data/apps/messenger/backends/email/test.rb +20 -0
- data/apps/messenger/config/options.rb +9 -9
- data/apps/messenger/config/test.config.yml +2 -0
- data/apps/messenger/controllers/mixins/messenger_helper.rb +41 -15
- data/apps/messenger/lib/email_backend.rb +10 -0
- data/apps/messenger/messenger.rb +45 -26
- data/apps/messenger/test/features/attachments.feature +26 -0
- data/apps/messenger/test/features/messenger_helper.feature +31 -0
- data/apps/messenger/test/features/sending_email.feature +10 -0
- data/apps/messenger/test/features/step_definitions/common_steps.rb +11 -0
- data/apps/messenger/test/features/step_definitions/email_steps.rb +98 -0
- data/apps/messenger/test/features/support/env.rb +11 -0
- data/apps/messenger/test/files/test_file1.txt +1 -0
- data/apps/messenger/test/lib/controllers/mail_test_controller.rb +34 -0
- data/apps/messenger/test/templates/email/multipart.html.erb +1 -0
- data/apps/messenger/test/templates/email/multipart.txt.erb +1 -0
- data/apps/messenger/test/templates/email/simple.erb +1 -0
- data/apps/messenger/test/templates/email/vars.erb +1 -0
- data/lib/spiderfw/cmd/cmd.rb +4 -0
- data/lib/spiderfw/cmd/commands/webserver.rb +12 -59
- data/lib/spiderfw/config/configuration.rb +4 -0
- data/lib/spiderfw/config/options/spider.rb +25 -8
- data/lib/spiderfw/controller/controller.rb +10 -4
- data/lib/spiderfw/controller/first_responder.rb +6 -20
- data/lib/spiderfw/controller/http_controller.rb +2 -1
- data/lib/spiderfw/controller/mixins/http_mixin.rb +12 -1
- data/lib/spiderfw/controller/mixins/visual.rb +3 -16
- data/lib/spiderfw/env.rb +1 -1
- data/lib/spiderfw/http/server.rb +178 -2
- data/lib/spiderfw/model/base_model.rb +142 -111
- data/lib/spiderfw/model/data_type.rb +15 -0
- data/lib/spiderfw/model/datatypes/decimal.rb +8 -0
- data/lib/spiderfw/model/datatypes/pk.rb +29 -0
- data/lib/spiderfw/model/datatypes.rb +1 -0
- data/lib/spiderfw/model/element.rb +5 -1
- data/lib/spiderfw/model/extended_models/managed.rb +1 -1
- data/lib/spiderfw/model/junction.rb +23 -0
- data/lib/spiderfw/model/mappers/db_mapper.rb +96 -80
- data/lib/spiderfw/model/mappers/document_mapper.rb +315 -0
- data/lib/spiderfw/model/mappers/mapper.rb +164 -75
- data/lib/spiderfw/model/mixins/list.rb +1 -0
- data/lib/spiderfw/model/mixins/versioned.rb +63 -27
- data/lib/spiderfw/model/model.rb +36 -9
- data/lib/spiderfw/model/query_funcs.rb +3 -0
- data/lib/spiderfw/model/query_set.rb +21 -1
- data/lib/spiderfw/model/storage/base_storage.rb +259 -6
- data/lib/spiderfw/model/storage/{db/db_connection_pool.rb → connection_pool.rb} +25 -21
- data/lib/spiderfw/model/storage/db/adapters/mysql.rb +25 -5
- data/lib/spiderfw/model/storage/db/adapters/oracle.rb +1 -1
- data/lib/spiderfw/model/storage/db/connectors/jdbc_oracle.rb +2 -2
- data/lib/spiderfw/model/storage/db/connectors/oci8.rb +3 -4
- data/lib/spiderfw/model/storage/db/db_storage.rb +18 -219
- data/lib/spiderfw/model/storage/document/adapters/mongodb.rb +307 -0
- data/lib/spiderfw/model/storage/document/document.rb +7 -0
- data/lib/spiderfw/model/storage/document/document_storage.rb +34 -0
- data/lib/spiderfw/model/storage.rb +23 -11
- data/lib/spiderfw/model/unit_of_work.rb +45 -22
- data/lib/spiderfw/spider.rb +660 -0
- data/lib/spiderfw/templates/blocks/html.rb +4 -2
- data/lib/spiderfw/templates/blocks/run.rb +1 -1
- data/lib/spiderfw/templates/blocks/tag_if.rb +1 -1
- data/lib/spiderfw/templates/blocks/widget.rb +1 -1
- data/lib/spiderfw/templates/layout.rb +29 -5
- data/lib/spiderfw/templates/template.rb +72 -7
- data/lib/spiderfw/templates/template_blocks.rb +1 -1
- data/lib/spiderfw/test/capybara.rb +7 -0
- data/lib/spiderfw/test/cucumber.rb +12 -0
- data/lib/spiderfw/test/page_object.rb +29 -0
- data/lib/spiderfw/test/spec.rb +20 -0
- data/lib/spiderfw/test/stubs/mapper_stub.rb +18 -0
- data/lib/spiderfw/test/stubs/storage_stub.rb +23 -0
- data/lib/spiderfw/test/unit.rb +23 -0
- data/lib/spiderfw/test.rb +89 -0
- data/lib/spiderfw/utils/json.rb +6 -0
- data/lib/spiderfw/utils/logger.rb +17 -4
- data/lib/spiderfw/utils/loggers/apache_commons_logger.rb +61 -0
- data/lib/spiderfw/utils/monkey/date_time.rb +2 -2
- data/lib/spiderfw/utils/monkey/module.rb +3 -1
- data/lib/spiderfw/utils/profiling.rb +2 -2
- data/lib/spiderfw/widget/widget.rb +31 -13
- data/lib/spiderfw.rb +1 -597
- data/spider.gemspec +9 -10
- metadata +193 -132
- data/apps/admin/_init.rb +0 -9
- data/apps/admin/controllers/admin_controller.rb +0 -12
- data/apps/admin/widgets/dashboard_widget/dashboard_widget.rb +0 -8
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.4/development-bundle/AUTHORS.txt +0 -30
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.4/development-bundle/ui/i18n/jquery-ui-i18n.js +0 -1176
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.4/development-bundle/ui/i18n/jquery.ui.datepicker-no.js +0 -23
- data/apps/core/components/public/js/jquery/jquery-ui-1.8.4/development-bundle/version.txt +0 -1
- data/apps/core/components/public/js/jquery/plugins/asmselect/jquery.asmselect.css +0 -64
- data/apps/core/components/public/js/jquery/plugins/asmselect/jquery.asmselect.js +0 -407
- data/apps/core/components/widgets/switcher/switcher.shtml +0 -17
- data/apps/master/po/master.pot +0 -400
@@ -50,6 +50,10 @@ module Spider; module Model
|
|
50
50
|
mapped?(element) || element.attributes[:sortable]
|
51
51
|
end
|
52
52
|
|
53
|
+
def base_type(type)
|
54
|
+
Spider::Model.base_type(type)
|
55
|
+
end
|
56
|
+
|
53
57
|
# Utility methods
|
54
58
|
|
55
59
|
# An array of mapped elements.
|
@@ -59,7 +63,6 @@ module Spider; module Model
|
|
59
63
|
|
60
64
|
# Calls the given action. Used by UnitOfWork tasks.
|
61
65
|
def execute_action(action, object, params={}) # :nodoc:
|
62
|
-
@unit_of_work_task = true
|
63
66
|
case action
|
64
67
|
when :save
|
65
68
|
if params[:force] == :insert
|
@@ -76,7 +79,6 @@ module Spider; module Model
|
|
76
79
|
else
|
77
80
|
raise MapperError, "#{action} action not implemented"
|
78
81
|
end
|
79
|
-
@unit_of_work_task = false
|
80
82
|
end
|
81
83
|
|
82
84
|
# Converts hashes and arrays to QuerySets and BaseModel instances.
|
@@ -159,23 +161,29 @@ module Spider; module Model
|
|
159
161
|
end
|
160
162
|
end
|
161
163
|
done_extended = []
|
162
|
-
unless
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
164
|
+
unless Spider::Model.unit_of_work_running?
|
165
|
+
save_extended_models(obj, mode)
|
166
|
+
save_integrated(obj, mode)
|
167
|
+
end
|
168
|
+
end
|
169
|
+
|
170
|
+
def save_extended_models(obj, mode)
|
171
|
+
if @model.extended_models
|
172
|
+
@model.extended_models.each do |m, el|
|
173
|
+
sub = obj.get(el)
|
174
|
+
if mode == :update || sub.class.auto_primary_keys? || sub._check_if_saved
|
175
|
+
sub.save if (obj.element_modified?(el) || !obj.primary_keys_set?) && sub.mapper.class.write?
|
176
|
+
else
|
177
|
+
sub.insert unless sub.in_storage?
|
172
178
|
end
|
173
179
|
end
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
180
|
+
end
|
181
|
+
end
|
182
|
+
|
183
|
+
def save_integrated(obj, mode)
|
184
|
+
@model.elements_array.select{ |el| !el.integrated? && el.attributes[:integrated_model] && !el.attributes[:extended_model] }.each do |el|
|
185
|
+
sub_obj = obj.get(el)
|
186
|
+
sub_obj.save if sub_obj && sub_obj.modified? && obj.element_modified?(el) && obj.get(el).mapper.class.write?
|
179
187
|
end
|
180
188
|
end
|
181
189
|
|
@@ -211,27 +219,12 @@ module Spider; module Model
|
|
211
219
|
prev_autoload = obj.autoload?
|
212
220
|
obj.save_mode
|
213
221
|
storage.in_transaction
|
214
|
-
|
215
|
-
is_insert = false
|
216
|
-
# Load local primary keys if they exist
|
217
|
-
|
218
|
-
@model.elements_array.select{ |el| el.attributes[:local_pk] }.each do |local_pk|
|
219
|
-
if !obj.get(local_pk)
|
220
|
-
is_insert = true
|
221
|
-
break
|
222
|
-
end
|
223
|
-
end
|
224
|
-
end
|
225
|
-
save_mode = nil
|
226
|
-
if obj.class.auto_primary_keys? && !obj._check_if_saved
|
227
|
-
save_mode = (!is_insert && obj.primary_keys_set?) ? :update : :insert
|
228
|
-
else
|
229
|
-
save_mode = obj.in_storage? ? :update : :insert
|
230
|
-
end
|
222
|
+
save_mode = determine_save_mode(obj)
|
231
223
|
before_save(obj, save_mode)
|
232
224
|
# @model.elements_array.select{ |el| el.attributes[:integrated_model] }.each do |el|
|
233
225
|
# obj.get(el).save if obj.element_modified?(el)
|
234
226
|
# end
|
227
|
+
|
235
228
|
if (save_mode == :update)
|
236
229
|
do_update(obj)
|
237
230
|
else
|
@@ -249,16 +242,34 @@ module Spider; module Model
|
|
249
242
|
true
|
250
243
|
end
|
251
244
|
|
245
|
+
def determine_save_mode(obj)
|
246
|
+
if @model.extended_models && !@model.extended_models.empty?
|
247
|
+
is_insert = false
|
248
|
+
# Load local primary keys if they exist
|
249
|
+
|
250
|
+
@model.elements_array.select{ |el| el.attributes[:local_pk] }.each do |local_pk|
|
251
|
+
if !obj.get(local_pk)
|
252
|
+
is_insert = true
|
253
|
+
break
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
save_mode = nil
|
258
|
+
if obj.class.auto_primary_keys? && !obj._check_if_saved
|
259
|
+
save_mode = (!is_insert && obj.primary_keys_set?) ? :update : :insert
|
260
|
+
else
|
261
|
+
save_mode = obj.in_storage? ? :update : :insert
|
262
|
+
end
|
263
|
+
end
|
264
|
+
|
252
265
|
|
253
266
|
# Elements that are associated to this one externally.
|
254
267
|
def association_elements
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
end
|
261
|
-
els
|
268
|
+
return [] if Spider::Model.unit_of_work_running?
|
269
|
+
els = @model.elements_array.select{ |el|
|
270
|
+
mapped?(el) && !el.integrated? && !have_references?(el) && !(el.attributes[:added_reverse] && el.type <= @model)
|
271
|
+
}
|
272
|
+
els
|
262
273
|
end
|
263
274
|
|
264
275
|
# Saves object associations.
|
@@ -300,11 +311,11 @@ module Spider; module Model
|
|
300
311
|
def save_element_associations(obj, element, mode)
|
301
312
|
our_element = element.attributes[:reverse]
|
302
313
|
val = obj.get(element)
|
303
|
-
if
|
314
|
+
if element.attributes[:junction]
|
304
315
|
their_element = element.attributes[:junction_their_element]
|
305
|
-
if
|
316
|
+
if val.model != element.model # dereferenced junction
|
306
317
|
val = [val] unless val.is_a?(Enumerable)
|
307
|
-
unless
|
318
|
+
unless mode == :insert
|
308
319
|
current = obj.get_new
|
309
320
|
current_val = current.get(element)
|
310
321
|
current_val = [current_val] unless current_val.is_a?(Enumerable)
|
@@ -346,7 +357,7 @@ module Spider; module Model
|
|
346
357
|
end
|
347
358
|
end
|
348
359
|
else
|
349
|
-
if
|
360
|
+
if element.multiple?
|
350
361
|
condition = Condition.and
|
351
362
|
condition[our_element] = obj
|
352
363
|
val.each do |row|
|
@@ -354,7 +365,7 @@ module Spider; module Model
|
|
354
365
|
element.model.primary_keys.each{ |el| condition_row.set(el.name, '<>', row.get(el))}
|
355
366
|
condition << condition_row
|
356
367
|
end
|
357
|
-
if
|
368
|
+
if element.owned?
|
358
369
|
element.mapper.delete(condition)
|
359
370
|
else
|
360
371
|
element.mapper.bulk_update({our_element => nil}, condition)
|
@@ -370,9 +381,10 @@ module Spider; module Model
|
|
370
381
|
|
371
382
|
# Saves the given object and all objects reachable from it.
|
372
383
|
def save_all(root)
|
373
|
-
|
374
|
-
|
375
|
-
|
384
|
+
UnitOfWork.new do |uow|
|
385
|
+
uow.add(root)
|
386
|
+
uow.run()
|
387
|
+
end
|
376
388
|
end
|
377
389
|
|
378
390
|
# Inserts the object in the storage.
|
@@ -473,6 +485,10 @@ module Spider; module Model
|
|
473
485
|
delete(all, true)
|
474
486
|
end
|
475
487
|
|
488
|
+
def truncate!
|
489
|
+
raise MapperError, "Unimplemented"
|
490
|
+
end
|
491
|
+
|
476
492
|
# Actual interaction with the storage. May be implemented by subclasses.
|
477
493
|
def do_delete(obj, force=false)
|
478
494
|
raise MapperError, "Unimplemented"
|
@@ -576,25 +592,28 @@ module Spider; module Model
|
|
576
592
|
return false
|
577
593
|
end
|
578
594
|
set.total_rows = result.total_rows if (!was_loaded)
|
595
|
+
merged = {}
|
579
596
|
result.each do |row|
|
580
597
|
obj = map(query.request, row, @model) # set.model ?!?
|
581
598
|
next unless obj
|
582
|
-
merge_object(set, obj, query.request)
|
599
|
+
merged_obj = merge_object(set, obj, query.request)
|
600
|
+
merged[merged_obj.object_id] = true
|
583
601
|
@raw_data[obj.object_id] = row
|
584
602
|
end
|
603
|
+
query.request.keys.each do |k, v|
|
604
|
+
set.element_loaded(k) if have_references?(k)
|
605
|
+
end
|
606
|
+
set.each do |obj|
|
607
|
+
next if merged[obj.object_id]
|
608
|
+
query.request.keys.each do |element_name|
|
609
|
+
el = @model.elements[element_name]
|
610
|
+
next if el.primary_key?
|
611
|
+
next if el.integrated? || @model.extended_models[el.model]
|
612
|
+
obj.set_loaded_value(element_name, nil)
|
613
|
+
end
|
614
|
+
end
|
585
615
|
end
|
586
616
|
set = get_external(set, query)
|
587
|
-
# delay_put = true if (@model.primary_keys.select{ |k| @model.elements[k.name].integrated? }.length > 0)
|
588
|
-
|
589
|
-
|
590
|
-
# if (delay_put)
|
591
|
-
# set.no_autoload(false) do
|
592
|
-
# set.each_index do |i|
|
593
|
-
# set[i].primary_keys_set?
|
594
|
-
# set[i] = im.put(set[i], true)
|
595
|
-
# end
|
596
|
-
# end
|
597
|
-
# end
|
598
617
|
end
|
599
618
|
return set
|
600
619
|
end
|
@@ -608,11 +627,10 @@ module Spider; module Model
|
|
608
627
|
if (obj_res && obj_res[0])
|
609
628
|
obj_res[0].set_parent(set, nil)
|
610
629
|
obj_res[0].merge!(obj, request)
|
611
|
-
|
612
|
-
set.element_loaded(name) if request.key?(name)
|
613
|
-
end
|
630
|
+
obj_res[0]
|
614
631
|
else
|
615
632
|
set << obj
|
633
|
+
obj
|
616
634
|
end
|
617
635
|
end
|
618
636
|
|
@@ -649,7 +667,7 @@ module Spider; module Model
|
|
649
667
|
|
650
668
|
|
651
669
|
# Transforms a Storage result into an object. Should be implemented by subclasses.
|
652
|
-
def map(request, result,
|
670
|
+
def map(request, result, obj_or_model)
|
653
671
|
raise MapperError, "Unimplemented"
|
654
672
|
end
|
655
673
|
|
@@ -691,7 +709,7 @@ module Spider; module Model
|
|
691
709
|
# Loads an external element, according to query, and merges the result into an object or QuerySet.
|
692
710
|
def get_external_element(element, query, objects)
|
693
711
|
# Spider::Logger.debug("Getting external element #{element.name} for #{@model}")
|
694
|
-
return load_element(objects, element) if
|
712
|
+
return load_element(objects, element) if have_references?(element)
|
695
713
|
return nil if objects.empty?
|
696
714
|
index_by = []
|
697
715
|
@model.primary_keys.each{ |key| index_by << :"#{element.attributes[:reverse]}.#{key.name}" }
|
@@ -717,7 +735,6 @@ module Spider; module Model
|
|
717
735
|
objects.each_current do |obj|
|
718
736
|
search_params = {}
|
719
737
|
@model.primary_keys.each do |key|
|
720
|
-
field = @schema.field(key.name)
|
721
738
|
search_params[:"#{element.attributes[:reverse]}.#{key.name}"] = obj.get(key)
|
722
739
|
end
|
723
740
|
sub_res = result.find(search_params)
|
@@ -748,13 +765,69 @@ module Spider; module Model
|
|
748
765
|
return res
|
749
766
|
end
|
750
767
|
|
768
|
+
# Prepares a value going to be bound to an insert or update statement
|
769
|
+
def map_save_value(type, value, save_mode=:save)
|
770
|
+
value = map_value(type, value, :save)
|
771
|
+
return @storage.value_for_save(Model.simplify_type(type), value, save_mode)
|
772
|
+
end
|
751
773
|
|
752
|
-
#
|
753
|
-
def
|
754
|
-
|
774
|
+
# Prepares a value for a condition.
|
775
|
+
def map_condition_value(type, value)
|
776
|
+
if value.is_a?(Range)
|
777
|
+
return Range.new(map_condition_value(type, value.first), map_condition_value(type, value.last))
|
778
|
+
end
|
779
|
+
return value if ( type.class == Class && type.subclass_of?(Spider::Model::BaseModel) )
|
780
|
+
value = map_value(type, value, :condition)
|
781
|
+
return @storage.value_for_condition(Model.simplify_type(type), value)
|
782
|
+
end
|
783
|
+
|
784
|
+
def storage_value_to_mapper(type, value)
|
785
|
+
storage.value_to_mapper(type, value)
|
755
786
|
end
|
756
787
|
|
757
788
|
|
789
|
+
# Converts a value in one accepted by the storage.
|
790
|
+
def map_value(type, value, mode=nil)
|
791
|
+
return value if value.nil?
|
792
|
+
if type == Spider::DataTypes::PK
|
793
|
+
value = value.obj if value.is_a?(Spider::DataTypes::PK)
|
794
|
+
elsif type < Spider::DataType
|
795
|
+
value = type.from_value(value) unless value.is_a?(type)
|
796
|
+
value = value.map(self.type)
|
797
|
+
elsif type.class == Class && type.subclass_of?(Spider::Model::BaseModel)
|
798
|
+
value = type.primary_keys.map{ |key| value.send(key.name) }
|
799
|
+
end
|
800
|
+
value
|
801
|
+
end
|
802
|
+
|
803
|
+
|
804
|
+
# Converts a storage value back to the corresponding base type or DataType.
|
805
|
+
def map_back_value(type, value)
|
806
|
+
value = value[0] if value.class == Array
|
807
|
+
value = storage_value_to_mapper(Model.simplify_type(type), value)
|
808
|
+
|
809
|
+
if type <= Spider::DataTypes::PK
|
810
|
+
value = value.is_a?(Spider::DataTypes::PK) ? value.obj : value
|
811
|
+
elsif type < Spider::DataType && type.maps_back_to
|
812
|
+
type = type.maps_back_to
|
813
|
+
end
|
814
|
+
case type.name
|
815
|
+
when 'Fixnum'
|
816
|
+
return value ? value.to_i : nil
|
817
|
+
when 'Float'
|
818
|
+
return value ? value.to_f : nil
|
819
|
+
end
|
820
|
+
return nil unless value
|
821
|
+
case type.name
|
822
|
+
when 'Date', 'DateTime'
|
823
|
+
return type.parse(value) unless value.is_a?(Date)
|
824
|
+
end
|
825
|
+
if type < Spider::DataType && type.force_wrap?
|
826
|
+
value = type.from_value(value)
|
827
|
+
end
|
828
|
+
return value
|
829
|
+
end
|
830
|
+
|
758
831
|
##############################################################
|
759
832
|
# Strategy #
|
760
833
|
##############################################################
|
@@ -951,10 +1024,20 @@ module Spider; module Model
|
|
951
1024
|
end
|
952
1025
|
|
953
1026
|
# Returns task dependecies for the UnitOfWork. May be implemented by subclasses.
|
954
|
-
def get_dependencies(
|
1027
|
+
def get_dependencies(task)
|
955
1028
|
return []
|
956
1029
|
end
|
957
1030
|
|
1031
|
+
def children_for_unit_of_work(obj, action)
|
1032
|
+
children = []
|
1033
|
+
obj.class.elements_array.each do |el|
|
1034
|
+
next unless obj.element_has_value?(el)
|
1035
|
+
next unless el.model?
|
1036
|
+
children << obj.get(el)
|
1037
|
+
end
|
1038
|
+
children
|
1039
|
+
end
|
1040
|
+
|
958
1041
|
|
959
1042
|
end
|
960
1043
|
|
@@ -964,7 +1047,7 @@ module Spider; module Model
|
|
964
1047
|
|
965
1048
|
# The MapperTask is used by the UnitOfWork.
|
966
1049
|
class MapperTask
|
967
|
-
attr_reader :dependencies, :object, :action
|
1050
|
+
attr_reader :dependencies, :object, :action, :params
|
968
1051
|
|
969
1052
|
def initialize(object, action, params={})
|
970
1053
|
@object = object
|
@@ -978,13 +1061,18 @@ module Spider; module Model
|
|
978
1061
|
end
|
979
1062
|
|
980
1063
|
def execute()
|
981
|
-
|
1064
|
+
debug_str = "Executing #{@action} on #{@object.inspect}"
|
1065
|
+
debug_str += " (#{@params.inspect})" unless @params.empty?
|
1066
|
+
Spider::Logger.debug debug_str
|
982
1067
|
@object.mapper.execute_action(@action, @object, @params)
|
983
1068
|
end
|
984
1069
|
|
985
1070
|
def eql?(task)
|
986
1071
|
return false unless task.class == self.class
|
987
1072
|
return false unless (task.object == self.object && task.action == self.action)
|
1073
|
+
@params.each do |k, v|
|
1074
|
+
return false unless task.params[k] == v
|
1075
|
+
end
|
988
1076
|
return true
|
989
1077
|
end
|
990
1078
|
|
@@ -1002,9 +1090,10 @@ module Spider; module Model
|
|
1002
1090
|
|
1003
1091
|
def inspect
|
1004
1092
|
if (@action && @object)
|
1005
|
-
str = "#{@action} on #{@object} (#{object.class})"
|
1093
|
+
str = "#{@action} on #{@object}##{@object.object_id} (#{object.class})"
|
1094
|
+
str += " (#{@params.inspect})" unless @params.empty?
|
1006
1095
|
if (@dependencies.length > 0)
|
1007
|
-
str += " (dependencies: #{@dependencies.map{ |dep| "#{dep.action} on #{dep.object.class} #{dep.object}"}.join(', ')})"
|
1096
|
+
str += " (dependencies: #{@dependencies.map{ |dep| "#{dep.action} on #{dep.object.class} #{dep.object}##{dep.object.object_id}"}.join(', ')})"
|
1008
1097
|
# str += "-dependencies:\n"
|
1009
1098
|
# @dependencies.each do |dep|
|
1010
1099
|
# str += "---#{dep.action} on #{dep.object}\n"
|
@@ -7,6 +7,7 @@ module Spider; module Model
|
|
7
7
|
|
8
8
|
|
9
9
|
def self.included(model)
|
10
|
+
return if model.is_a?(ClassMethods) && model.version_model
|
10
11
|
model.extend(ClassMethods)
|
11
12
|
model.mapper_include(Mapper)
|
12
13
|
model.remove_element(:v_sha1) if model.elements[:v_sha1] && model.elements[:v_sha1].integrated?
|
@@ -92,28 +93,31 @@ module Spider; module Model
|
|
92
93
|
# debugger if elh[:attributes][:junction]
|
93
94
|
# vmod.send(elh[:method], elh[:name], elh[:type], elh[:attributes])
|
94
95
|
if (el.model?)
|
96
|
+
is_version_content = el.type < Spider::Model::Versioned && el.attributes[:version_content] != false
|
95
97
|
if elh[:attributes][:integrated_model]
|
96
|
-
|
97
98
|
elh[:type].elements.each do |ielname, iel|
|
98
99
|
i = vmod.elements[ielname]
|
99
100
|
vmod.remove_element(ielname) if i && i.integrated? && i.integrated_from.name == el.name
|
100
101
|
end
|
101
102
|
elh[:attributes][:integrate] = true
|
103
|
+
elh[:attributes].delete(:extended_model)
|
104
|
+
elh[:attributes].delete(:embedded)
|
102
105
|
end
|
103
106
|
if el.attributes[:add_reverse] || el.attributes[:add_multiple_reverse]
|
104
107
|
rev = el.attributes[:add_reverse] || el.attributes[:add_multiple_reverse]
|
105
108
|
el.type.version_model.remove_element(rev[:name]) if el.type.respond_to?(:version_model)
|
106
109
|
end
|
107
|
-
if vmod.elements[el.name] && elh[:attributes][:reverse] && !
|
110
|
+
if vmod.elements[el.name] && elh[:attributes][:reverse] && !is_version_content
|
108
111
|
vmod.elements[el.name].attributes.delete(:reverse)
|
112
|
+
vmod.elements[el.name].attributes.delete(:condition)
|
109
113
|
end
|
110
|
-
if el.multiple? && !el.attributes[:junction] && !
|
114
|
+
if el.multiple? && !el.attributes[:junction] && !is_version_content
|
111
115
|
elh[:attributes].delete(:reverse)
|
112
116
|
elh[:attributes].delete(:add_reverse)
|
113
117
|
elh[:attributes].delete(:add_multiple_reverse)
|
114
118
|
vmod.remove_element(el.name)
|
115
119
|
vmod.send(elh[:method], el.name, el.type, elh[:attributes])
|
116
|
-
elsif
|
120
|
+
elsif !el.attributes[:added_reverse] && el.model < Spider::Model::Versioned
|
117
121
|
vmod.remove_element(el.name)
|
118
122
|
if elh[:method] == :tree
|
119
123
|
vmod.remove_element(elh[:attributes][:reverse])
|
@@ -125,10 +129,10 @@ module Spider; module Model
|
|
125
129
|
vmod.send(elh[:method], el.name, el.type.version_model, elh[:attributes])
|
126
130
|
end
|
127
131
|
@version_elements[el.name] = el.name
|
128
|
-
elsif
|
132
|
+
elsif el.attributes[:junction] && el.attributes[:owned]
|
129
133
|
# elh[:attributes][:has_single_reverse] = (el.attributes[:reverse] && !el.type.elements[el.attributes[:reverse]].multiple?)
|
130
134
|
junction = vmod.elements[el.name].attributes[:association_type]
|
131
|
-
unless junction < Spider::Model::Versioned
|
135
|
+
unless junction < Spider::Model::Versioned || (el.attributes[:embedded] && self.storage.supports?(:embedding))
|
132
136
|
junction.module_eval{ include Spider::Model::Versioned }
|
133
137
|
junction.versioning(branch)
|
134
138
|
end
|
@@ -138,13 +142,18 @@ module Spider; module Model
|
|
138
142
|
elh[:attributes][:junction_their_element] = "#{elh[:attributes][:junction_their_element]}".to_sym
|
139
143
|
vmod.remove_element(el.name)
|
140
144
|
junction_type = nil
|
141
|
-
if
|
145
|
+
if is_version_content
|
142
146
|
junction_type = el.type.version_model
|
143
147
|
else
|
144
148
|
junction_type = el.type
|
145
149
|
elh[:attributes].delete(:reverse)
|
146
150
|
elh[:attributes].delete(:add_reverse)
|
147
151
|
elh[:attributes].delete(:add_multiple_reverse)
|
152
|
+
v_junction = junction.version_model
|
153
|
+
v_junction.remove_element(elh[:attributes][:junction_their_element])
|
154
|
+
v_junction.element(elh[:attributes][:junction_their_element], el.type, :association => :choice, :junction_reference => true)
|
155
|
+
v_junction.integrate(elh[:attributes][:junction_their_element], :hidden => true, :no_pks => true)
|
156
|
+
|
148
157
|
end
|
149
158
|
vmod.send(elh[:method], el.name, junction_type, elh[:attributes])
|
150
159
|
|
@@ -154,7 +163,14 @@ module Spider; module Model
|
|
154
163
|
end
|
155
164
|
end
|
156
165
|
end
|
157
|
-
vmod.elements_array.each{ |el| el.attributes[:unique] = false if el.attributes[:unique] }
|
166
|
+
vmod.elements_array.each{ |el| el.attributes[:unique] = false if el.attributes[:unique] }
|
167
|
+
doc_storage = Spider.conf.get('storage.versioning.use_document')
|
168
|
+
if doc_storage && Spider.conf.get("storages.#{doc_storage}")
|
169
|
+
vmod.use_storage(doc_storage)
|
170
|
+
vmod.elements_array.select{ |el| el.junction? }.each do |el|
|
171
|
+
el.model.use_storage(doc_storage)
|
172
|
+
end
|
173
|
+
end
|
158
174
|
end
|
159
175
|
|
160
176
|
def version_element(el=nil)
|
@@ -173,14 +189,15 @@ module Spider; module Model
|
|
173
189
|
@version_models[branch] = model
|
174
190
|
end
|
175
191
|
|
176
|
-
# Returns the elements that
|
192
|
+
# Returns the elements that concur to define the objects version
|
177
193
|
def version_contents
|
178
194
|
#no_content_assocs = [:choice, :multiple_choice]
|
179
195
|
no_content_assocs = []
|
196
|
+
supports_embed = self.storage.supports?(:embedding)
|
180
197
|
|
181
198
|
self.elements_array.select{ |el|
|
182
199
|
el.attributes[:version_content] || mapper.have_references?(el.name) || (!el.attributes[:added_reverse] && !no_content_assocs.include?(el.association))
|
183
|
-
}.reject{ |el| el.model? && !(el.model < Spider::Model::Versioned) }
|
200
|
+
}.reject{ |el| el.attributes[:version_content] == false || (el.model? && !(el.model < Spider::Model::Versioned)) }
|
184
201
|
end
|
185
202
|
|
186
203
|
def version_ignored_elements
|
@@ -195,22 +212,28 @@ module Spider; module Model
|
|
195
212
|
|
196
213
|
module Mapper
|
197
214
|
|
198
|
-
def get_dependencies(
|
199
|
-
|
215
|
+
def get_dependencies(task)
|
216
|
+
return super unless @model.respond_to?(:version_model)
|
200
217
|
deps = []
|
218
|
+
obj = task.object
|
219
|
+
action = task.action
|
201
220
|
version_contents = obj.class.version_contents
|
202
|
-
|
221
|
+
vmod = @model.version_model
|
203
222
|
case action
|
204
223
|
when :save_version
|
205
|
-
#Spider.logger.debug("PROCESSING DEPS ON #{obj}")
|
206
224
|
version_contents.each do |vc|
|
207
225
|
next unless vc.model?
|
208
226
|
next if vc.integrated?
|
227
|
+
v_el = vmod.elements[vc.name]
|
228
|
+
next unless v_el
|
229
|
+
is_embedded = v_el.attributes[:embedded] && vmod.storage.supports?(:embedding)
|
230
|
+
next if is_embedded && !vc.junction?
|
231
|
+
Spider.logger.debug("VC #{vc.name}")
|
209
232
|
set = obj.send(vc.name)
|
210
233
|
next unless set
|
211
234
|
set = obj.prepare_version_object(vc.name, set) if obj.respond_to?(:prepare_version_object)
|
212
|
-
next if set
|
213
|
-
set =
|
235
|
+
next if set.eql?(obj)
|
236
|
+
set = obj.instance_variable_get("@#{vc.name}_junction") if vc.junction? && !vc.attributes[:keep_junction]
|
214
237
|
next unless set
|
215
238
|
set = [set] unless vc.multiple?
|
216
239
|
set.each do |set_obj|
|
@@ -223,8 +246,12 @@ module Spider; module Model
|
|
223
246
|
dejunct = obj.class.prepare_junction_version_object(vc.name, dejunct) if obj.class.respond_to?(:prepare_junction_version_object)
|
224
247
|
dejunct_task = MapperTask.new(dejunct, :save_version)
|
225
248
|
junction_task = MapperTask.new(set_obj, :save_version)
|
226
|
-
|
227
|
-
|
249
|
+
if is_embedded
|
250
|
+
deps << [task, dejunct_task] if dejunct.class < Spider::Model::Versioned
|
251
|
+
else
|
252
|
+
deps << [junction_task, dejunct_task] if dejunct.class < Spider::Model::Versioned
|
253
|
+
deps << [junction_task, task]
|
254
|
+
end
|
228
255
|
else
|
229
256
|
#Spider.logger.debug("Version on #{set_obj} (#{set_obj.class}) depends on #{obj} (#{obj.class})")
|
230
257
|
deps << [MapperTask.new(set_obj, :save_version), task]
|
@@ -239,14 +266,12 @@ module Spider; module Model
|
|
239
266
|
|
240
267
|
def execute_action(action, object, params) # :nodoc:
|
241
268
|
return super unless [:save_version, :save_junction_version].include?(action)
|
242
|
-
@unit_of_work_task = true
|
243
269
|
case action
|
244
270
|
when :save_version
|
245
271
|
save_version(object)
|
246
272
|
when :save_junction_version
|
247
273
|
save_junction_version(object)
|
248
274
|
end
|
249
|
-
@unit_of_work_task = false
|
250
275
|
end
|
251
276
|
|
252
277
|
def save_version(object)
|
@@ -381,7 +406,7 @@ module Spider; module Model
|
|
381
406
|
obj.each{ |o| except_objects << o }
|
382
407
|
else
|
383
408
|
except_objects << obj
|
384
|
-
end
|
409
|
+
end
|
385
410
|
end
|
386
411
|
end
|
387
412
|
self.class.elements_array.each do |el|
|
@@ -433,10 +458,12 @@ module Spider; module Model
|
|
433
458
|
version_contents = self.class.version_contents
|
434
459
|
|
435
460
|
self.class.elements_array.each do |el|
|
436
|
-
|
461
|
+
v_el = vmod.elements[el.name]
|
462
|
+
next unless v_el
|
437
463
|
next if el.model? && el.type.attributes[:version_model]
|
438
|
-
next if el.integrated?
|
439
|
-
|
464
|
+
next if el.integrated? && !(el.integrated_from.embedded? && vmod.storage.supports?(:embedding))
|
465
|
+
is_embedded = el.attributes[:embedded] && vmod.storage.supports?(:embedding)
|
466
|
+
next if el.multiple? && el.model.respond_to?(:version_element) && !is_embedded
|
440
467
|
is_version_content = version_contents.include?(el)
|
441
468
|
#debugger if el.name == :news_list
|
442
469
|
el_val = self.get(el)
|
@@ -445,14 +472,23 @@ module Spider; module Model
|
|
445
472
|
end
|
446
473
|
#next unless mod.mapper.have_references?(el)
|
447
474
|
if el_val && el.multiple?
|
448
|
-
if !
|
475
|
+
if !(v_el.model < Spider::Model::VersionModel)
|
449
476
|
el_val.each do |v|
|
450
477
|
vobj.get(el.name) << v
|
451
478
|
end
|
479
|
+
elsif is_embedded && el.junction?
|
480
|
+
el_val = instance_variable_get("@#{el.name}_junction") if !el.attributes[:keep_junction]
|
481
|
+
el_val.each do |v|
|
482
|
+
jv = v_el.model.new
|
483
|
+
jv_sha1 = v.version_sha1
|
484
|
+
v.populate_version_object(jv)
|
485
|
+
jv.v_sha1 = jv_sha1
|
486
|
+
vobj.get(el.name) << jv
|
487
|
+
end
|
452
488
|
end
|
453
|
-
elsif el.model? && el_val &&
|
489
|
+
elsif el.model? && el_val && v_el.type < Spider::Model::VersionModel # && is_version_content
|
454
490
|
|
455
|
-
vobj.set(el.name, el_val.get(el.
|
491
|
+
vobj.set(el.name, el_val.get(el.type.version_element))
|
456
492
|
# if self.class.attributes[:sub_model] && self.class.attributes[:sub_model].respond_to?(:prepare_junction_version_object)
|
457
493
|
# prep_val = self.class.attributes[:sub_model].prepare_junction_version_object(self.class.attributes[:sub_model_element], el_val)
|
458
494
|
# prep_val.save_version
|