spiderfw 0.6.26.pre1 → 0.6.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (114) hide show
  1. data/CHANGELOG +4 -0
  2. data/VERSION +1 -1
  3. data/apps/app_server/lib/git_app.rb +1 -1
  4. data/apps/core/admin/admin.rb +2 -1
  5. data/apps/core/components/public/bootstrap/LICENSE +0 -0
  6. data/apps/core/components/public/bootstrap/README.md +3 -2
  7. data/apps/core/components/public/bootstrap/img/glyphicons-halflings-white.png +0 -0
  8. data/apps/core/components/public/bootstrap/img/glyphicons-halflings.png +0 -0
  9. data/apps/core/components/public/bootstrap/js/README.md +2 -2
  10. data/apps/core/components/public/bootstrap/js/bootstrap-alert.js +8 -5
  11. data/apps/core/components/public/bootstrap/js/bootstrap-button.js +5 -3
  12. data/apps/core/components/public/bootstrap/js/bootstrap-carousel.js +5 -2
  13. data/apps/core/components/public/bootstrap/js/bootstrap-collapse.js +2 -2
  14. data/apps/core/components/public/bootstrap/js/bootstrap-dropdown.js +2 -2
  15. data/apps/core/components/public/bootstrap/js/bootstrap-modal.js +6 -5
  16. data/apps/core/components/public/bootstrap/js/bootstrap-popover.js +2 -2
  17. data/apps/core/components/public/bootstrap/js/bootstrap-scrollspy.js +2 -2
  18. data/apps/core/components/public/bootstrap/js/bootstrap-tab.js +2 -2
  19. data/apps/core/components/public/bootstrap/js/bootstrap-tooltip.js +2 -2
  20. data/apps/core/components/public/bootstrap/js/bootstrap-transition.js +3 -3
  21. data/apps/core/components/public/bootstrap/js/bootstrap-typeahead.js +2 -2
  22. data/apps/core/components/public/bootstrap/js/tests/index.html +0 -0
  23. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-alert.js +2 -2
  24. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-button.js +25 -2
  25. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-collapse.js +0 -0
  26. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-dropdown.js +0 -0
  27. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-modal.js +0 -0
  28. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-popover.js +0 -0
  29. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-scrollspy.js +0 -0
  30. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-tab.js +0 -0
  31. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-tooltip.js +0 -0
  32. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-transition.js +0 -0
  33. data/apps/core/components/public/bootstrap/js/tests/unit/bootstrap-typeahead.js +0 -0
  34. data/apps/core/components/public/bootstrap/js/tests/vendor/jquery.js +0 -0
  35. data/apps/core/components/public/bootstrap/js/tests/vendor/qunit.css +0 -0
  36. data/apps/core/components/public/bootstrap/js/tests/vendor/qunit.js +0 -0
  37. data/apps/core/components/public/bootstrap/scss/_accordion.scss +0 -0
  38. data/apps/core/components/public/bootstrap/scss/_alerts.scss +0 -0
  39. data/apps/core/components/public/bootstrap/scss/_breadcrumbs.scss +0 -0
  40. data/apps/core/components/public/bootstrap/scss/_button-groups.scss +1 -1
  41. data/apps/core/components/public/bootstrap/scss/_buttons.scss +25 -7
  42. data/apps/core/components/public/bootstrap/scss/_carousel.scss +1 -1
  43. data/apps/core/components/public/bootstrap/scss/_close.scss +0 -0
  44. data/apps/core/components/public/bootstrap/scss/_code.scss +13 -0
  45. data/apps/core/components/public/bootstrap/scss/_component-animations.scss +2 -2
  46. data/apps/core/components/public/bootstrap/scss/_dropdowns.scss +2 -3
  47. data/apps/core/components/public/bootstrap/scss/_forms.scss +50 -44
  48. data/apps/core/components/public/bootstrap/scss/_grid.scss +0 -0
  49. data/apps/core/components/public/bootstrap/scss/_hero-unit.scss +0 -0
  50. data/apps/core/components/public/bootstrap/scss/_labels.scss +23 -7
  51. data/apps/core/components/public/bootstrap/scss/_layouts.scss +0 -0
  52. data/apps/core/components/public/bootstrap/scss/_mixins.scss +83 -68
  53. data/apps/core/components/public/bootstrap/scss/_modals.scss +11 -0
  54. data/apps/core/components/public/bootstrap/scss/_navbar.scss +11 -3
  55. data/apps/core/components/public/bootstrap/scss/_navs.scss +27 -17
  56. data/apps/core/components/public/bootstrap/scss/_pager.scss +0 -0
  57. data/apps/core/components/public/bootstrap/scss/_pagination.scss +38 -47
  58. data/apps/core/components/public/bootstrap/scss/_popovers.scss +0 -0
  59. data/apps/core/components/public/bootstrap/scss/_print.scss +0 -0
  60. data/apps/core/components/public/bootstrap/scss/_progress-bars.scss +0 -0
  61. data/apps/core/components/public/bootstrap/scss/_reset.scss +1 -1
  62. data/apps/core/components/public/bootstrap/scss/_scaffolding.scss +0 -0
  63. data/apps/core/components/public/bootstrap/scss/_sprites.scss +7 -5
  64. data/apps/core/components/public/bootstrap/scss/_tables.scss +14 -3
  65. data/apps/core/components/public/bootstrap/scss/_thumbnails.scss +2 -2
  66. data/apps/core/components/public/bootstrap/scss/_tooltip.scss +0 -0
  67. data/apps/core/components/public/bootstrap/scss/_type.scss +3 -2
  68. data/apps/core/components/public/bootstrap/scss/_utilities.scss +0 -0
  69. data/apps/core/components/public/bootstrap/scss/_variables.scss +12 -4
  70. data/apps/core/components/public/bootstrap/scss/_wells.scss +0 -0
  71. data/apps/core/components/public/bootstrap/scss/bootstrap.css +290 -820
  72. data/apps/core/components/public/bootstrap/scss/bootstrap.scss +1 -1
  73. data/apps/core/components/public/bootstrap/scss/{bootstrap-responsive.css → responsive.css} +42 -31
  74. data/apps/core/components/public/bootstrap/scss/{bootstrap-responsive.scss → responsive.scss} +10 -6
  75. data/apps/core/components/public/css/table_base.css +0 -4
  76. data/apps/core/components/public/js/jquery/jquery-ui-1.8.11/ui/jquery.ui.sortable.js +10 -2
  77. data/apps/core/components/public/js/plugins/sortable.js +4 -4
  78. data/apps/core/components/public/js/spider.js +3 -1
  79. data/apps/core/components/widgets/confirm/confirm.rb +20 -7
  80. data/apps/core/components/widgets/table/table.shtml +1 -1
  81. data/apps/core/forms/public/html_area.js +5 -4
  82. data/apps/core/forms/public/input.js +28 -28
  83. data/apps/core/forms/public/search_select.js +131 -131
  84. data/apps/core/forms/public/select.js +16 -16
  85. data/apps/core/forms/widgets/form/form.rb +11 -7
  86. data/apps/core/forms/widgets/inputs/date_time/date_time.rb +1 -1
  87. data/apps/core/forms/widgets/inputs/html_area/html_area.shtml +2 -2
  88. data/apps/core/forms/widgets/inputs/input/input.rb +3 -1
  89. data/apps/messenger/lib/backends/mobyt.rb +11 -0
  90. data/apps/messenger/test/features/sms_mobyt.feature +24 -0
  91. data/apps/messenger/test/features/step_definitions/sms_mobyt.rb +21 -0
  92. data/apps/messenger/views/index.shtml +2 -2
  93. data/apps/soap/controllers/soap_controller.rb +5 -2
  94. data/lib/spiderfw/app.rb +13 -0
  95. data/lib/spiderfw/config/configuration.rb +4 -1
  96. data/lib/spiderfw/config/options/spider.rb +1 -1
  97. data/lib/spiderfw/controller/http_controller.rb +2 -0
  98. data/lib/spiderfw/http/adapters/rack.rb +1 -1
  99. data/lib/spiderfw/i18n/cldr.rb +1 -1
  100. data/lib/spiderfw/model/base_model.rb +5 -0
  101. data/lib/spiderfw/model/mappers/mapper.rb +3 -1
  102. data/lib/spiderfw/model/mixins/tree.rb +11 -1
  103. data/lib/spiderfw/model/model.rb +7 -5
  104. data/lib/spiderfw/model/query_set.rb +6 -0
  105. data/lib/spiderfw/setup/app_server_client.rb +1 -1
  106. data/lib/spiderfw/spider.rb +9 -9
  107. data/lib/spiderfw/templates/layout.rb +5 -3
  108. data/lib/spiderfw/templates/resources/sass.rb +31 -3
  109. data/lib/spiderfw/templates/template.rb +10 -9
  110. data/lib/spiderfw/widget/widget.rb +2 -2
  111. metadata +13 -17
  112. data/apps/core/components/public/bootstrap/scss/_custom.css +0 -0
  113. data/apps/core/components/public/bootstrap/scss/_patterns.scss +0 -13
  114. data/apps/core/components/public/bootstrap/scss/config.rb +0 -36
