rsence-pre 2.1.0.10 → 2.1.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/js/core/elem/elem.js +4 -0
- data/js/foundation/view/view.js +12 -4
- data/lib/plugins/plugin.rb +64 -7
- data/lib/plugins/pluginmanager.rb +7 -0
- data/lib/session/msg.rb +11 -1
- data/lib/session/sessionmanager.rb +3 -1
- data/lib/transporter/transporter.rb +12 -3
- data/lib/values/hvalue.rb +11 -0
- data/plugins/index_html/tmpl/index.html +4 -2
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.0.
|
1
|
+
2.1.0.11.pre
|
data/js/core/elem/elem.js
CHANGED
data/js/foundation/view/view.js
CHANGED
@@ -879,9 +879,18 @@ HView = HClass.extend({
|
|
879
879
|
var _winSize = ELEM.windowSize();
|
880
880
|
return [ _winSize[0], _winSize[1] ];
|
881
881
|
}
|
882
|
-
else{
|
883
|
-
var
|
884
|
-
|
882
|
+
else {
|
883
|
+
var
|
884
|
+
_rect = this.parent.rect,
|
885
|
+
_width = _rect.width,
|
886
|
+
_height = _rect.height;
|
887
|
+
if (this.parent.flexLeft && this.parent.flexRight){
|
888
|
+
_width = parseInt( ELEM.getStyle(this.parent.elemId,'width',true), 10 );
|
889
|
+
}
|
890
|
+
if (this.parent.flexBottom && this.parent.flexTop){
|
891
|
+
_height = parseInt( ELEM.getStyle(this.parent.elemId,'height',true), 10 );
|
892
|
+
}
|
893
|
+
return [ _width, _height ];
|
885
894
|
}
|
886
895
|
},
|
887
896
|
|
@@ -987,7 +996,6 @@ HView = HClass.extend({
|
|
987
996
|
_validHeight && this.setMinHeight( _height );
|
988
997
|
_bottom = _parentHeight - _bottomOffset;
|
989
998
|
}
|
990
|
-
|
991
999
|
this.rect = HRect.nu(_leftOffset,_topOffset,_right,_bottom);
|
992
1000
|
|
993
1001
|
}
|
data/lib/plugins/plugin.rb
CHANGED
@@ -344,17 +344,69 @@ module RSence
|
|
344
344
|
name = name_with_manager_s
|
345
345
|
ses[value_name] = HValue.new( msg, default_value, { :name => "#{name}.#{value_name}" } )
|
346
346
|
if value_properties.has_key?(:responders)
|
347
|
-
value_properties[:responders]
|
348
|
-
|
349
|
-
|
350
|
-
|
351
|
-
|
347
|
+
init_responders( msg, ses[value_name], value_properties[:responders] )
|
348
|
+
end
|
349
|
+
end
|
350
|
+
|
351
|
+
# @private Initialize a responder for a value.
|
352
|
+
def init_responder( msg, value, responder )
|
353
|
+
name = name_with_manager_s
|
354
|
+
if responder.has_key?(:plugin)
|
355
|
+
responder_plugin = responder[:plugin]
|
356
|
+
else
|
357
|
+
responder_plugin = name
|
358
|
+
end
|
359
|
+
if responder.has_key?(:method)
|
360
|
+
responder_method = responder[:method]
|
361
|
+
if not value.bound?( responder_plugin, responder_method )
|
362
|
+
value.bind( responder_plugin, responder[:method] )
|
363
|
+
end
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
# @private Initialize several responders for a value
|
368
|
+
def init_responders( msg, value, responders )
|
369
|
+
members = value.members
|
370
|
+
release_list = []
|
371
|
+
members.each_key do |pre_plugin|
|
372
|
+
members[pre_plugin].each do |pre_method|
|
373
|
+
found = false
|
374
|
+
responders.each do |responder|
|
375
|
+
name = name_with_manager_s
|
376
|
+
if responder.has_key?(:plugin)
|
377
|
+
responder_plugin = responder[:plugin]
|
378
|
+
else
|
379
|
+
responder_plugin = name
|
380
|
+
end
|
381
|
+
if responder.has_key?(:method)
|
382
|
+
responder_method = responder[:method]
|
383
|
+
if responder_plugin == pre_plugin and responder_method == pre_method
|
384
|
+
found = true
|
385
|
+
break
|
386
|
+
end
|
387
|
+
end
|
352
388
|
end
|
353
|
-
|
354
|
-
|
389
|
+
unless found
|
390
|
+
release_list.push( [ pre_plugin, pre_method ] )
|
355
391
|
end
|
356
392
|
end
|
357
393
|
end
|
394
|
+
release_list.each do | rel_plugin, rel_method |
|
395
|
+
value.release( rel_plugin, rel_method )
|
396
|
+
end
|
397
|
+
responders.each do |responder|
|
398
|
+
init_responder( msg, value, responder )
|
399
|
+
end
|
400
|
+
end
|
401
|
+
|
402
|
+
# @private Releases all responders of a value
|
403
|
+
def release_responders( msg, value )
|
404
|
+
members = value.members
|
405
|
+
members.each_key do |responder_plugin|
|
406
|
+
members.each do |responder_method|
|
407
|
+
value.release( responder_plugin, responder_method )
|
408
|
+
end
|
409
|
+
end
|
358
410
|
end
|
359
411
|
|
360
412
|
# @private Initializes session values, if the contents of the +values.yaml+
|
@@ -426,6 +478,11 @@ module RSence
|
|
426
478
|
ses = get_ses( msg )
|
427
479
|
@values.each do | value_name, value_properties |
|
428
480
|
if ses.has_key?( value_name ) and ses[ value_name ].class == HValue
|
481
|
+
if value_properties.has_key?(:responders)
|
482
|
+
init_responders( msg, ses[value_name], value_properties[:responders] )
|
483
|
+
else
|
484
|
+
release_responders( msg, ses[value_name] )
|
485
|
+
end
|
429
486
|
unless value_properties[:restore_default] == false
|
430
487
|
if value_properties.has_key?(:value_call)
|
431
488
|
default_value = init_value_call( msg, value_properties[:value_call] )
|
@@ -23,6 +23,11 @@ module RSence
|
|
23
23
|
|
24
24
|
attr_reader :transporter, :sessions
|
25
25
|
|
26
|
+
@@incr = 0
|
27
|
+
def incr
|
28
|
+
return @@incr
|
29
|
+
end
|
30
|
+
|
26
31
|
# Returns the registry data for plugin bundle +plugin_name+
|
27
32
|
def registry( plugin_name=false )
|
28
33
|
return @registry unless plugin_name
|
@@ -610,6 +615,8 @@ module RSence
|
|
610
615
|
puts "done!" if RSence.args[:verbose]
|
611
616
|
end
|
612
617
|
if not (to_load.empty? and to_unload.empty? and to_reload.empty?)
|
618
|
+
@@incr += 1
|
619
|
+
puts "@@incr: #{@@incr}"
|
613
620
|
puts "Plugin bundles:"
|
614
621
|
puts " loaded: #{to_load.join(', ')}" unless to_load.empty?
|
615
622
|
puts " unloaded: #{to_unload.join(', ')}" unless to_unload.empty?
|
data/lib/session/msg.rb
CHANGED
@@ -174,7 +174,17 @@ module RSence
|
|
174
174
|
def user_id
|
175
175
|
@session[:user_id]
|
176
176
|
end
|
177
|
-
|
177
|
+
|
178
|
+
# @private used for automatic reload of page, when the plugins have been changed.
|
179
|
+
def refresh_page?( plugin_incr )
|
180
|
+
if plugin_incr != @session[:plugin_incr]
|
181
|
+
puts "@session[:plugin_incr] = #{@session[:plugin_incr].inspect} vs plugin_incr = #{plugin_incr.inspect}"
|
182
|
+
@session[:plugin_incr] = plugin_incr
|
183
|
+
return true
|
184
|
+
end
|
185
|
+
return false
|
186
|
+
end
|
187
|
+
|
178
188
|
# Setter for the user id
|
179
189
|
# @param [Number, String] user_id The user id to set. Use in login situations to store the user id.
|
180
190
|
# @return [nil]
|
@@ -180,7 +180,7 @@ module RSence
|
|
180
180
|
## Calls the restore_ses of plugins, when a session is restored (page reload with previously active session)
|
181
181
|
if msg.restored_session
|
182
182
|
msg.session[:deps] = []
|
183
|
-
|
183
|
+
|
184
184
|
if msg.cloned_source
|
185
185
|
begin
|
186
186
|
@plugins.delegate( :cloned_target, msg, msg.cloned_source )
|
@@ -190,24 +190,29 @@ module RSence
|
|
190
190
|
xhr_traceback_handler( e, "Transporter::PluginDelegateClonedTargetError: @plugins.delegate 'cloned_target' failed." )
|
191
191
|
end
|
192
192
|
end
|
193
|
-
|
193
|
+
|
194
194
|
begin
|
195
195
|
@plugins.delegate( :restore_ses, msg )
|
196
|
+
msg.session[:plugin_incr] == @plugins.incr
|
196
197
|
rescue => e
|
197
198
|
response_success = false
|
198
199
|
xhr_error_handler( msg, :plugin_delegate_restore_ses_error, e.message )
|
199
200
|
xhr_traceback_handler( e, "Transporter::PluginDelegateRestoreSesError: @plugins.delegate 'restore_ses' failed." )
|
200
201
|
end
|
201
|
-
|
202
|
+
|
202
203
|
elsif msg.new_session
|
204
|
+
|
203
205
|
begin
|
204
206
|
@plugins.delegate( :init_ses, msg )
|
207
|
+
msg.session[:plugin_incr] == @plugins.incr
|
205
208
|
rescue => e
|
206
209
|
response_success = false
|
207
210
|
xhr_error_handler( msg, :plugin_delegate_init_ses_error, e.message )
|
208
211
|
xhr_traceback_handler( e, "Transporter::PluginDelegateInitSesError: @plugins.delegate 'init_ses' failed." )
|
209
212
|
end
|
213
|
+
|
210
214
|
elsif msg.cloned_targets
|
215
|
+
|
211
216
|
begin
|
212
217
|
@plugins.delegate( :cloned_source, msg, msg.cloned_targets )
|
213
218
|
rescue => e
|
@@ -215,6 +220,10 @@ module RSence
|
|
215
220
|
xhr_error_handler( msg, :plugin_delegate_cloned_source_error, e.message )
|
216
221
|
xhr_traceback_handler( e, "Transporter::PluginDelegateClonedSourceError: @plugins.delegate 'cloned_source' failed." )
|
217
222
|
end
|
223
|
+
|
224
|
+
elsif msg.refresh_page?( @plugins.incr )
|
225
|
+
# Forces the client to reload, if plugins are incremented
|
226
|
+
msg.reply("window.location.reload( true );")
|
218
227
|
end
|
219
228
|
|
220
229
|
## Calls validators for changed values
|
data/lib/values/hvalue.rb
CHANGED
@@ -122,6 +122,14 @@ module RSence
|
|
122
122
|
return true
|
123
123
|
end
|
124
124
|
|
125
|
+
# Checks, if the plugin_name and method_name pairing is already bound with the bind method. Returns true or false.
|
126
|
+
def bound?( plugin_name, method_name )
|
127
|
+
plugin_name = plugin_name.to_sym unless plugin_name.class == Symbol
|
128
|
+
method_name = method_name.to_sym unless method_name.class == Symbol
|
129
|
+
return false unless @members.has_key?(plugin_name)
|
130
|
+
return @members[plugin_name].include?(method_name)
|
131
|
+
end
|
132
|
+
|
125
133
|
# Releases the responder of the value, both params as in bind, but optional +method_name+ can be omitted, matching all methods bound to the +plugin_name+.
|
126
134
|
# @param [Symbol] plugin_name The name of the plugin acting as a responder to the value.
|
127
135
|
# @param [Symbol] method_name The name of the method of the plugin acting as a responder to the value.
|
@@ -135,6 +143,9 @@ module RSence
|
|
135
143
|
@members.delete( plugin_name )
|
136
144
|
else
|
137
145
|
@members[plugin_name].slice!(@members[plugin_name].index( method_name )) if @members[plugin_name].include?(method_name)
|
146
|
+
if @members[plugin_name].empty?
|
147
|
+
@members.delete( plugin_name )
|
148
|
+
end
|
138
149
|
end
|
139
150
|
return true
|
140
151
|
end
|
@@ -9,7 +9,9 @@ __SCRIPT_DEPS__
|
|
9
9
|
|
10
10
|
<script>
|
11
11
|
|
12
|
-
|
13
|
-
|
12
|
+
var RSenceInit = function(){
|
13
|
+
/** Runtime configuration: **/
|
14
|
+
RSence.serverConf('__CLIENT_BASE__','__CLIENT_HELLO__');
|
15
|
+
};
|
14
16
|
|
15
17
|
</script></head><body id="body"><noscript>__NOSCRIPT__</noscript></body></html>
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsence-pre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 113
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 1
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 2.1.0.
|
10
|
+
- 11
|
11
|
+
version: 2.1.0.11
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Riassence Inc.
|