rsence-pre 2.2.2.1 → 2.3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. data/VERSION +1 -1
  2. data/conf/default_conf.yaml +6 -1
  3. data/js/comm/queue/queue.js +0 -1
  4. data/js/comm/transporter/transporter.js +32 -16
  5. data/js/comm/values/values.js +45 -13
  6. data/js/controls/sliders/slider/slider.js +5 -6
  7. data/js/controls/sliders/slider/themes/default/slider.css +34 -62
  8. data/js/controls/sliders/slider/themes/default/slider.html +4 -4
  9. data/js/controls/sliders/vslider/themes/default/vslider.css +43 -10
  10. data/js/controls/sliders/vslider/vslider.js +3 -1
  11. data/js/controls/stepper/stepper.js +1 -1
  12. data/js/controls/stringview/stringview.js +6 -8
  13. data/js/controls/stringview/themes/default/stringview.html +1 -1
  14. data/js/controls/textcontrol/textcontrol.js +22 -16
  15. data/js/controls/textcontrol/themes/default/textcontrol.css +23 -22
  16. data/js/controls/window/window.js +1 -1
  17. data/js/core/class/class.js +4 -4
  18. data/js/core/event/event.js +3 -2
  19. data/js/datetime/calendar/calendar.coffee +114 -58
  20. data/js/datetime/calendar/themes/default/calendar.css +4 -2
  21. data/js/foundation/control/control.js +2 -0
  22. data/js/foundation/control/dyncontrol/dyncontrol.js +15 -0
  23. data/js/foundation/control/eventresponder/eventresponder.js +29 -20
  24. data/js/foundation/eventmanager/eventmanager.coffee +1090 -0
  25. data/js/foundation/eventmanager/eventmanager.js +116 -28
  26. data/js/foundation/json_renderer/json_renderer.js +4 -2
  27. data/js/foundation/system/system.js +3 -0
  28. data/js/foundation/view/view.js +6 -30
  29. data/js/lists/listitems/listitems.js +8 -1
  30. data/js/lists/radiobuttonlist/radiobuttonlist.js +9 -4
  31. data/js/menus/minimenu/minimenu.js +11 -5
  32. data/js/menus/minimenuitem/minimenuitem.js +6 -4
  33. data/js/tables/table/table.coffee +19 -0
  34. data/js/tables/table/themes/default/table.css +0 -0
  35. data/js/tables/table/themes/default/table.html +19 -0
  36. data/lib/rsence/argv/initenv_argv.rb +1 -1
  37. data/lib/rsence/http/broker.rb +3 -1
  38. data/lib/rsence/msg.rb +1 -1
  39. data/lib/rsence/plugins/gui_plugin.rb +2 -0
  40. data/lib/rsence/sessionmanager.rb +7 -7
  41. data/lib/rsence/sessionstorage.rb +3 -1
  42. data/lib/rsence/transporter.rb +56 -32
  43. data/lib/rsence/valuemanager.rb +3 -3
  44. data/plugins/client_pkg/client_pkg.rb +5 -0
  45. data/plugins/client_pkg/lib/client_pkg_build.rb +29 -4
  46. metadata +10 -7
@@ -84,7 +84,7 @@ module RSence
84
84
  # session id, used internally
85
85
  :ses_id => ses_id,
86
86
 
87
- # session key, used externally (client xhr)
87
+ # session key, used externally (client sync)
88
88
  :ses_key => ses_sha,
89
89
 
90
90
  # session key, used externally (client cookies)
@@ -137,7 +137,7 @@ module RSence
137
137
  # new time-out
138
138
  ses_data[:timeout] = Time.now.to_i + @config[:timeout_secs]
139
139
 
140
- # re-generates the ses_key for each xhr
140
+ # re-generates the ses_key for each sync
141
141
  if @config[:disposable_keys]
142
142
 
143
143
  # disposes the old (current) ses_key:
@@ -233,7 +233,7 @@ module RSence
233
233
  ### Otherwise stops the client and returns false.
234
234
  def check_ses( msg, ses_key, ses_seed=false )
235
235
 
