spiderfw 0.6.1 → 0.6.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (204) hide show
  1. data/CHANGELOG +5 -0
  2. data/VERSION +1 -1
  3. data/apps/core/auth/lib/rbac.rb +15 -0
  4. data/apps/core/auth/models/mixins/rbac_provider.rb +28 -10
  5. data/apps/core/auth/po/it/spider_auth.po +3 -2
  6. data/apps/core/auth/po/spider_auth.pot +3 -2
  7. data/apps/core/auth/views/login.shtml +1 -1
  8. data/apps/core/components/po/it/spider_components.po +11 -12
  9. data/apps/core/components/po/spider_components.pot +11 -10
  10. data/apps/core/components/public/css/crud.css +4 -0
  11. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/css/Aristo/jquery-ui.custom.css +1 -0
  12. data/apps/core/components/public/js/jquery/plugins/bsmselect/README.md +1 -0
  13. data/apps/core/components/public/js/jquery/plugins/bsmselect/js/jquery.bsmselect.js +11 -11
  14. data/apps/core/components/public/js/jquery/plugins/jquery.form.js +325 -154
  15. data/apps/core/components/public/js/spider.js +6 -0
  16. data/apps/core/components/widgets/admin/admin.rb +44 -1
  17. data/apps/core/components/widgets/crud/crud.rb +48 -27
  18. data/apps/core/components/widgets/crud/crud.shtml +5 -3
  19. data/apps/core/components/widgets/table/table.rb +3 -3
  20. data/apps/core/forms/po/it/spider_forms.po +4 -4
  21. data/apps/core/forms/po/spider_forms.pot +4 -3
  22. data/apps/core/forms/public/ckeditor/CHANGES.html +1295 -0
  23. data/apps/core/forms/public/ckeditor/INSTALL.html +92 -0
  24. data/apps/core/forms/public/ckeditor/LICENSE.html +1334 -0
  25. data/apps/core/forms/public/ckeditor/adapters/jquery.js +2 -2
  26. data/apps/core/forms/public/ckeditor/ckeditor.js +141 -133
  27. data/apps/core/forms/public/ckeditor/ckeditor_basic.js +8 -0
  28. data/apps/core/forms/public/ckeditor/ckeditor_basic_source.js +20 -0
  29. data/apps/core/forms/public/ckeditor/ckeditor_source.js +25 -0
  30. data/apps/core/forms/public/ckeditor/config.js +11 -0
  31. data/apps/core/forms/public/ckeditor/contents.css +23 -0
  32. data/apps/core/forms/public/ckeditor/lang/_languages.js +2 -2
  33. data/apps/core/forms/public/ckeditor/lang/_translationstatus.txt +58 -57
  34. data/apps/core/forms/public/ckeditor/lang/af.js +2 -2
  35. data/apps/core/forms/public/ckeditor/lang/ar.js +2 -2
  36. data/apps/core/forms/public/ckeditor/lang/bg.js +2 -2
  37. data/apps/core/forms/public/ckeditor/lang/bn.js +2 -2
  38. data/apps/core/forms/public/ckeditor/lang/bs.js +2 -2
  39. data/apps/core/forms/public/ckeditor/lang/ca.js +2 -2
  40. data/apps/core/forms/public/ckeditor/lang/cs.js +2 -2
  41. data/apps/core/forms/public/ckeditor/lang/cy.js +2 -2
  42. data/apps/core/forms/public/ckeditor/lang/da.js +2 -2
  43. data/apps/core/forms/public/ckeditor/lang/de.js +2 -2
  44. data/apps/core/forms/public/ckeditor/lang/el.js +2 -2
  45. data/apps/core/forms/public/ckeditor/lang/en-au.js +2 -2
  46. data/apps/core/forms/public/ckeditor/lang/en-ca.js +2 -2
  47. data/apps/core/forms/public/ckeditor/lang/en-gb.js +2 -2
  48. data/apps/core/forms/public/ckeditor/lang/en.js +2 -2
  49. data/apps/core/forms/public/ckeditor/lang/eo.js +2 -2
  50. data/apps/core/forms/public/ckeditor/lang/es.js +2 -2
  51. data/apps/core/forms/public/ckeditor/lang/et.js +2 -2
  52. data/apps/core/forms/public/ckeditor/lang/eu.js +2 -2
  53. data/apps/core/forms/public/ckeditor/lang/fa.js +2 -2
  54. data/apps/core/forms/public/ckeditor/lang/fi.js +2 -2
  55. data/apps/core/forms/public/ckeditor/lang/fo.js +2 -2
  56. data/apps/core/forms/public/ckeditor/lang/fr-ca.js +2 -2
  57. data/apps/core/forms/public/ckeditor/lang/fr.js +2 -2
  58. data/apps/core/forms/public/ckeditor/lang/gl.js +2 -2
  59. data/apps/core/forms/public/ckeditor/lang/gu.js +2 -2
  60. data/apps/core/forms/public/ckeditor/lang/he.js +2 -2
  61. data/apps/core/forms/public/ckeditor/lang/hi.js +2 -2
  62. data/apps/core/forms/public/ckeditor/lang/hr.js +2 -2
  63. data/apps/core/forms/public/ckeditor/lang/hu.js +2 -2
  64. data/apps/core/forms/public/ckeditor/lang/is.js +2 -2
  65. data/apps/core/forms/public/ckeditor/lang/it.js +2 -2
  66. data/apps/core/forms/public/ckeditor/lang/ja.js +2 -2
  67. data/apps/core/forms/public/ckeditor/lang/ka.js +6 -0
  68. data/apps/core/forms/public/ckeditor/lang/km.js +2 -2
  69. data/apps/core/forms/public/ckeditor/lang/ko.js +2 -2
  70. data/apps/core/forms/public/ckeditor/lang/lt.js +2 -2
  71. data/apps/core/forms/public/ckeditor/lang/lv.js +2 -2
  72. data/apps/core/forms/public/ckeditor/lang/mn.js +2 -2
  73. data/apps/core/forms/public/ckeditor/lang/ms.js +2 -2
  74. data/apps/core/forms/public/ckeditor/lang/nb.js +2 -2
  75. data/apps/core/forms/public/ckeditor/lang/nl.js +2 -2
  76. data/apps/core/forms/public/ckeditor/lang/no.js +2 -2
  77. data/apps/core/forms/public/ckeditor/lang/pl.js +2 -2
  78. data/apps/core/forms/public/ckeditor/lang/pt-br.js +2 -2
  79. data/apps/core/forms/public/ckeditor/lang/pt.js +2 -2
  80. data/apps/core/forms/public/ckeditor/lang/ro.js +2 -2
  81. data/apps/core/forms/public/ckeditor/lang/ru.js +2 -2
  82. data/apps/core/forms/public/ckeditor/lang/sk.js +2 -2
  83. data/apps/core/forms/public/ckeditor/lang/sl.js +2 -2
  84. data/apps/core/forms/public/ckeditor/lang/sr-latn.js +2 -2
  85. data/apps/core/forms/public/ckeditor/lang/sr.js +2 -2
  86. data/apps/core/forms/public/ckeditor/lang/sv.js +2 -2
  87. data/apps/core/forms/public/ckeditor/lang/th.js +2 -2
  88. data/apps/core/forms/public/ckeditor/lang/tr.js +2 -2
  89. data/apps/core/forms/public/ckeditor/lang/uk.js +2 -2
  90. data/apps/core/forms/public/ckeditor/lang/vi.js +2 -2
  91. data/apps/core/forms/public/ckeditor/lang/zh-cn.js +2 -2
  92. data/apps/core/forms/public/ckeditor/lang/zh.js +2 -2
  93. data/apps/core/forms/public/ckeditor/plugins/a11yhelp/dialogs/a11yhelp.js +2 -2
  94. data/apps/core/forms/public/ckeditor/plugins/a11yhelp/lang/en.js +2 -2
  95. data/apps/core/forms/public/ckeditor/plugins/a11yhelp/lang/he.js +1 -1
  96. data/apps/core/forms/public/ckeditor/plugins/about/dialogs/about.js +2 -2
  97. data/apps/core/forms/public/ckeditor/plugins/adobeair/plugin.js +6 -0
  98. data/apps/core/forms/public/ckeditor/plugins/ajax/plugin.js +6 -0
  99. data/apps/core/forms/public/ckeditor/plugins/autogrow/plugin.js +2 -2
  100. data/apps/core/forms/public/ckeditor/plugins/bbcode/plugin.js +9 -0
  101. data/apps/core/forms/public/ckeditor/plugins/clipboard/dialogs/paste.js +3 -3
  102. data/apps/core/forms/public/ckeditor/plugins/colordialog/dialogs/colordialog.js +3 -3
  103. data/apps/core/forms/public/ckeditor/plugins/devtools/lang/en.js +6 -0
  104. data/apps/core/forms/public/ckeditor/plugins/devtools/plugin.js +6 -0
  105. data/apps/core/forms/public/ckeditor/plugins/dialog/dialogDefinition.js +1 -1
  106. data/apps/core/forms/public/ckeditor/plugins/div/dialogs/div.js +1 -1
  107. data/apps/core/forms/public/ckeditor/plugins/docprops/dialogs/docprops.js +10 -0
  108. data/apps/core/forms/public/ckeditor/plugins/docprops/plugin.js +6 -0
  109. data/apps/core/forms/public/ckeditor/plugins/find/dialogs/find.js +4 -4
  110. data/apps/core/forms/public/ckeditor/plugins/flash/dialogs/flash.js +4 -4
  111. data/apps/core/forms/public/ckeditor/plugins/forms/dialogs/button.js +2 -2
  112. data/apps/core/forms/public/ckeditor/plugins/forms/dialogs/checkbox.js +2 -2
  113. data/apps/core/forms/public/ckeditor/plugins/forms/dialogs/form.js +2 -2
  114. data/apps/core/forms/public/ckeditor/plugins/forms/dialogs/hiddenfield.js +2 -2
  115. data/apps/core/forms/public/ckeditor/plugins/forms/dialogs/radio.js +2 -2
  116. data/apps/core/forms/public/ckeditor/plugins/forms/dialogs/select.js +4 -4
  117. data/apps/core/forms/public/ckeditor/plugins/forms/dialogs/textarea.js +2 -2
  118. data/apps/core/forms/public/ckeditor/plugins/forms/dialogs/textfield.js +2 -3
  119. data/apps/core/forms/public/ckeditor/plugins/iframe/dialogs/iframe.js +7 -0
  120. data/apps/core/forms/public/ckeditor/plugins/iframe/images/placeholder.png +0 -0
  121. data/apps/core/forms/public/ckeditor/plugins/iframedialog/plugin.js +2 -2
  122. data/apps/core/forms/public/ckeditor/plugins/image/dialogs/image.js +8 -8
  123. data/apps/core/forms/public/ckeditor/plugins/link/dialogs/anchor.js +2 -2
  124. data/apps/core/forms/public/ckeditor/plugins/link/dialogs/link.js +7 -7
  125. data/apps/core/forms/public/ckeditor/plugins/liststyle/dialogs/liststyle.js +1 -1
  126. data/apps/core/forms/public/ckeditor/plugins/pastefromword/filter/default.js +7 -6
  127. data/apps/core/forms/public/ckeditor/plugins/pastetext/dialogs/pastetext.js +2 -2
  128. data/apps/core/forms/public/ckeditor/plugins/placeholder/dialogs/placeholder.js +6 -0
  129. data/apps/core/forms/public/ckeditor/plugins/placeholder/lang/en.js +6 -0
  130. data/apps/core/forms/public/ckeditor/plugins/placeholder/lang/he.js +6 -0
  131. data/apps/core/forms/public/ckeditor/plugins/placeholder/placeholder.gif +0 -0
  132. data/apps/core/forms/public/ckeditor/plugins/placeholder/plugin.js +6 -0
  133. data/apps/core/forms/public/ckeditor/plugins/scayt/dialogs/options.js +4 -4
  134. data/apps/core/forms/public/ckeditor/plugins/scayt/dialogs/toolbar.css +1 -1
  135. data/apps/core/forms/public/ckeditor/plugins/smiley/dialogs/smiley.js +3 -3
  136. data/apps/core/forms/public/ckeditor/plugins/specialchar/dialogs/specialchar.js +3 -3
  137. data/apps/core/forms/public/ckeditor/plugins/specialchar/lang/en.js +6 -0
  138. data/apps/core/forms/public/ckeditor/plugins/styles/styles/default.js +1 -1
  139. data/apps/core/forms/public/ckeditor/plugins/stylesheetparser/plugin.js +6 -0
  140. data/apps/core/forms/public/ckeditor/plugins/table/dialogs/table.js +3 -3
  141. data/apps/core/forms/public/ckeditor/plugins/tableresize/plugin.js +2 -2
  142. data/apps/core/forms/public/ckeditor/plugins/tabletools/dialogs/tableCell.js +4 -4
  143. data/apps/core/forms/public/ckeditor/plugins/templates/dialogs/templates.js +2 -2
  144. data/apps/core/forms/public/ckeditor/plugins/templates/templates/default.js +1 -1
  145. data/apps/core/forms/public/ckeditor/plugins/uicolor/dialogs/uicolor.js +1 -1
  146. data/apps/core/forms/public/ckeditor/plugins/uicolor/lang/en.js +1 -1
  147. data/apps/core/forms/public/ckeditor/plugins/uicolor/lang/he.js +1 -1
  148. data/apps/core/forms/public/ckeditor/plugins/uicolor/plugin.js +1 -1
  149. data/apps/core/forms/public/ckeditor/plugins/uicolor/yui/assets/yui.css +1 -1
  150. data/apps/core/forms/public/ckeditor/plugins/uicolor/yui/yui.js +1 -1
  151. data/apps/core/forms/public/ckeditor/plugins/wsc/dialogs/ciframe.html +1 -1
  152. data/apps/core/forms/public/ckeditor/plugins/wsc/dialogs/tmpFrameset.html +1 -1
  153. data/apps/core/forms/public/ckeditor/plugins/wsc/dialogs/wsc.css +1 -1
  154. data/apps/core/forms/public/ckeditor/plugins/wsc/dialogs/wsc.js +3 -3
  155. data/apps/core/forms/public/ckeditor/plugins/xml/plugin.js +6 -0
  156. data/apps/core/forms/public/ckeditor/skins/kama/dialog.css +5 -5
  157. data/apps/core/forms/public/ckeditor/skins/kama/editor.css +9 -8
  158. data/apps/core/forms/public/ckeditor/skins/kama/icons.png +0 -0
  159. data/apps/core/forms/public/ckeditor/skins/kama/icons_rtl.png +0 -0
  160. data/apps/core/forms/public/ckeditor/skins/kama/skin.js +3 -3
  161. data/apps/core/forms/public/ckeditor/skins/kama/templates.css +1 -1
  162. data/apps/core/forms/public/ckeditor/themes/default/theme.js +4 -4
  163. data/apps/core/forms/public/css/form.css +1 -0
  164. data/apps/core/forms/public/css/html_area.css +3 -0
  165. data/apps/core/forms/public/html_area.js +4 -4
  166. data/apps/core/forms/public/search_select.js +2 -2
  167. data/apps/core/forms/public/select.js +5 -5
  168. data/apps/core/forms/tags/element_label.erb +5 -2
  169. data/apps/core/forms/tags/element_row.erb +7 -6
  170. data/apps/core/forms/tags/row.erb +6 -4
  171. data/apps/core/forms/widgets/form/form.rb +5 -4
  172. data/apps/core/forms/widgets/inputs/html_area/html_area.rb +10 -4
  173. data/apps/core/forms/widgets/inputs/html_area/html_area.shtml +1 -0
  174. data/apps/core/forms/widgets/inputs/select/select.rb +18 -5
  175. data/apps/core/forms/widgets/inputs/select/select.shtml +3 -0
  176. data/apps/master/po/master.pot +408 -0
  177. data/apps/messenger/po/it/spider_messenger.po +6 -10
  178. data/apps/messenger/po/spider_messenger.pot +2 -1
  179. data/blueprints/home/{Gemfile → Gemfile.disabled} +0 -0
  180. data/lib/spiderfw/config/configuration.rb +5 -0
  181. data/lib/spiderfw/config/options/spider.rb +2 -2
  182. data/lib/spiderfw/controller/controller.rb +4 -1
  183. data/lib/spiderfw/controller/mixins/http_mixin.rb +2 -0
  184. data/lib/spiderfw/create.rb +9 -5
  185. data/lib/spiderfw/model/base_model.rb +32 -9
  186. data/lib/spiderfw/model/condition.rb +7 -0
  187. data/lib/spiderfw/model/datatypes/text.rb +3 -1
  188. data/lib/spiderfw/model/mappers/db_mapper.rb +19 -5
  189. data/lib/spiderfw/model/mappers/mapper.rb +1 -1
  190. data/lib/spiderfw/model/mixins/tree.rb +2 -1
  191. data/lib/spiderfw/model/query_set.rb +14 -13
  192. data/lib/spiderfw/model/storage/db/adapters/mysql.rb +7 -2
  193. data/lib/spiderfw/model/storage/db/db_schema.rb +4 -2
  194. data/lib/spiderfw/model/storage/db/db_storage.rb +4 -4
  195. data/lib/spiderfw/model/unit_of_work.rb +3 -1
  196. data/lib/spiderfw/templates/blocks/html.rb +2 -2
  197. data/lib/spiderfw/templates/blocks/lambda.rb +25 -0
  198. data/lib/spiderfw/templates/blocks/recurse.rb +41 -0
  199. data/lib/spiderfw/templates/blocks/widget.rb +2 -3
  200. data/lib/spiderfw/templates/layout.rb +20 -3
  201. data/lib/spiderfw/templates/template.rb +35 -29
  202. data/lib/spiderfw/templates/template_blocks.rb +6 -0
  203. data/lib/spiderfw/widget/widget.rb +2 -1
  204. metadata +35 -5