@@ -1,150 +1,150 @@
1
1
  Spider.defineWidget('Spider.Forms.SearchSelect', 'Spider.Forms.Input', {
2
-
3
- autoInit: true,
4
-
5
- startup: function(){
6
- this.removed = [];
7
- this.added = [];
8
- this._super();
9
- },
10
-
11
- ready: function(){
12
- var w = this;
13
- this.multiple = this.el.is('.multiple');
14
- for (var i=0; i<this.removed.length; i++){
15
- this.removeValue(this.removed[i]);
16
- }
17
- // Convert delete checkboxses
18
- $('.delete_action', this.el).each(function(){
19
- var $this = $(this);
20
- $('input[type=checkbox]', $this).remove();
21
- var key = $this.getDataObjectKey();
22
- var textSpan = $('.action_text', $this);
23
- var a = $('<a href="#" />').text(textSpan.text());
24
- a.attr('class', $this.attr('class'));
25
- a.click(function(e){
26
- w.removed.push(key);
27
- e.preventDefault();
28
- w.removeValue(key);
29
- });
30
- textSpan.replaceWith(a);
31
-
32
- });
33
- // Convert change checkboxes
34
- $('.change_action', this.el).each(function(){
35
- var $this = $(this);
36
- $('input[type=checkbox]', $this).remove();
37
- var textSpan = $('.action_text', $this);
38
- var a = $('<a href="#" />').text(textSpan.text());
39
- a.attr('class', $this.attr('class'));
40
- a.click(function(e){
41
- e.preventDefault();
42
- w.reload({clear: true});
43
- });
44
- textSpan.replaceWith(a);
45
- });
46
- // var showTable = $('<a href="#" class="show_table"><span class="action_text">Tabella</span></a>').appendTo($('.add_box', this.el));
47
- // showTable.click(function(e){
48
- // e.preventDefault();
49
- // var table = $('.search_table', w.el).spiderWidget();
50
- // if (table.el.is(':hidden')){
51
- // table.el.show();
52
- // $(this).addClass('open');
53
- // table.reload({}, function(e){
54
- // $('tr.row', this.el).click(function(e){
55
- //
56
- // });
57
- // });
58
- // }
59
- // else{
60
- // $(this).removeClass('open');
61
- // table.el.hide();
62
- // }
63
- // });
64
- $('.add_box input[type=text]', this.el).attr('name', 'autocomplete-box').autocomplete({
65
- source: function(request, response){
2
+
3
+ autoInit: true,
4
+
5
+ startup: function(){
6
+ this.removed = [];
7
+ this.added = [];
8
+ this._super();
9
+ },
10
+
11
+ ready: function(){
12
+ var w = this;
13
+ this.multiple = this.el.is('.multiple');
14
+ for (var i=0; i<this.removed.length; i++){
15
+ this.removeValue(this.removed[i]);
16
+ }
17
+ // Convert delete checkboxses
18
+ $('.delete_action', this.el).each(function(){
19
+ var $this = $(this);
20
+ $('input[type=checkbox]', $this).remove();
21
+ var key = $this.getDataObjectKey();
22
+ var textSpan = $('.action_text', $this);
23
+ var a = $('<a href="#" />').text(textSpan.text());
24
+ a.attr('class', $this.attr('class'));
25
+ a.click(function(e){
26
+ w.removed.push(key);
27
+ e.preventDefault();
28
+ w.removeValue(key);
29
+ });
30
+ textSpan.replaceWith(a);
31
+
32
+ });
33
+ // Convert change checkboxes
34
+ $('.change_action', this.el).each(function(){
35
+ var $this = $(this);
36
+ $('input[type=checkbox]', $this).remove();
37
+ var textSpan = $('.action_text', $this);
38
+ var a = $('<a href="#" />').text(textSpan.text());
39
+ a.attr('class', $this.attr('class'));
40
+ a.click(function(e){
41
+ e.preventDefault();
42
+ w.reload({clear: true});
43
+ });
44
+ textSpan.replaceWith(a);
45
+ });
46
+ // var showTable = $('<a href="#" class="show_table"><span class="action_text">Tabella</span></a>').appendTo($('.add_box', this.el));
47
+ // showTable.click(function(e){
48
+ // e.preventDefault();
49
+ // var table = $('.search_table', w.el).spiderWidget();
50
+ // if (table.el.is(':hidden')){
51
+ // table.el.show();
52
+ // $(this).addClass('open');
53
+ // table.reload({}, function(e){
54
+ // $('tr.row', this.el).click(function(e){
55
+ //
56
+ // });
57
+ // });
58
+ // }
59
+ // else{
60
+ // $(this).removeClass('open');
61
+ // table.el.hide();
62
+ // }
63
+ // });
64
+ $('.add_box input[type=text]', this.el).attr('name', 'autocomplete-box').autocomplete({
65
+ source: function(request, response){
66
66
  var url = w.backend.urlForMethod('jquery_autocomplete');
67
67
  var current = [];
68
68
  var vl = $('.values_list', w.el).spiderWidget();
69
69
  if (vl) current = vl.keys();
70
- var params = {};
71
- for (var i=0; i<current.length; i++){
72
- params['not['+i+']'] = current[i];
73
- }
70
+ var params = {};
71
+ for (var i=0; i<current.length; i++){
72
+ params['not['+i+']'] = current[i];
73
+ }
74
74
  var data = {};
75
75
  $.extend(data, params, {
76
76
  q: request.term
77
77
  });
78
- $.ajax({
79
- // try to leverage ajaxQueue plugin to abort previous requests
80
- mode: "abort",
81
- // limit abortion to this input
82
- port: "autocomplete" + w.fullId,
83
- dataType: 'json',
84
- url: url,
78
+ $.ajax({
79
+ // try to leverage ajaxQueue plugin to abort previous requests
80
+ mode: "abort",
81
+ // limit abortion to this input
82
+ port: "autocomplete" + w.fullId,
83
+ dataType: 'json',
84
+ url: url,
85
85
  data: data,
86
- success: function(data) {
86
+ success: function(data) {
87
87
  response(data);
88
- }
88
+ }
89
89
  });
90
- },
91
- select: function(e, ui){
92
- var w = $(this).parentWidget();
93
- var data = ui.item;
94
- if (!data) return;
95
- if (w.multiple){
96
- w.added.push(data.value);
97
- for (var i=0; i<this.removed; i++){
98
- if (this.removed[i] == data.value) this.removed.splice(i, 1);
99
- }
100
- w.reload({add: w.added});
101
- }
102
- else{
103
- $('input[type=hidden].hidden-val', w.el).val(data.value);
104
- }
105
- w.trigger('change', w.val());
90
+ },
91
+ select: function(e, ui){
92
+ var w = $(this).parentWidget();
93
+ var data = ui.item;
94
+ if (!data) return;
95
+ if (w.multiple){
96
+ w.added.push(data.value);
97
+ for (var i=0; i<this.removed; i++){
98
+ if (this.removed[i] == data.value) this.removed.splice(i, 1);
99
+ }
100
+ w.reload({add: w.added});
101
+ }
102
+ else{
103
+ $('input[type=hidden].hidden-val', w.el).val(data.value);
104
+ }
105
+ w.trigger('change', w.val());
106
106
  $(e.target).val(data.label);
107
107
  return false;
108
- },
109
- focus: function(e, ui){
108
+ },
109
+ focus: function(e, ui){
110
110
  if (ui.item) $(e.target).val(ui.item.label);
111
111
  else $(e.target).val('');
112
112
  return false;
113
- }
114
-
115
- });
116
- },
117
-
118
- addValue: function(keys, desc){
119
- // var h = $('input[type=hidden]:last', this.el);
120
- // h.clone.val(keys).insertAfter(h);
121
- // $('.values_list', this.el).spiderWidget().reload({add})
122
- },
123
-
124
- removeValue: function(key){
125
- for (var i=0; i<this.added; i++){
126
- if (this.added[i] == key) this.added.splice(i, 1);
127
- }
128
- $('input[type=hidden][value='+key+']', this.el).remove();
129
- $('.values_list li', this.el).each(function(){
130
- var $this = $(this);
131
- if ($this.getDataObjectKey() == key) $this.remove();
132
- });
133
- },
134
-
135
- changed: function(){
136
-
137
- },
138
-
139
- val: function(){
140
- if (this.multiple){
141
- var v = [];
142
- $('input[type=hidden].hidden-val', this.el).each(function(){
143
- v.push($(this).val());
144
- });
145
- return v;
146
- }
147
- else return $('input[type=hidden].hidden-val', this.el).val();
148
- }
113
+ }
114
+
115
+ });
116
+ },
117
+
118
+ addValue: function(keys, desc){
119
+ // var h = $('input[type=hidden]:last', this.el);
120
+ // h.clone.val(keys).insertAfter(h);
121
+ // $('.values_list', this.el).spiderWidget().reload({add})
122
+ },
123
+
124
+ removeValue: function(key){
125
+ for (var i=0; i<this.added; i++){
126
+ if (this.added[i] == key) this.added.splice(i, 1);
127
+ }
128
+ $('input[type=hidden][value='+key+']', this.el).remove();
129
+ $('.values_list li', this.el).each(function(){
130
+ var $this = $(this);
131
+ if ($this.getDataObjectKey() == key) $this.remove();
132
+ });
133
+ },
134
+
135
+ changed: function(){
136
+
137
+ },
138
+
139
+ val: function(){
140
+ if (this.multiple){
141
+ var v = [];
142
+ $('input[type=hidden].hidden-val', this.el).each(function(){
143
+ v.push($(this).val());
144
+ });
145
+ return v;
146
+ }
147
+ else return $('input[type=hidden].hidden-val', this.el).val();
148
+ }
149
149
 
150
150
  });
@@ -1,27 +1,27 @@
1
1
  Spider.defineWidget('Spider.Forms.Select', 'Spider.Forms.Input', {
2
-
3
- autoInit: true,
4
-
5
- ready: function(){
2
+
3
+ autoInit: true,
4
+
5
+ ready: function(){
6
6
  var sel = this.el;
7
- if (sel.is('select[multiple]')){
7
+ if (sel.is('select[multiple]')){
8
8
  sel.attr('title', 'Aggiungi...');
9
- sel.bsmSelect({
9
+ sel.bsmSelect({
10
10
  removeLabel: 'togli',
11
11
  highlightAddedLabel: 'Aggiunto: ',
12
12
  highlightRemovedLabel: 'Tolto: ',
13
13
  addItemTarget: 'bottom'
14
- });
14
+ });
15
15
  $('.bsmSelect option:first', sel.parent()).addClass('bsmSelectTitle')
16
16
  .attr("selected", false)
17
- .attr("disabled", true);
18
- }
19
- },
20
-
21
- onConnectedChange: function(connected, val){
22
- var params = {};
23
- params[connected] = val;
24
- this.reload({connected: params});
25
- }
17
+ .attr("disabled", true);
18
+ }
19
+ },
20
+
21
+ onConnectedChange: function(connected, val){
22
+ var params = {};
23
+ params[connected] = val;
24
+ this.reload({connected: params});
25
+ }
26
26
 
27
27
  });
@@ -27,8 +27,12 @@ module Spider; module Forms
27
27
  i_attribute :widget_types
28
28
  i_attribute :read_only
29
29
  i_attribute :disabled
30
- attribute :save_submit_text, :default => lambda{ _('Save') }
31
- attribute :insert_submit_text, :default => lambda{ _('Insert') }
30
+ attribute :save_submit_text, :default => lambda{
31
+ Spider::GetText.in_domain(Spider::Forms.gettext_domain) { _('Save') }
32
+ }
33
+ attribute :insert_submit_text, :default => lambda{
34
+ Spider::GetText.in_domain(Spider::Forms.gettext_domain) { _('Insert') }
35
+ }
32
36
  is_attribute :show_submit_and_new, :default => false
33
37
  is_attribute :show_submit_and_stay, :default => false
34
38
  is_attribute :show_additional_buttons, :default => false
@@ -157,7 +161,6 @@ module Spider; module Forms
157
161
  @scene.crud = @crud
158
162
  @obj = load
159
163
  cond = {}
160
- debugger
161
164
  if @sub_element.integrated?
162
165
  @sub_element.integrated_from.model.primary_keys.each do |key|
163
166
  cond[@sub_element.reverse.to_s+'.'+key.name.to_s] = @obj.get("#{@sub_element.integrated_from.name}.#{key.name}")
@@ -191,8 +194,7 @@ module Spider; module Forms
191
194
 
192
195
  def run
193
196
  #Spider::Logger.debug("FORM EXECUTING")
194
- if (@obj)
195
-
197
+ if @obj && @pk
196
198
  @scene.form_desc = @model.label.downcase+' '+ (@obj.to_s || '')
197
199
  if (@action == :sub)
198
200
 
@@ -202,8 +204,10 @@ module Spider; module Forms
202
204
  @scene.submit_text = @attributes[:insert_submit_text]
203
205
  end
204
206
  @scene.obj = obj
205
- @scene.submit_and_new_text = @attributes[:submit_and_new_text] % @scene.submit_text
206
- @scene.submit_and_stay_text = @attributes[:submit_and_stay_text] % @scene.submit_text
207
+ Spider::GetText.in_domain(Spider::Forms.gettext_domain){
208
+ @scene.submit_and_new_text = @attributes[:submit_and_new_text] % @scene.submit_text
209
+ @scene.submit_and_stay_text = @attributes[:submit_and_stay_text] % @scene.submit_text
210
+ }
207
211
  @scene.submit_buttons = @save_actions.keys
208
212
  @scene.enctype = 'multipart/form-data' if @multipart
209
213
  super
@@ -17,7 +17,7 @@ module Spider; module Forms
17
17
  when :date then Date
18
18
  when :time then Time
19
19
  else
20
- DateTime
20
+ ::DateTime
21
21
  end
22
22
  begin
23
23
  return klass.lparse(val, :short)
@@ -1,4 +1,4 @@
1
- <sp:template>
1
+ <div>
2
2
  <tpl:asset type="js" src="ckeditor/ckeditor.js" compressed="true" copy_dir="true"/>
3
3
  <tpl:asset type="js" src="ckeditor/adapters/jquery.js" compressed="true" />
4
4
  <tpl:asset name="jquery" />
@@ -11,4 +11,4 @@
11
11
  <div class="css" style="display:none">{ @css }</div>
12
12
  <div class="options" style="display:none">{ @options }</div>
13
13
  <textarea name="{ @name }" id="input" rows="{ @rows }" cols="{ @cols }">{ @value }</textarea>
14
- </sp:template>
14
+ </div>
@@ -92,7 +92,9 @@ module Spider; module Forms
92
92
  def check
93
93
  #debugger
94
94
  if required? && !has_value?
95
- add_error( _("%s is required") % self.label )
95
+ Spider::GetText.in_domain(self.class.app.gettext_domain){
96
+ add_error( _("%s is required") % self.label )
97
+ }
96
98
  end
97
99
  end
98
100
 
@@ -0,0 +1,11 @@
1
+ module Spider::Messenger
2
+
3
+ class Mobyt
4
+
5
+ def self.parametri(username, password, from, to, testo)
6
+
7
+ end
8
+
9
+ end
10
+
11
+ end
@@ -0,0 +1,24 @@
1
+ # language: it
2
+
3
+ Funzionalità: invio SMS con Mobyt
4
+
5
+
6
+ Scenario: invio SMS semplice
7
+ Dato che lo username per l'invio è "aaaa"
8
+ E che la password per l'invio è "bbbb"
9
+ Quando invio un SMS con i seguenti dati:
10
+ | to | from | testo |
11
+ | +39123456789 | mittente-prova | Ciao |
12
+ Allora la libreria Mobyt deve ritornare i seguenti parametri:
13
+ | operation | TEXT |
14
+ | from | mittente-prova |
15
+ | data | Ciao |
16
+ | id | aaaa |
17
+ | qty | a |
18
+ | password | |
19
+ | ticket | 3ad6bd5c1d3ea7b021b3f7ddad2398bd |
20
+
21
+ Scenario: invio SMS multiplo
22
+
23
+ Scenario: invio SMS UTF8
24
+
@@ -0,0 +1,21 @@
1
+ Dato /^che lo username per l.invio è "([^\"]*)"$/ do |username|
2
+ @username = username
3
+ end
4
+
5
+
6
+ Dato /^che la password per l.invio è "([^\"]*)"$/ do |password|
7
+ @password = password
8
+ end
9
+
10
+ Quando /^invio un SMS con i seguenti dati:$/ do |table|
11
+ dati = table.hashes
12
+ @risultato = Spider::Messenger::Mobyt.parametri(@username, @password, dati['from'], dati['to'], dati['testo'])
13
+ end
14
+
15
+
16
+ Allora /^la libreria Mobyt deve ritornare i seguenti parametri:$/ do |table|
17
+ dati = table.rows_hash
18
+ dati.each do |key, value|
19
+ @risultato[key].should eq value
20
+ end
21
+ end
@@ -2,7 +2,7 @@
2
2
  _(Queues):
3
3
  <ul>
4
4
  <li sp:each="@queues |name|">
5
- <a href="{ @controller[:url] }/{ name }">{ @queue_info[name][:label] }</a>:
5
+ <a href="{ @controller[:request_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>
@@ -10,4 +10,4 @@
10
10
  </ul>
11
11
  </li>
12
12
  </ul>
13
- </div>
13
+ </div>
@@ -14,10 +14,13 @@ module Spider
14
14
  include Soap
15
15
  include HTTPMixin
16
16
 
17
- options[:allow_content_encoding_gzip] = true
18
17
 
19
18
  class <<self
20
19
  attr_accessor :soap_methods, :soap_types
20
+
21
+ def soap_options
22
+ @options ||= {:allow_content_encoding_gzip => true}
23
+ end
21
24
 
22
25
  # Returns the currently used soap registry
23
26
  def soap_registry
@@ -219,7 +222,7 @@ module Spider
219
222
  end
220
223
 
221
224
  def encode_gzip?
222
- self.class.options[:allow_content_encoding_gzip] and defined?(::Zlib) and
225
+ self.class.soap_options[:allow_content_encoding_gzip] and defined?(::Zlib) and
223
226
  @request.env['HTTP_ACCEPT_ENCODING'] and
224
227
  @request.env['HTTP_ACCEPT_ENCODING'].split(/,\s*/).include?('gzip')
225
228
  end
data/lib/spiderfw/app.rb CHANGED
@@ -71,6 +71,8 @@ module Spider
71
71
  attr_reader :gettext_extensions
72
72
  # @return [Array] Additional GetText parasers to use
73
73
  attr_reader :gettext_parsers
74
+ # @return [String] Gettext domain of the app. Defaults to the app short name
75
+ attr_reader :gettext_domain
74
76
 
75
77
 
76
78
  # Initializes missing variables to default variables.
@@ -98,6 +100,7 @@ module Spider
98
100
  @gettext_parsers ||= []
99
101
  @gettext_dirs ||= ['lib','bin','controllers','models','views','widgets','public']
100
102
  @gettext_extensions ||= ['rb','rhtml','shtml','js']
103
+ @gettext_domain ||= @short_name
101
104
 
102
105
  find_tags
103
106
  end
@@ -228,6 +231,16 @@ module Spider
228
231
  end
229
232
  end
230
233
 
234
+ # @return [String] The path to the apps' container (the home or the Spider lib)
235
+ def base_path
236
+ if Spider.paths[:apps] && @path.index(Spider.paths[:apps])
237
+ Spider.paths[:apps]
238
+ else
239
+ $SPIDER_PATH
240
+ end
241
+ end
242
+
243
+
231
244
  def route_path(action='')
232
245
  path = Spider::ControllerMixins::HTTPMixin.reverse_proxy_mapping('/'+@route_url)
233
246
  action = action[1..-1] if action[0].chr == '/'
@@ -76,7 +76,10 @@ module Spider
76
76
  end
77
77
  return key.to_s
78
78
  end
79
-
79
+
80
+ # Sets a configuration value
81
+ # @param [String] key
82
+ # @param [Object] val
80
83
  def set(key, val)
81
84
  first, rest = key.split('.', 2)
82
85
  if rest
@@ -1,7 +1,7 @@
1
1
  module Spider
2
2
 
3
3
  config_option('runmode', "production, test, devel", :default => 'devel', :choices => ['production', 'test', 'devel'],
4
- :action => Proc.new{ |option| $SPIDER_RUNMODE = option }
4
+ :action => Proc.new{ |option| $SPIDER_RUNMODE ||= option }
5
5
  )
6
6
 
7
7
  config_option('apps', _('Apps to load'), :type => Array, :yaml_style => :inline)
@@ -172,6 +172,8 @@ module Spider
172
172
  Spider.logger.error("Not found: #{exc.path}")
173
173
  elsif exc.is_a?(Spider::Controller::Forbidden)
174
174
  Spider.logger.warn("Forbidden: #{exc.message}")
175
+ elsif exc.is_a?(Errno::EPIPE)
176
+ Spider.logger.warn("Broken pipe")
175
177
  else
176
178
  super
177
179
  end
@@ -111,7 +111,7 @@ module Spider; module HTTP
111
111
  end
112
112
  controller.call_after(path)
113
113
  controller_done = true
114
- rescue => exc
114
+ rescue Exception => exc
115
115
  Spider.logger.error(exc)
116
116
  controller.ensure if controller
117
117
  controller = nil
@@ -73,7 +73,7 @@ module Spider; module I18n
73
73
  time_format = @cldr.calendar.timeformats[options[:calendar].to_sym][format.to_s].dup
74
74
  date_format = @cldr.calendar.dateformats[options[:calendar].to_sym][format.to_s].dup
75
75
  if (options[:return] == :datetime)
76
- dt_f = @cldr.calendar.datetimeformats[options[:calendar].to_s][format.to_s]
76
+ dt_f = @cldr.calendar.datetimeformats[options[:calendar].to_sym][format.to_s]
77
77
  format_string = dt_f.sub('{1}', date_format).sub('{0}', time_format)
78
78
  klass = DateTime
79
79
  elsif (options[:return] == :date)
@@ -2180,6 +2180,7 @@ module Spider; module Model
2180
2180
  def insert!
2181
2181
  mapper.insert(self)
2182
2182
  after_save
2183
+ self
2183
2184
  end
2184
2185
 
2185
2186
  # Updates the object in the storage
@@ -2190,11 +2191,13 @@ module Spider; module Model
2190
2191
  before_save
2191
2192
  update!
2192
2193
  end
2194
+ self
2193
2195
  end
2194
2196
 
2195
2197
  def update!
2196
2198
  mapper.update(self)
2197
2199
  after_save
2200
+ self
2198
2201
  end
2199
2202
 
2200
2203
  def unit_of_work_available?
@@ -2209,11 +2212,13 @@ module Spider; module Model
2209
2212
  before_delete
2210
2213
  delete!
2211
2214
  end
2215
+ nil
2212
2216
  end
2213
2217
 
2214
2218
  def delete!
2215
2219
  mapper.delete(self)
2216
2220
  after_delete
2221
+ nil
2217
2222
  end
2218
2223
 
2219
2224
  def before_delete
@@ -1414,7 +1414,9 @@ module Spider; module Model
1414
1414
  @msg
1415
1415
  end
1416
1416
  def message
1417
- _(self.class.msg) % @element.label
1417
+ Spider::GetText.in_domain('spider') do
1418
+ _(self.class.msg) % @element.label
1419
+ end
1418
1420
  end
1419
1421
  def to_s
1420
1422
  self.class.name.to_s + " " + message