236
- # first, check if the session key exists (xhr)
236
+ # first, check if the session key exists (sync)
237
237
  if @session_keys.has_key?( ses_key )
238
238
 
239
239
  # get the session's id based on its key
@@ -455,7 +455,7 @@ module RSence
455
455
  ses_cookie_max_age = @config[:timeout_secs]
456
456
 
457
457
  ## Only match the handshaking address of rsence,
458
- ## prevents unnecessary cookie-juggling in xhr's
458
+ ## prevents unnecessary cookie-juggling in sync's
459
459
  if @config[:trust_cookies]
460
460
  ses_cookie_path = '/'
461
461
  elsif ses_cookie_path == nil
@@ -527,19 +527,19 @@ module RSence
527
527
  query = request.query
528
528
  end
529
529
 
530
- ## Perform old-session cleanup on all xhr:s
530
+ ## Perform old-session cleanup on all sync:s
531
531
  expire_sessions
532
532
 
533
533
  ## The 'ses_id' request query key is required.
534
534
  ## The client defaults to '0', which means the
535
535
  ## client needs to be initialized.
536
536
  ## The client's ses_id is the server's ses_key.
537
- if not query.has_key?( 'ses_key' )
537
+ if not options.has_key?( :ses_key )
538
538
  return Message.new( @transporter, request, response, options )
539
539
  else
540
540
 
541
541
  ## get the ses_key from the request query:
542
- ses_key = query[ 'ses_key' ]
542
+ ses_key = options[:ses_key]
543
543
 
544
544
  ## The message object binds request, response
545
545
  ## and all user/session -related data to one
@@ -240,7 +240,9 @@ module RSence
240
240
  end
241
241
  puts "Storing sessions..." if RSence.args[:verbose]
242
242
  db_open
243
- @sessions.each do |ses_id,ses_data|
243
+ ses_ids = @sessions.keys
244
+ ses_ids.each do |ses_id|
245
+ ses_data = @sessions[ses_id]
244
246
  if @plugins
245
247
  @plugins.delegate( :dump_ses, ses_data )
246
248
  @plugins.delegate( :dump_ses_id, ses_id )
@@ -94,13 +94,13 @@ module RSence
94
94
  uri = request.fullpath
95
95
 
96
96
  if request_type == :post
97
- ## /x handles xhr without cookies
97
+ ## /x handles sync without cookies
98
98
  if uri == broker_urls[:x] and @sessions.accept_requests
99
- xhr( request, response, { :cookies => true, :servlet => false } )
99
+ sync( request, response, { :cookies => true, :servlet => false } )
100
100
  return true
101
- ## /hello handles the first xhr (with cookies, for session key)
101
+ ## /hello handles the first sync (with cookies, for session key)
102
102
  elsif uri == broker_urls[:hello] and @sessions.accept_requests
103
- xhr( request, response, { :cookies => true, :servlet => false } )
103
+ sync( request, response, { :cookies => true, :servlet => false } )
104
104
  return true
105
105
  end
106
106
  end
@@ -108,7 +108,7 @@ module RSence
108
108
  end
109
109
 
110
110
  # wrapper for the session manager stop client functionality
111
- def xhr_error_handler(msg,err_name,err_extra_descr='')
111
+ def sync_error_handler(msg,err_name,err_extra_descr='')
112
112
  @sessions.stop_client_with_message( msg,
113
113
  @config[:messages][err_name][:title],
114
114
  @config[:messages][err_name][:descr]+err_extra_descr,
@@ -116,8 +116,8 @@ module RSence
116
116
  )
117
117
  end
118
118
 
119
- # wrapper for tracebacks in xhr
120
- def xhr_traceback_handler(e,err_descr='Transporter::UnspecifiedError')
119
+ # wrapper for tracebacks in sync
120
+ def sync_traceback_handler(e,err_descr='Transporter::UnspecifiedError')
121
121
  puts "=="*40 if RSence.args[:debug]
122
122
  puts err_descr
123
123
  if RSence.args[:debug]
@@ -127,10 +127,32 @@ module RSence
127
127
  puts "=="*40
128
128
  end
129
129
  end