@@ -13,6 +13,8 @@ function $W(path){
13
13
 
14
14
 
15
15
  Spider = function(){};
16
+ if (window.SPIDER_BASE_URL) Spider.baseUrl = window.SPIDER_BASE_URL;
17
+ else Spider.baseUrl = "";
16
18
 
17
19
  Spider.widgets = {};
18
20
 
@@ -73,6 +75,10 @@ Spider.Widget = Class.extend({
73
75
  callback = params;
74
76
  params = {};
75
77
  }
78
+ if ($.browser.msie){
79
+ if (!params) params = {};
80
+ params['_t'] = (new Date).valueOf();
81
+ }
76
82
  $C.loadWidget(this.path, params, callback);
77
83
  },
78
84
 
@@ -20,6 +20,7 @@ module Spider; module Components
20
20
  i_attribute :models, :process => lambda{ |models| models.split(/,[\s\n]*/).map{|m| const_get_full(m) } }
21
21
  is_attr_accessor :title, :default => lambda{ _("Administration") }
22
22
  is_attr_accessor :logout_url, :default => Spider::Auth.request_url+'/login/logout'
23
+ attr_accessor :custom_widgets
23
24
 
24
25
  def init
25
26
  @items = []
@@ -31,9 +32,19 @@ module Spider; module Components
31
32
 
32
33
  def prepare_widgets
33
34
  @models.each do |model|
35
+ if @user_checks && user_check = @user_checks[model]
36
+ next unless @request.user
37
+ next unless @request.user.respond_to?(user_check)
38
+ next unless @request.user.send(user_check)
39
+ end
34
40
  crud = Crud.new(@request, @response)
35
41
  crud.id = model.name.to_s.gsub('::', '_').downcase
36
42
  crud.model = model
43
+ if @custom_widgets && @custom_widgets[model]
44
+ crud.table_widget = @custom_widgets[model][:table] if @custom_widgets[model][:table]
45
+ crud.form_widget = @custom_widgets[model][:form] if @custom_widgets[model][:form]
46
+ end
47
+
37
48
  @widgets[:switcher].add(model.label_plural, crud, _('Manage Data'))
38
49
  end
39
50
  if (@request.respond_to?(:user) && @request.user)
@@ -50,11 +61,43 @@ module Spider; module Components
50
61
  super
51
62
  end
52
63
 
64
+ def self.parse_content(doc)
65
+ assets_widgets = []
66
+ doc.search('admin:model').each do |mod|
67
+ if table = mod.get_attribute('table')
68
+ assets_widgets << table
69
+ end
70
+ if form = mod.get_attribute('form')
71
+ assets_widgets << form
72
+ end
73
+ end
74
+ assets_widgets.uniq!
75
+ rc, ov = super
76
+ unless assets_widgets.empty?
77
+ ov << Hpricot("<tpl:prepend><tpl:assets widgets=\"#{assets_widgets.uniq.join(',')}\"></tpl:prepend>").root
78
+ end
79
+ [rc, ov]
80
+ end
81
+
53
82
  def parse_runtime_content(doc, src_path)
83
+ @custom_widgets ||= {}
84
+ @user_checks ||= {}
54
85
  doc = super
55
86
  mods = []
56
87
  doc.search('admin:model').each do |mod|
57
- mods << const_get_full(mod.innerText)
88
+ model = const_get_full(mod.innerText)
89
+ mods << model
90
+ if table = mod.get_attribute('table')
91
+ @custom_widgets[model] ||= {}
92
+ @custom_widgets[model][:table] = table
93
+ end
94
+ if form = mod.get_attribute('form')
95
+ @custom_widgets[model] ||= {}
96
+ @custom_widgets[model][:form] = form
97
+ end
98
+ if user_check = mod.get_attribute('if-user')
99
+ @user_checks[model] = user_check.to_sym
100
+ end
58
101
  end
59
102
  doc.search('admin:app').each do |app_tag|
60
103
  except = []
@@ -7,6 +7,8 @@ module Spider; module Components
7
7
  is_attr_accessor :model, :required => true
8
8
  is_attribute :action, :type => Symbol, :default => :table
9
9
  attribute :table_elements
10
+ i_attr_accessor :table_widget
11
+ i_attr_accessor :form_widget
10
12
  attr_accessor :fixed
11
13
 
12
14
  def route_widget
@@ -18,17 +20,31 @@ module Spider; module Components
18
20
  @_pass_action = (@action == :form) ? @_action : nil
19
21
  @model = const_get_full(@model) if @model.is_a?(String)
20
22
  @scene.saved = flash[:saved]
21
- if (params['delete_cancel'])
23
+ if params['delete_cancel']
22
24
  params.delete('delete')
23
25
  params.delete('do_delete')
24
26
  end
25
- if (params['delete'] && !params['do_delete'] && params['selected'])
27
+ if params['delete'] && !params['do_delete'] && params['selected']
26
28
  @scene.ask_delete = true
27
29
  end
30
+ if @action == :table && @table_widget
31
+ custom_table = create_widget(@table_widget, 'table')
32
+ custom_table.model = @model if custom_table.is_a?(Spider::Components::Table)
33
+ @scene.custom_table = custom_table
34
+ end
35
+ if @action == :form && @form_widget
36
+ custom_form = create_widget(@form_widget, 'form')
37
+ custom_form.model = @model if custom_form.is_a?(Spider::Forms::Form)
38
+ @scene.custom_form = custom_form
39
+ end
40
+
28
41
  super
29
- transient_session[:table_params] ||= @widgets[:table].params if (@widgets[:table])
42
+ transient_session[:table_params] ||= @widgets[:table].params if @widgets[:table]
30
43
 
31
- if (@action == :table)
44
+ if @action == :table
45
+ if @widgets[:table].is_a?(Spider::Components::Table) && !@widgets[:table].is_a?(Spider::Components::SearchTable)
46
+ @scene.show_table_search = true
47
+ end
32
48
  if params['do_delete'] && params['selected'] && params['selected'].length > 0
33
49
  delete_rows
34
50
  flash[:deleted] = true
@@ -42,13 +58,13 @@ module Spider; module Components
42
58
  rows << "Altri #{total - 10}" if total > 10
43
59
  @widgets[:ask_delete].scene.rows_to_del = rows
44
60
  end
45
- elsif (@action == :form)
61
+ elsif @action == :form
46
62
  # debugger
47
- if (@widgets[:form].saved?)
63
+ if @widgets[:form].saved?
48
64
  flash[:saved] = true
49
- if (@widgets[:form].saved_and_new?)
65
+ if @widgets[:form].saved_and_new?
50
66
  redirect(widget_request_path+'/new')
51
- elsif (@widgets[:form].saved_and_stay?)
67
+ elsif @widgets[:form].saved_and_stay?
52
68
  redirect(widget_request_path+'/'+@widgets[:form].pk)
53
69
  else
54
70
  redirect(widget_request_path)
@@ -59,39 +75,44 @@ module Spider; module Components
59
75
  end
60
76
 
61
77
  def prepare_widgets
62
- if (@action == :table && @widgets[:table])
78
+ if @action == :table && @widgets[:table]
63
79
  @key_element = @model.primary_keys[0].name
64
80
  table_page = nil
65
- if (transient_session[:table_params])
81
+ if transient_session[:table_params]
66
82
  table_page = transient_session[:table_params]['page'] if transient_session[:table_params]['page']
67
83
  end
68
84
  table_page = 1 if params['table_q'] || params['clear_table_q']
69
- @widgets[:table].page = table_page
70
- @widgets[:table].attributes[:elements] = @attributes[:table_elements]
85
+ @widgets[:table].page = table_page if @widgets[:table].respond_to?(:page)
86
+ t_els = @attributes[:table_elements]
87
+ if t_els && @widgets[:table].class.attribute?(:elements)
88
+ @widgets[:table].attributes[:elements] = t_els
89
+ end
71
90
  @widgets[:table].scene.key_element = @key_element
72
91
  @widgets[:table].scene.crud_path = @full_path
73
92
  @widgets[:table].scene.crud = widget_to_scene(self)
74
- @table_q = params['table_q']
75
- @table_q ||= transient_session[:table_q]
76
- @table_q = nil if params['clear_table_q']
77
- if (@table_q)
78
- @widgets[:table].add_condition(@model.free_query_condition(@table_q))
79
- end
80
- transient_session[:table_q] = @table_q
81
- if(@condition && @widgets[:table])
82
- @widgets[:table].add_condition(@condition)
93
+ if @widgets[:table].respond_to?(:add_condition)
94
+ @table_q = params['table_q']
95
+ @table_q ||= transient_session[:table_q]
96
+ @table_q = nil if params['clear_table_q']
97
+ if @table_q
98
+ @widgets[:table].add_condition(@model.free_query_condition(@table_q))
99
+ end
100
+ transient_session[:table_q] = @table_q
101
+ if @condition && @widgets[:table]
102
+ @widgets[:table].add_condition(@condition)
103
+ end
104
+ @scene.table_q = @table_q
83
105
  end
84
- @scene.table_q = @table_q
85
106
  end
86
- if (@fixed)
87
- if (@widgets[:table])
107
+ if @fixed
108
+ if @widgets[:table] && @widgets[:table].respond_to?(:add_condition)
88
109
  c = Spider::Model::Condition.new(@fixed)
89
110
  @widgets[:table].add_condition(c)
90
- elsif (@widgets[:form])
111
+ elsif @widgets[:form]
91
112
  @widgets[:form].fixed = @fixed
92
113
  end
93
114
  end
94
- if (@widgets[:ask_delete])
115
+ if @widgets[:ask_delete]
95
116
  @widgets[:ask_delete].add_action('_w'+param_name(self)+'[delete_cancel]', _("Cancel"))
96
117
  @widgets[:ask_delete].add_action('_w'+param_name(self)+'[do_delete]', _('Ok'))
97
118
  end
@@ -101,7 +122,7 @@ module Spider; module Components
101
122
  end
102
123
 
103
124
  def after_widget(id)
104
- if (id == :table)
125
+ if id == :table && @widgets[:table].is_a?(Spider::Components::Table)
105
126
  links = {}
106
127
  table_rows = @widgets[:table].scene.data
107
128
  table_rows.each_index do |i|
@@ -28,14 +28,15 @@
28
28
  Crea nuovo
29
29
  </a>
30
30
  </div>
31
- <div class="table_search" sp:if="@action == :table">
31
+ <div class="table_search" sp:if="@action == :table && @show_table_search">
32
32
  <form action="{ @request[:path] }" method="GET">
33
33
  <input type="text" name="_w{ param_name(@widget) }[table_q]" value="{ @table_q }">
34
34
  <input type="submit" name="submit" value="Trova">
35
35
  <input type="submit" name="_w{ param_name(@widget) }[clear_table_q]" value="Pulisci">
36
36
  </form>
37
37
  </div>
38
- <core:table sp:if="@action == :table" id="table" model="@model">
38
+ <sp:run sp:if="@action == :table && @custom_table" obj="@custom_table" />
39
+ <core:table sp:if="@action == :table && !@custom_table" id="table" model="@model">
39
40
  <tpl:override-content search="table .row td">
40
41
  <a href="{ @links_to_form[row_i] }" sp:tag-if="element == @key_element"><tpl:overridden /></a>
41
42
  </tpl:override-content>
@@ -55,6 +56,7 @@
55
56
  </tpl:append>
56
57
  <tpl:override-attr search="table .paginator td" name="colspan" value="{ elements.size + 1 }" />
57
58
  </core:table>
58
- <forms:form sp:if="@action == :form" id="form" model="@model" show_related="true" show_additional_buttons="true" />
59
+ <sp:run sp:if="@action == :form && @custom_form" obj="@custom_form" />
60
+ <forms:form sp:if="@action == :form && !@custom_form" id="form" model="@model" show_related="true" show_additional_buttons="true" />
59
61
  </sp:pass>
60
62
  </div>
@@ -15,8 +15,8 @@ module Spider; module Components
15
15
  attribute :link_id, :type => Symbol
16
16
  attribute :link
17
17
  attribute :sort
18
- i_attribute :queryset
19
- i_attribute :model
18
+ i_attr_accessor :queryset
19
+ i_attr_accessor :model
20
20
  attr_accessor :queryset, :condition, :page
21
21
 
22
22
  def condition
@@ -92,7 +92,7 @@ module Spider; module Components
92
92
  @elements.each do |el|
93
93
  @scene.labels[el] = @model.elements[el].label
94
94
  end
95
- @rows = prepare_queryset(@queryset ? @queryset : @model.all)
95
+ @rows = prepare_queryset(@queryset ? @queryset : @model.list)
96
96
  @rows.condition.and(self.condition) if self.condition && !self.condition.empty?
97
97
  if (@attributes[:paginate])
98
98
  @rows.limit = @attributes[:row_limit]
@@ -6,10 +6,11 @@
6
6
  msgid ""
7
7
  msgstr ""
8
8
  "Project-Id-Version: Spider::Forms 0.1\n"
9
- "POT-Creation-Date: 2010-11-29 12:48+0100\n"
9
+ "POT-Creation-Date: 2011-05-09 17:37+0200\n"
10
10
  "PO-Revision-Date: 2010-11-29 12:52+0100\n"
11
11
  "Last-Translator: Ivan Pirlik <ivan.pirlik@soluzionipa.it>\n"
12
12
  "Language-Team: LANGUAGE <LL@li.org>\n"
13
+ "Language: \n"
13
14
  "MIME-Version: 1.0\n"
14
15
  "Content-Type: text/plain; charset=UTF-8\n"
15
16
  "Content-Transfer-Encoding: 8bit\n"
@@ -31,11 +32,11 @@ msgstr "%s e nuovo"
31
32
  msgid "%s and stay"
32
33
  msgstr "%s e rimani"
33
34
 
34
- #: widgets/inputs/date_time/date_time.rb:22
35
+ #: widgets/inputs/date_time/date_time.rb:25
35
36
  msgid "%s is not a valid date"
36
37
  msgstr "%s non è una data valida"
37
38
 
38
- #: widgets/inputs/input/input.rb:94
39
+ #: widgets/inputs/input/input.rb:91
39
40
  msgid "%s is required"
40
41
  msgstr "Il campo %s è obbligatorio"
41
42
 
@@ -58,4 +59,3 @@ msgstr "Minuti"
58
59
  #: widgets/inputs/time_span/time_span.shtml:6
59
60
  msgid "Hours"
60
61
  msgstr "Ore"
61
-
@@ -7,10 +7,11 @@
7
7
  msgid ""
8
8
  msgstr ""
9
9
  "Project-Id-Version: Spider::Forms 0.1\n"
10
- "POT-Creation-Date: 2010-11-29 12:48+0100\n"
10
+ "POT-Creation-Date: 2011-05-09 17:37+0200\n"
11
11
  "PO-Revision-Date: 2009-06-30 17:03+0200\n"
12
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
+ "Language: \n"
14
15
  "MIME-Version: 1.0\n"
15
16
  "Content-Type: text/plain; charset=UTF-8\n"
16
17
  "Content-Transfer-Encoding: 8bit\n"
@@ -32,11 +33,11 @@ msgstr ""
32
33
  msgid "%s and stay"
33
34
  msgstr ""
34
35
 
35
- #: widgets/inputs/date_time/date_time.rb:22
36
+ #: widgets/inputs/date_time/date_time.rb:25
36
37
  msgid "%s is not a valid date"
37
38
  msgstr ""
38
39
 
39
- #: widgets/inputs/input/input.rb:94
40
+ #: widgets/inputs/input/input.rb:91
40
41
  msgid "%s is required"
41
42
  msgstr ""
42
43