130
+
131
+ def find_client_sync_error( options )
132
+ return false if options.length == 0
133
+ errors = []
134
+ options.each do |err|
135
+ if err.class == Hash and err.has_key?('err_msg')
136
+ errors.push( err['err_msg'] )
137
+ end
138
+ end
139
+ return false if errors.length == 0
140
+ return errors
141
+ end
130
142
 
131
143
  ## handles incoming XMLHttpRequests from the browser
132
- def xhr(request, response, options = { :cookies => false, :servlet => false } )
133
-
144
+ def sync(request, response, options = { :cookies => false, :servlet => false } )
145
+ request_body = request.body.read
146
+ begin
147
+ request_content = JSON.parse( request_body )
148
+ rescue JSON::ParseError
149
+ warn "Request body isn't valid JSON: #{request_body}"
150
+ request_content = ['-1:.o.:INVALID',{},[]]
151
+ end
152
+ options[:ses_key] = request_content[0]
153
+ options[:values] = request_content[1]
154
+ options[:messages] = request_content[2]
155
+
134
156
  session_conf = RSence.config[:session_conf]
135
157
 
136
158
  options[:cookies] = false unless options.has_key?(:cookies)
@@ -143,13 +165,15 @@ module RSence
143
165
  msg = @sessions.init_msg( request, response, options )
144
166
 
145
167
  response_success = true
146
-
168
+
169
+ client_errors = find_client_sync_error( options[:messages] )
170
+
147
171
  # If the client encounters an error, display error message
148
- if request.query.has_key?('err_msg')
172
+ if client_errors #request.query.has_key?('err_msg')
149
173
  response_success = false
150
- client_error_msg = request.query['err_msg'].inspect
174
+ client_error_msg = client_errors.inspect
151
175
  puts "\nCLIENT ERROR:\n#{client_error_msg}\n" if RSence.args[:debug]
152
- xhr_error_handler(msg,:client_error,client_error_msg)
176
+ sync_error_handler(msg,:client_error,client_error_msg)
153
177
  end
154
178
 
155
179
  # If the session is valid, continue:
@@ -175,14 +199,14 @@ module RSence
175
199
  end
176
200
 
177
201
  ## Pass the client XML to the value manager
178
- if request.query.has_key?( 'values' )
179
- syncdata_str = request.query[ 'values' ]
202
+ if options[:values].has_key?('set')#request.query.has_key?( 'values' )
203
+ # syncdata_str = request.query[ 'values' ]
180
204
  begin
181
- @valuemanager.xhr( msg, syncdata_str )
205
+ @valuemanager.sync( msg, options[:values]['set'] )
182
206
  rescue => e
183
207
  response_success = false
184
- xhr_error_handler( msg, :valuemanager_xhr_error, e.message )
185
- xhr_traceback_handler( e, "Transporter::ValueManagerXHRError: @valuemanager.xhr failed." )
208
+ sync_error_handler( msg, :valuemanager_sync_error, e.message )
209
+ sync_traceback_handler( e, "Transporter::ValueManagerXHRError: @valuemanager.sync failed." )
186
210
  end
187
211
  end
188
212
 
@@ -195,8 +219,8 @@ module RSence
195
219
  @plugins.delegate( :cloned_target, msg, msg.cloned_source )
196
220
  rescue => e
197
221
  response_success = false
198
- xhr_error_handler( msg, :plugin_delegate_cloned_target_error, e.message )
199
- xhr_traceback_handler( e, "Transporter::PluginDelegateClonedTargetError: @plugins.delegate 'cloned_target' failed." )
222
+ sync_error_handler( msg, :plugin_delegate_cloned_target_error, e.message )
223
+ sync_traceback_handler( e, "Transporter::PluginDelegateClonedTargetError: @plugins.delegate 'cloned_target' failed." )
200
224
  end
201
225
  end
202
226
 
@@ -205,8 +229,8 @@ module RSence
205
229
  msg.session[:plugin_incr] = @plugins.incr
206
230
  rescue => e
207
231
  response_success = false
208
- xhr_error_handler( msg, :plugin_delegate_restore_ses_error, e.message )
209
- xhr_traceback_handler( e, "Transporter::PluginDelegateRestoreSesError: @plugins.delegate 'restore_ses' failed." )
232
+ sync_error_handler( msg, :plugin_delegate_restore_ses_error, e.message )
233
+ sync_traceback_handler( e, "Transporter::PluginDelegateRestoreSesError: @plugins.delegate 'restore_ses' failed." )
210
234
  end
211
235
 
212
236
  elsif msg.new_session
@@ -216,8 +240,8 @@ module RSence
216
240
  msg.session[:plugin_incr] = @plugins.incr
217
241
  rescue => e
218
242
  response_success = false
219
- xhr_error_handler( msg, :plugin_delegate_init_ses_error, e.message )
220
- xhr_traceback_handler( e, "Transporter::PluginDelegateInitSesError: @plugins.delegate 'init_ses' failed." )
243
+ sync_error_handler( msg, :plugin_delegate_init_ses_error, e.message )
244
+ sync_traceback_handler( e, "Transporter::PluginDelegateInitSesError: @plugins.delegate 'init_ses' failed." )
221
245
  end
222
246
 
223
247
  elsif msg.cloned_targets
@@ -226,8 +250,8 @@ module RSence
226
250
  @plugins.delegate( :cloned_source, msg, msg.cloned_targets )
227
251
  rescue => e
228
252
  response_success = false
229
- xhr_error_handler( msg, :plugin_delegate_cloned_source_error, e.message )
230
- xhr_traceback_handler( e, "Transporter::PluginDelegateClonedSourceError: @plugins.delegate 'cloned_source' failed." )
253
+ sync_error_handler( msg, :plugin_delegate_cloned_source_error, e.message )
254
+ sync_traceback_handler( e, "Transporter::PluginDelegateClonedSourceError: @plugins.delegate 'cloned_source' failed." )
231
255
  end
232
256
 
233
257
  elsif msg.refresh_page?( @plugins.incr ) and @config[:client_autoreload]
@@ -244,8 +268,8 @@ module RSence
244
268
  @valuemanager.validate( msg )
245
269
  rescue => e
246
270
  response_success = false
247
- xhr_error_handler( msg, :valuemanager_validate_error, e.message )
248
- xhr_traceback_handler( e, "Transporter::ValueManagerValidateError: @valuemanager.validate failed." )
271
+ sync_error_handler( msg, :valuemanager_validate_error, e.message )
272
+ sync_traceback_handler( e, "Transporter::ValueManagerValidateError: @valuemanager.validate failed." )
249
273
  end
250
274
 
251
275
  ### Allows every plugin to respond to the idle call
@@ -253,8 +277,8 @@ module RSence
253
277
  @plugins.delegate( :idle, msg )
254
278
  rescue => e
255
279
  response_success = false
256
- xhr_error_handler( msg, :plugin_idle_error, e.message )
257
- xhr_traceback_handler( e, "Transporter::PluginIdleError: @plugins.idle failed." )
280
+ sync_error_handler( msg, :plugin_idle_error, e.message )
281
+ sync_traceback_handler( e, "Transporter::PluginIdleError: @plugins.idle failed." )
258
282
  end
259
283
 
260
284
  ### Processes outgoing values to client
@@ -262,8 +286,8 @@ module RSence
262
286
  @valuemanager.sync_client( msg )
263
287
  rescue => e
264
288
  response_success = false
265
- xhr_error_handler( msg, :valuemanager_sync_client_error, e.message )
266
- xhr_traceback_handler( e, "Transporter::ValueManagerSyncClientError: @valuemanager.sync_client failed." )
289
+ sync_error_handler( msg, :valuemanager_sync_client_error, e.message )
290
+ sync_traceback_handler( e, "Transporter::ValueManagerSyncClientError: @valuemanager.sync_client failed." )
267
291
  end
268
292
 
269
293
  else
@@ -114,10 +114,10 @@ module RSence
114
114
  end
115
115
 
116
116
  # @private Parses the json from the client and passes it on to associated values
117
- def xhr( msg, syncdata_str )
117
+ def sync( msg, syncdata )
118
118
 
119
119
  # parses the json data sent by the client
120
- syncdata = JSON.parse( syncdata_str )
120
+ # syncdata = JSON.parse( syncdata_str )
121
121
 
122
122
  session_values = msg.session[:values][:by_id]
123
123
  syncdata.each do |value_key, value_data|
@@ -125,7 +125,7 @@ module RSence
125
125
  value_obj = session_values[ value_key ]
126
126
  value_obj.from_client( msg, value_data )
127
127
  else
128
- raise "HValue; unassigned value id! (#{val_id.inspect})"
128
+ warn "HValue; unassigned value key: (#{value_key.inspect})"
129
129
  end
130
130
  end
131
131
  end
@@ -112,6 +112,11 @@ class ClientPkgPlugin < Servlet
112
112
  def del_package( pkg_name ); @client_build.del_package( pkg_name ); end
113
113
  def del_packages( packages ); @client_build.del_packages( packages ); end
114
114
 
115
+ def add_compound( compound_name, pkg_names ); @client_build.add_compound( compound_name, pkg_names ); end
116
+ def add_compounds( compounds ); @client_build.add_compounds( compounds ); end
117
+ def del_compound( compound_name ); @client_build.del_compound( compound_name ); end
118
+ def del_compounds( compounds ); @client_build.del_compounds( compounds ); end
119
+
115
120
  def add_reserved_name( reserved_name ); @client_build.add_reserved_name( reserved_name ); end
116
121
  def add_reserved_names( reserved_names ); @client_build.add_reserved_names( reserved_names ); end
117
122
  def del_reserved_name( reserved_name ); @client_build.del_reserved_name( reserved_name ); end
@@ -213,7 +213,7 @@ class ClientPkgBuild
213
213
  begin
214
214
  coffee_src = read_file( src_path )
215
215
  js_data = CoffeeScript.compile( coffee_src, :bare => true )
216
- rescue CoffeeScript::CompilationError
216
+ rescue CoffeeScript::CompilationError, ExecJS::RuntimeError
217
217
  if has_js
218
218
  js_data = %{console.log( "WARNING: CoffeeScript complilation failed for source file #{src_path.to_json}, using the js variant instead." );}
219
219
  js_data += read_file( File.join( bundle_path, bundle_name+'.js' ) )
@@ -436,13 +436,15 @@ class ClientPkgBuild
436
436
  @logger.log( "Compound package..............: Source | Minimized | GNUZipped" )
437
437
  @logger.log( " : | |" )
438
438
  end
439
- @compound_config.each do |pkg_name, js_order|
439
+ @compounds.each do |pkg_name, js_order|
440
440
  js_size = 0
441
441
  pkg_parts = []
442
442
  js_order.each do |js_pkg|
443
443
  pkg_part = @js[ js_pkg ]
444
444
  pkg_parts.push( pkg_part )
445
- js_size += ( @package_origsizes[ js_pkg ] or @destination_origsize[ js_pkg ] )
445
+ pkg_size = ( @package_origsizes[ js_pkg ] or @destination_origsize[ js_pkg ] or @compound_origsize[ js_pkg ] )
446
+ warn "nil pkg size of: #{js_pkg}" if ( pkg_size.nil? or pkg_size == 0 ) and @debug
447
+ js_size += pkg_size.nil? ? 0 : pkg_size
446
448
  end
447
449
  js_src = pkg_parts.join("\n")
448
450
  @js[ pkg_name ] = js_src
@@ -457,6 +459,7 @@ class ClientPkgBuild
457
459
  else
458
460
  gz_size = gz_data.bytesize
459
461
  end
462
+ @compound_origsize[ pkg_name ] = js_size
460
463
  print_stat( pkg_name, js_size, jsc_size, gz_size )
461
464
  end
462
465
  end
@@ -494,6 +497,7 @@ class ClientPkgBuild
494
497
  def compose_destinations
495
498
  @destination_files = {} # rename to package_products
496
499
  @destination_origsize = {}
500
+ @compound_origsize = {}
497
501
  @package_names.each do |package_name|
498
502
  @packages[package_name].each do |bundle_name|
499
503
  if @bundles_found.has_key?( bundle_name )
@@ -623,6 +627,27 @@ class ClientPkgBuild
623
627
  packages.each { |pkg_name| del_package( pkg_name ) }
624
628
  end
625
629
 
630
+ def add_compound( compound_name, pkg_names )
631
+ if @compounds.has_key?( compound_name )
632
+ warn "Compound #{compound_name} already exists, ignoring."
633
+ else
634
+ @compounds[ compound_name ] = pkg_names
635
+ end
636
+ end
637
+ def add_compounds( compounds )
638
+ compounds.each do | compound_name, pkg_names |
639
+ add_compound( compound_name, pkg_names )
640
+ end
641
+ end
642
+ def del_compound( compound_name )
643
+ if @compounds.has_key?( compound_name )
644
+ @compounds.delete( compound_name )
645
+ end
646
+ end
647
+ def del_compounds( compounds )
648
+ compounds.each { |compound_name| del_compound( compound_name ) }
649
+ end
650
+
626
651
  def add_reserved_name( reserved_name )
627
652
  @reserved_names.push( reserved_name ) unless @reserved_names.include? reserved_name
628
653
  end
@@ -719,7 +744,7 @@ class ClientPkgBuild
719
744
  @no_whitespace_removal = config[:no_whitespace_removal]
720
745
  @debug = RSence.args[:debug]
721
746
  @quiet = (not RSence.args[:verbose] and RSence.args[:suppress_build_messages])
722
- @compound_config = config[:compound_packages]
747
+ @compounds = config[:compound_packages]
723
748
  end
724
749
 
725
750
  def find_newer( src_dir, newer_than, quiet=false )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence-pre
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.2.1
4
+ version: 2.3.0.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-04-28 00:00:00.000000000 Z
13
+ date: 2012-07-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rsence-deps
@@ -19,7 +19,7 @@ dependencies:
19
19
  requirements:
20
20
  - - '='
21
21
  - !ruby/object:Gem::Version
22
- version: '969'
22
+ version: '971'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -27,7 +27,7 @@ dependencies:
27
27
  requirements:
28
28
  - - '='
29
29
  - !ruby/object:Gem::Version
30
- version: '969'
30
+ version: '971'
31
31
  description: ! 'RSence is a different and unique development model and software frameworks
32
32
  designed first-hand for real-time web applications. RSence consists of separate,
33
33
  but tigtly integrated data- and user interface frameworks.
@@ -307,6 +307,7 @@ files:
307
307
  - js/foundation/control/valueaction/valueaction.js
308
308
  - js/foundation/control/valuematrix/valuematrix.js
309
309
  - js/foundation/control/valueresponder/valueresponder.js
310
+ - js/foundation/eventmanager/eventmanager.coffee
310
311
  - js/foundation/eventmanager/eventmanager.js
311
312
  - js/foundation/geom/point/point.js
312
313
  - js/foundation/geom/rect/rect.js
@@ -341,6 +342,9 @@ files:
341
342
  - js/menus/popupmenu/themes/default/popupmenu.html
342
343
  - js/menus/popupmenu/themes/default/popupmenu.png
343
344
  - js/no_pkg/no_pkg.js
345
+ - js/tables/table/table.coffee
346
+ - js/tables/table/themes/default/table.css
347
+ - js/tables/table/themes/default/table.html
344
348
  - js/util/reloadapp/reloadapp.js
345
349
  - js/util/reloadapp/themes/default/reloadapp_warning-ie6.gif
346
350
  - js/util/reloadapp/themes/default/reloadapp_warning.png
@@ -380,9 +384,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
380
384
  version: 1.3.1
381
385
  requirements: []
382
386
  rubyforge_project: rsence-
383
- rubygems_version: 1.8.21
387
+ rubygems_version: 1.8.24
384
388
  signing_key:
385
389
  specification_version: 3
386
- summary: Pre-Release 2.2 version of RSence.
390
+ summary: Pre-Release 2.3 version of RSence.
387
391
  test_files: []
388
- has_rdoc: