rsence 2.1.11 → 2.2.0
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL.rdoc +5 -3
- data/README.rdoc +23 -22
- data/VERSION +1 -1
- data/conf/default_conf.yaml +65 -29
- data/conf/rsence_command_strings.yaml +101 -71
- data/js/comm/autosync/autosync.js +3 -3
- data/js/comm/jsloader/jsloader.js +16 -3
- data/js/comm/queue/queue.js +1 -1
- data/js/comm/transporter/transporter.js +106 -83
- data/js/comm/values/values.js +8 -2
- data/js/controls/button/button.js +9 -4
- data/js/controls/button/themes/default/button.css +1 -1
- data/js/controls/checkbox/themes/default/checkbox.css +1 -1
- data/js/controls/dialogs/sheet/sheet.js +27 -18
- data/js/controls/radiobutton/themes/default/radiobutton.css +1 -1
- data/js/controls/searchfield/searchfield.coffee +2 -0
- data/js/controls/searchfield/themes/default/searchfield.css +96 -0
- data/js/controls/searchfield/themes/default/searchfield.html +12 -0
- data/js/controls/searchfield/themes/default/searchfield_parts1-ie6.gif +0 -0
- data/js/controls/searchfield/themes/default/searchfield_parts1.png +0 -0
- data/js/controls/sliders/slider/slider.js +7 -1
- data/js/controls/stepper/stepper.js +6 -1
- data/js/controls/stringview/stringview.js +50 -39
- data/js/controls/tab/tab.js +103 -7
- data/js/controls/tab/themes/default/tab.css +2 -0
- data/js/controls/textarea/themes/default/textarea.css +4 -0
- data/js/controls/textcontrol/textcontrol.js +32 -2
- data/js/controls/textcontrol/themes/default/textcontrol.css +17 -2
- data/js/controls/uploader/themes/default/uploader.css +3 -3
- data/js/controls/uploader/themes/default/uploader.html +1 -1
- data/js/controls/uploader/uploader.coffee +110 -0
- data/js/controls/window/themes/default/window.css +28 -5
- data/js/controls/window/themes/default/window.html +2 -0
- data/js/controls/window/window.js +5 -1
- data/js/core/class/class.js +22 -4
- data/js/core/elem/elem.coffee +816 -0
- data/js/core/event/event.js +2 -2
- data/js/core/rsence_ns/rsence_ns.coffee +31 -0
- data/js/core/rsence_ns/rsence_ns.js +6 -6
- data/js/datetime/calendar/calendar.coffee +307 -0
- data/js/datetime/calendar/themes/default/calendar.css +90 -9
- data/js/datetime/calendar/themes/default/calendar.html +11 -0
- data/js/datetime/calendar/themes/default/calendar_bg-ie6.gif +0 -0
- data/js/datetime/calendar/themes/default/calendar_bg.png +0 -0
- data/js/datetime/calendar/themes/default/calendar_parts1-ie6.gif +0 -0
- data/js/datetime/calendar/themes/default/calendar_parts1.png +0 -0
- data/js/datetime/calendar/themes/default/calendar_parts2-ie6.gif +0 -0
- data/js/datetime/calendar/themes/default/calendar_parts2.png +0 -0
- data/js/datetime/datetimepicker/datetimepicker.js +217 -0
- data/js/datetime/datetimevalue/datetimevalue.js +22 -5
- data/js/datetime/timesheet/themes/default/timesheet.css +51 -22
- data/js/datetime/timesheet/themes/default/timesheet.html +4 -2
- data/js/datetime/timesheet/timesheet.js +782 -192
- data/js/datetime/timesheet_item/themes/default/timesheet_item.css +42 -11
- data/js/datetime/timesheet_item/themes/default/timesheet_item.html +4 -2
- data/js/datetime/timesheet_item/themes/default/timesheet_item_icons.png +0 -0
- data/js/datetime/timesheet_item/timesheet_item.js +158 -254
- data/js/datetime/timesheet_item_edit/timesheet_item_edit.js +0 -274
- data/js/foundation/application/application.js +52 -9
- data/js/foundation/control/eventresponder/eventresponder.js +7 -4
- data/js/foundation/control/valueaction/valueaction.js +71 -0
- data/js/foundation/eventmanager/eventmanager.js +71 -33
- data/js/foundation/geom/rect/rect.js +39 -7
- data/js/foundation/json_renderer/json_renderer.js +278 -62
- data/js/foundation/locale_settings/locale_settings.js +131 -0
- data/js/foundation/system/system.js +40 -13
- data/js/foundation/thememanager/thememanager.js +21 -0
- data/js/foundation/view/markupview/markupview.js +12 -12
- data/js/foundation/view/view.js +221 -27
- data/js/graphics/svgcontrol/svgcontrol.js +400 -0
- data/js/lists/checkboxlist/checkboxlist.js +18 -7
- data/js/lists/listitems/listitems.js +52 -38
- data/js/lists/radiobuttonlist/radiobuttonlist.js +23 -7
- data/js/menus/menuitem/menuitem.js +5 -0
- data/js/menus/menuitem/themes/default/menuitem.css +45 -0
- data/js/menus/menuitem/themes/default/menuitem.html +4 -0
- data/js/menus/minimenu/minimenu.js +47 -16
- data/js/menus/minimenuitem/minimenuitem.js +62 -0
- data/js/menus/{minimenu/minimenuitem → minimenuitem}/themes/default/minimenuitem.css +2 -2
- data/js/menus/{minimenu/minimenuitem → minimenuitem}/themes/default/minimenuitem.html +0 -0
- data/js/menus/{minimenu/minimenuitem → minimenuitem}/themes/default/minimenuitem_checkmark.png +0 -0
- data/js/menus/popupmenu/popupmenu.js +14 -0
- data/js/menus/popupmenu/themes/default/popupmenu.css +65 -0
- data/js/menus/popupmenu/themes/default/popupmenu.html +7 -0
- data/js/menus/popupmenu/themes/default/popupmenu.png +0 -0
- data/js/no_pkg/no_pkg.js +2 -0
- data/js/util/reloadapp/reloadapp.js +1 -1
- data/js/views/scrollview/scrollview.js +6 -0
- data/lib/rsence.rb +136 -3
- data/lib/rsence/argv.rb +218 -0
- data/lib/rsence/argv/argv_util.rb +58 -0
- data/lib/rsence/argv/env_check.rb +58 -0
- data/lib/rsence/argv/help_argv.rb +15 -0
- data/lib/rsence/argv/initenv_argv.rb +218 -0
- data/lib/rsence/argv/save_argv.rb +92 -0
- data/lib/rsence/argv/startup_argv.rb +118 -0
- data/lib/rsence/argv/status_argv.rb +132 -0
- data/lib/rsence/argv/test_port.rb +32 -0
- data/lib/{daemon → rsence}/daemon.rb +67 -23
- data/lib/{conf/default.rb → rsence/default_config.rb} +18 -10
- data/lib/{plugins → rsence}/dependencies.rb +0 -0
- data/lib/{util → rsence}/gzstring.rb +0 -0
- data/lib/rsence/http.rb +3 -0
- data/lib/{http → rsence/http}/broker.rb +106 -19
- data/lib/{http → rsence/http}/rackup.rb +0 -0
- data/lib/{http → rsence/http}/request.rb +0 -4
- data/lib/{http → rsence/http}/response.rb +0 -1
- data/lib/{session → rsence}/msg.rb +17 -1
- data/lib/{plugins → rsence}/pluginmanager.rb +29 -12
- data/lib/{plugins → rsence}/plugins.rb +7 -7
- data/lib/{plugins → rsence/plugins}/gui_plugin.rb +8 -3
- data/lib/{plugins → rsence/plugins}/guiparser.rb +9 -6
- data/lib/{plugins → rsence/plugins}/plugin.rb +23 -4
- data/lib/{plugins → rsence/plugins}/plugin_base.rb +11 -1
- data/lib/{plugins → rsence/plugins}/plugin_plugins.rb +2 -2
- data/lib/{plugins → rsence/plugins}/plugin_sqlite_db.rb +0 -0
- data/lib/{plugins → rsence/plugins}/servlet.rb +0 -0
- data/lib/{session → rsence}/sessionmanager.rb +101 -39
- data/lib/{session → rsence}/sessionstorage.rb +30 -16
- data/lib/{daemon → rsence}/sigcomm.rb +0 -0
- data/lib/{transporter → rsence}/transporter.rb +13 -11
- data/lib/{values/hvalue.rb → rsence/value.rb} +6 -1
- data/lib/{values → rsence}/valuemanager.rb +1 -1
- data/plugins/client_pkg/client_pkg.rb +14 -4
- data/plugins/client_pkg/info.yaml +2 -2
- data/plugins/client_pkg/lib/client_pkg_build.rb +145 -45
- data/plugins/client_pkg/lib/client_pkg_cache.rb +1 -1
- data/plugins/client_pkg/lib/client_pkg_serve.rb +1 -1
- data/plugins/main/main.rb +43 -3
- data/plugins/main/tmpl/index.html +2 -10
- data/plugins/main/values.yaml +3 -1
- data/plugins/ticket/lib/common.rb +6 -3
- data/plugins/ticket/ticket.rb +11 -3
- metadata +144 -174
- data/js/comm/autosync/js.inc +0 -0
- data/js/comm/js.inc +0 -0
- data/js/comm/jsloader/js.inc +0 -0
- data/js/comm/queue/js.inc +0 -0
- data/js/comm/session/js.inc +0 -0
- data/js/comm/sessionwatcher/js.inc +0 -0
- data/js/comm/transporter/js.inc +0 -0
- data/js/comm/urlresponder/js.inc +0 -0
- data/js/comm/values/js.inc +0 -0
- data/js/controls/button/js.inc +0 -0
- data/js/controls/checkbox/js.inc +0 -0
- data/js/controls/dialogs/alert_sheet/js.inc +0 -0
- data/js/controls/dialogs/confirm_sheet/js.inc +0 -0
- data/js/controls/dialogs/sheet/js.inc +0 -0
- data/js/controls/imageview/js.inc +0 -0
- data/js/controls/passwordcontrol/js.inc +0 -0
- data/js/controls/progress/progressbar/js.inc +0 -0
- data/js/controls/progress/progressindicator/js.inc +0 -0
- data/js/controls/radiobutton/js.inc +0 -0
- data/js/controls/sliders/slider/js.inc +0 -0
- data/js/controls/sliders/vslider/js.inc +0 -0
- data/js/controls/stepper/js.inc +0 -0
- data/js/controls/stringview/js.inc +0 -0
- data/js/controls/tab/js.inc +0 -0
- data/js/controls/textarea/js.inc +0 -0
- data/js/controls/textcontrol/js.inc +0 -0
- data/js/controls/uploader/js.inc +0 -0
- data/js/controls/uploader/uploader.js +0 -154
- data/js/controls/validatorview/js.inc +0 -0
- data/js/controls/window/js.inc +0 -0
- data/js/core/class/js.inc +0 -0
- data/js/core/elem/elem.js +0 -1325
- data/js/core/elem/js.inc +0 -0
- data/js/core/event/js.inc +0 -0
- data/js/core/iefix/js.inc +0 -0
- data/js/core/rsence_ns/js.inc +0 -0
- data/js/datetime/calendar/calendar.js +0 -198
- data/js/datetime/calendar/js.inc +0 -0
- data/js/datetime/datetimevalue/js.inc +0 -0
- data/js/datetime/timesheet/js.inc +0 -0
- data/js/datetime/timesheet/old_timesheet.js +0 -292
- data/js/datetime/timesheet/themes/default/old_timesheet.css +0 -30
- data/js/datetime/timesheet/themes/default/old_timesheet.html +0 -2
- data/js/datetime/timesheet_item/js.inc +0 -0
- data/js/datetime/timesheet_item/old_timesheet_item.js +0 -308
- data/js/datetime/timesheet_item/themes/default/old_timesheet_item.css +0 -42
- data/js/datetime/timesheet_item/themes/default/old_timesheet_item.html +0 -8
- data/js/datetime/timesheet_item_edit/js.inc +0 -0
- data/js/datetime/timesheet_item_edit/old_timesheet_item_edit.js +0 -274
- data/js/foundation/application/js.inc +0 -0
- data/js/foundation/control/controldefaults/js.inc +0 -0
- data/js/foundation/control/dummyvalue/js.inc +0 -0
- data/js/foundation/control/dyncontrol/js.inc +0 -0
- data/js/foundation/control/eventresponder/js.inc +0 -0
- data/js/foundation/control/js.inc +0 -0
- data/js/foundation/control/valuematrix/js.inc +0 -0
- data/js/foundation/control/valueresponder/js.inc +0 -0
- data/js/foundation/eventmanager/js.inc +0 -0
- data/js/foundation/geom/point/js.inc +0 -0
- data/js/foundation/geom/rect/js.inc +0 -0
- data/js/foundation/json_renderer/js.inc +0 -0
- data/js/foundation/system/js.inc +0 -0
- data/js/foundation/thememanager/js.inc +0 -0
- data/js/foundation/value/js.inc +0 -0
- data/js/foundation/view/js.inc +0 -0
- data/js/foundation/view/markupview/js.inc +0 -0
- data/js/foundation/view/morphanimation/js.inc +0 -0
- data/js/foundation/view/viewdefaults/js.inc +0 -0
- data/js/lists/checkboxlist/js.inc +0 -0
- data/js/lists/listitems/js.inc +0 -0
- data/js/lists/propertylist/js.inc +0 -0
- data/js/lists/propertylist/propertylisteditor/js.inc +0 -0
- data/js/lists/radiobuttonlist/js.inc +0 -0
- data/js/menus/minimenu/js.inc +0 -0
- data/js/menus/minimenu/minimenuitem/js.inc +0 -0
- data/js/menus/minimenu/minimenuitem/minimenuitem.js +0 -33
- data/js/util/reloadapp/js.inc +0 -0
- data/js/util/sha/js.inc +0 -0
- data/js/views/centerview/js.inc +0 -0
- data/js/views/inlineview/js.inc +0 -0
- data/js/views/scrollview/js.inc +0 -0
- data/lib/conf/argv.rb +0 -880
File without changes
|
@@ -7,7 +7,7 @@
|
|
7
7
|
##
|
8
8
|
|
9
9
|
|
10
|
-
require '
|
10
|
+
require 'rsence/gzstring'
|
11
11
|
|
12
12
|
|
13
13
|
module RSence
|
@@ -248,9 +248,13 @@ module RSence
|
|
248
248
|
{}, # no session values
|
249
249
|
] + @error_js
|
250
250
|
else
|
251
|
+
@session.delete( :_msg_unused ) if @session.has_key?( :_msg_unused )
|
251
252
|
## The response status should always be 200 (OK)
|
252
253
|
@response.status = 200
|
253
254
|
|
255
|
+
@value_buffer.delete( :new ) if @value_buffer[:new].empty?
|
256
|
+
@value_buffer.delete( :set ) if @value_buffer[:set].empty?
|
257
|
+
@value_buffer.delete( :del ) if @value_buffer[:del].empty?
|
254
258
|
buffer = [
|
255
259
|
@ses_key,
|
256
260
|
@value_buffer,
|
@@ -283,6 +287,12 @@ module RSence
|
|
283
287
|
puts data if @config[:trace]
|
284
288
|
@buffer.push( data )
|
285
289
|
end
|
290
|
+
|
291
|
+
# Same as #reply, but with CoffeeScript instead of JS
|
292
|
+
def coffee(data)
|
293
|
+
puts data if @config[:trace]
|
294
|
+
@buffer.push( @plugins[:client_pkg].coffee( data ) )
|
295
|
+
end
|
286
296
|
|
287
297
|
# @private For value manager; insert changed values BEFORE other js.
|
288
298
|
def reply_value( operation_type, value_id, data=nil )
|
@@ -302,6 +312,7 @@ module RSence
|
|
302
312
|
def console(data)
|
303
313
|
reply( "console.log(#{data.to_json});" )
|
304
314
|
end
|
315
|
+
alias puts console
|
305
316
|
|
306
317
|
# Serves an image object and returns its disposable URL.
|
307
318
|
# Calls the default `ticket` plugin.
|
@@ -359,5 +370,10 @@ module RSence
|
|
359
370
|
@plugins.call( plugin_name, plugin_method, *args)
|
360
371
|
end
|
361
372
|
alias run call
|
373
|
+
|
374
|
+
def inspect
|
375
|
+
"#<Message ses_id:#{ses_id.inspect}, ses_key: #{ses_key.inspect} ...>"
|
376
|
+
end
|
377
|
+
|
362
378
|
end
|
363
379
|
end
|
@@ -7,8 +7,8 @@
|
|
7
7
|
##
|
8
8
|
|
9
9
|
|
10
|
-
require '
|
11
|
-
require '
|
10
|
+
require 'rsence/plugins'
|
11
|
+
require 'rsence/dependencies'
|
12
12
|
|
13
13
|
module RSence
|
14
14
|
|
@@ -27,6 +27,9 @@ module RSence
|
|
27
27
|
def incr
|
28
28
|
return @@incr
|
29
29
|
end
|
30
|
+
def incr!
|
31
|
+
@@incr += 1
|
32
|
+
end
|
30
33
|
|
31
34
|
# Returns the registry data for plugin bundle +plugin_name+
|
32
35
|
def registry( plugin_name=false )
|
@@ -168,7 +171,11 @@ module RSence
|
|
168
171
|
puts
|
169
172
|
puts "plugin: #{eval_repl}"
|
170
173
|
puts
|
171
|
-
|
174
|
+
begin
|
175
|
+
err_msg = err_msg.gsub(/^\t\(eval\)\:/s,"\t#{eval_repl}:")
|
176
|
+
rescue Encoding::CompatibilityError => e
|
177
|
+
$stderr.write( "Encoding::CompatibilityError in plugin error eval!" )
|
178
|
+
end
|
172
179
|
end
|
173
180
|
$stderr.write( err_msg )
|
174
181
|
end
|
@@ -267,12 +274,11 @@ module RSence
|
|
267
274
|
Dir.entries( bundle_path ).each do |entry_name|
|
268
275
|
next if entry_name[0].chr == '.' # skip hidden, '.' and '..'
|
269
276
|
full_path = File.join( bundle_path, entry_name )
|
270
|
-
|
277
|
+
if File.directory?( full_path )
|
271
278
|
next if entry_name == 'plugins' # skip sub-plugins
|
272
|
-
|
273
|
-
next unless
|
274
|
-
|
275
|
-
next unless is_src_file
|
279
|
+
else
|
280
|
+
next unless entry_name.include?('.')
|
281
|
+
next unless ['yaml','rb'].include?( entry_name.split('.')[-1] )
|
276
282
|
end
|
277
283
|
newest_date = most_recent( full_path, newest_date )
|
278
284
|
end
|
@@ -300,7 +306,7 @@ module RSence
|
|
300
306
|
|
301
307
|
# System version requirement.
|
302
308
|
# NOTE: Has no effect yet!
|
303
|
-
:sys_version => '>= 2.
|
309
|
+
:sys_version => '>= 2.2.0',
|
304
310
|
|
305
311
|
# Dependency, by default the system category (built-in plugins).
|
306
312
|
# A nil ( "~" in yaml ) value means no dependencies.
|
@@ -615,7 +621,7 @@ module RSence
|
|
615
621
|
puts "done!" if RSence.args[:verbose]
|
616
622
|
end
|
617
623
|
if not (to_load.empty? and to_unload.empty? and to_reload.empty?)
|
618
|
-
|
624
|
+
incr!
|
619
625
|
puts "@@incr: #{@@incr}" if RSence.args[:debug]
|
620
626
|
puts "Plugin bundles:"
|
621
627
|
puts " loaded: #{to_load.join(', ')}" unless to_load.empty?
|
@@ -636,12 +642,19 @@ module RSence
|
|
636
642
|
end
|
637
643
|
|
638
644
|
attr_reader :transporter
|
639
|
-
attr_reader :sessions
|
640
645
|
attr_reader :autoreload
|
641
646
|
attr_reader :name_prefix
|
642
647
|
attr_reader :plugin_paths
|
643
648
|
attr_reader :parent_manager
|
644
649
|
|
650
|
+
def sessions
|
651
|
+
warn "no sessions" unless @sessions
|
652
|
+
@sessions
|
653
|
+
end
|
654
|
+
def sessions=(ses_manager)
|
655
|
+
@sessions = ses_manager
|
656
|
+
end
|
657
|
+
|
645
658
|
@@pluginmanager_id = 0
|
646
659
|
# Initialize with a list of directories as plugin_paths.
|
647
660
|
# It's an array containing all plugin directories to scan.
|
@@ -665,13 +678,17 @@ module RSence
|
|
665
678
|
|
666
679
|
if options[:transporter]
|
667
680
|
@transporter = options[:transporter]
|
668
|
-
|
681
|
+
#@sessions = options[:transporter].sessions
|
669
682
|
end
|
670
683
|
|
671
684
|
@autoreload = options[:autoreload]
|
672
685
|
@name_prefix = options[:name_prefix]
|
673
686
|
@parent_manager = options[:parent_manager]
|
674
687
|
|
688
|
+
if @parent_manager == nil
|
689
|
+
RSence.plugin_manager = self
|
690
|
+
end
|
691
|
+
|
675
692
|
@deps = Dependencies.new( options[:resolved_deps], options[:resolved_categories] )
|
676
693
|
|
677
694
|
puts "Loading #{@name_prefix.to_s+' ' if @name_prefix}plugins..." if RSence.args[:verbose]
|
@@ -15,24 +15,24 @@ module RSence
|
|
15
15
|
end
|
16
16
|
|
17
17
|
# Contains the PluginBase module which has common methods for the bundle classes
|
18
|
-
require 'plugins/plugin_base'
|
18
|
+
require 'rsence/plugins/plugin_base'
|
19
19
|
|
20
20
|
# guiparser.rb contains the Yaml serializer for gui trees.
|
21
21
|
# It uses JSONRenderer on the client to build user interfaces.
|
22
|
-
require 'plugins/guiparser'
|
22
|
+
require 'rsence/plugins/guiparser'
|
23
23
|
|
24
24
|
# plugin_sqlite_db.rb contains automatic local sqlite database
|
25
25
|
# creation for a plugin that includes it.
|
26
|
-
require 'plugins/plugin_sqlite_db'
|
26
|
+
require 'rsence/plugins/plugin_sqlite_db'
|
27
27
|
|
28
28
|
# Interface for plugins in a plugin bundle
|
29
|
-
require 'plugins/plugin_plugins'
|
29
|
+
require 'rsence/plugins/plugin_plugins'
|
30
30
|
|
31
31
|
|
32
32
|
# Templates for the main plugin classes.
|
33
|
-
require 'plugins/plugin'
|
34
|
-
require 'plugins/gui_plugin'
|
35
|
-
require 'plugins/servlet'
|
33
|
+
require 'rsence/plugins/plugin'
|
34
|
+
require 'rsence/plugins/gui_plugin'
|
35
|
+
require 'rsence/plugins/servlet'
|
36
36
|
|
37
37
|
|
38
38
|
module RSence
|
@@ -34,9 +34,12 @@ module RSence
|
|
34
34
|
# @return [nil]
|
35
35
|
def init
|
36
36
|
super
|
37
|
-
yaml_src =
|
38
|
-
|
39
|
-
|
37
|
+
yaml_src = false
|
38
|
+
[ "#{@name}.yaml", 'gui.yaml',
|
39
|
+
"gui/#{@name}.yaml", "gui/main.yaml"
|
40
|
+
].each do |yaml_name|
|
41
|
+
yaml_src = file_read( yaml_name )
|
42
|
+
break if yaml_src
|
40
43
|
end
|
41
44
|
if yaml_src
|
42
45
|
@gui = GUIParser.new( self, yaml_src, @name )
|
@@ -90,6 +93,7 @@ module RSence
|
|
90
93
|
client_pkg.add_src_dir( src_dir )
|
91
94
|
end
|
92
95
|
end
|
96
|
+
sleep 0.1 until client_pkg.ready?
|
93
97
|
client_pkg.add_packages( @client_pkgs[:packages ] ) if @client_pkgs.has_key?(:packages )
|
94
98
|
client_pkg.add_themes( @client_pkgs[:theme_names ] ) if @client_pkgs.has_key?(:theme_names )
|
95
99
|
client_pkg.add_gfx_formats( @client_pkgs[:gfx_formats ] ) if @client_pkgs.has_key?(:gfx_formats )
|
@@ -109,6 +113,7 @@ module RSence
|
|
109
113
|
client_pkg.del_src_dir( src_dir )
|
110
114
|
end
|
111
115
|
end
|
116
|
+
sleep 0.1 until client_pkg.ready?
|
112
117
|
client_pkg.del_reserved_names( @client_pkgs[:reserved_names] ) if @client_pkgs.has_key?(:reserved_names)
|
113
118
|
client_pkg.del_gfx_formats( @client_pkgs[:gfx_formats ] ) if @client_pkgs.has_key?(:gfx_formats )
|
114
119
|
client_pkg.del_themes( @client_pkgs[:theme_names ] ) if @client_pkgs.has_key?(:theme_names )
|
@@ -53,7 +53,7 @@ module RSence
|
|
53
53
|
if gui_data.class == Array
|
54
54
|
gui_data = {
|
55
55
|
'type' => 'GUITree',
|
56
|
-
'version' => 0.
|
56
|
+
'version' => 0.9,
|
57
57
|
'class' => 'RSence.GUIApp',
|
58
58
|
'options' => {
|
59
59
|
'priority' => 0,
|
@@ -67,11 +67,8 @@ module RSence
|
|
67
67
|
end
|
68
68
|
|
69
69
|
def kill( msg )
|
70
|
-
gui_name = @parent.name
|
71
|
-
|
72
|
-
msg.reply( "#{gui_ns}.die();", true )
|
73
|
-
msg.reply( "#{gui_ns}=null;", true )
|
74
|
-
msg.reply( "delete #{gui_ns};", true )
|
70
|
+
# gui_name = @parent.name
|
71
|
+
msg.reply( "RSence.killGuiTree(#{@gui_name.to_json});" )
|
75
72
|
end
|
76
73
|
|
77
74
|
# Use this method to extract all the value id's of the +ses+ hash.
|
@@ -112,6 +109,12 @@ module RSence
|
|
112
109
|
return get_params( sym_arr, params )
|
113
110
|
elsif data_class == String and gui_data.strip.start_with?('function(')
|
114
111
|
return @parent.plugins[:client_pkg].squeeze( "a="+json_fun( gui_data.to_json ) )[2..-1]
|
112
|
+
elsif data_class == String and gui_data.strip.start_with?('coffee:')
|
113
|
+
coffee = @parent.plugins[:client_pkg].coffee( gui_data.strip[7..-1].strip )
|
114
|
+
return coffee
|
115
|
+
elsif data_class == String and (gui_data.strip =~ /^((\(.*?)\))?(\s*)?->/) == 0
|
116
|
+
coffee = @parent.plugins[:client_pkg].coffee( gui_data.strip )
|
117
|
+
return coffee
|
115
118
|
end
|
116
119
|
return gui_data
|
117
120
|
end
|
@@ -197,10 +197,18 @@ module RSence
|
|
197
197
|
# @return [Hash] Plugin-specific session hash
|
198
198
|
def get_ses( msg, key=false )
|
199
199
|
name_sym = name_with_manager_s.to_sym
|
200
|
-
|
201
|
-
|
200
|
+
if msg.class == RSence::Message
|
201
|
+
session = msg.session
|
202
|
+
elsif msg.class == Hash
|
203
|
+
session = msg
|
204
|
+
else
|
205
|
+
warn "Invalid class (#{msg.class}) for get_ses in #{name_sym.inspect}!"
|
206
|
+
return nil
|
207
|
+
end
|
208
|
+
unless session.has_key?( name_sym )
|
209
|
+
session[ name_sym ] = {}
|
202
210
|
end
|
203
|
-
ses =
|
211
|
+
ses = session[ name_sym ]
|
204
212
|
return ses[key] if key
|
205
213
|
return ses
|
206
214
|
end
|
@@ -283,6 +291,12 @@ module RSence
|
|
283
291
|
# Check the required dependencies until everything is loaded.
|
284
292
|
dependencies.each do |dependency|
|
285
293
|
unless ses[:deps].include?( dependency )
|
294
|
+
if RSence.config[:client_pkg][:compound_packages].include?( dependency )
|
295
|
+
RSence.config[:client_pkg][:compound_packages][dependency].each do |pkg_name|
|
296
|
+
ses[:deps].push( pkg_name )
|
297
|
+
msg.reply(%{jsLoader.loaded("#{pkg_name}");})
|
298
|
+
end
|
299
|
+
end
|
286
300
|
ses[:deps].push( dependency )
|
287
301
|
msg.reply(%{jsLoader.load("#{dependency}");})
|
288
302
|
end
|
@@ -332,7 +346,6 @@ module RSence
|
|
332
346
|
# @private Returns a sanitized copy of a single responder specification.
|
333
347
|
def sanitize_value_responders( responders_dirty )
|
334
348
|
if responders_dirty.class != Array
|
335
|
-
warn "Unsupported responders type: #{responders_dirty.inspect} (expected Array or Hash). Trying work-around.." if responders_dirty.class != Hash and RSence.args[:debug]
|
336
349
|
responders_dirty = [ responders_dirty ]
|
337
350
|
end
|
338
351
|
responders_clean = []
|
@@ -375,6 +388,12 @@ module RSence
|
|
375
388
|
|
376
389
|
# @private Returns a sanitized copy of a single value item.
|
377
390
|
def sanitize_value_item( value_item_dirty )
|
391
|
+
unless value_item_dirty.class == Hash
|
392
|
+
value_item_dirty = {
|
393
|
+
:value => value_item_dirty,
|
394
|
+
:restore_default => false
|
395
|
+
}
|
396
|
+
end
|
378
397
|
value_item_clean = {}
|
379
398
|
value_item_dirty.each do | key, value |
|
380
399
|
if key.to_sym == :value or key.to_sym == :data
|
@@ -104,7 +104,17 @@ module RSence
|
|
104
104
|
if not file_data
|
105
105
|
return false
|
106
106
|
else
|
107
|
-
|
107
|
+
begin
|
108
|
+
return YAML.load( file_data )
|
109
|
+
rescue Psych::SyntaxError => e
|
110
|
+
warn "Syntax Error in YAML file: #{path} (#{e.message})"
|
111
|
+
return false
|
112
|
+
rescue => e
|
113
|
+
warn "An exception occurred while parsing YAML file: #{path}"
|
114
|
+
warn e.message
|
115
|
+
warn " #{e.backtrace.join("\n ")}"
|
116
|
+
return false
|
117
|
+
end
|
108
118
|
end
|
109
119
|
end
|
110
120
|
|
@@ -30,10 +30,10 @@ module RSence
|
|
30
30
|
super
|
31
31
|
@plugin_plugins = RSence::PluginManager.new({
|
32
32
|
:plugin_paths => [ bundle_path('plugins') ],
|
33
|
-
:autoreload =>
|
33
|
+
:autoreload => true,
|
34
34
|
:name_prefix => name_with_manager_s.to_sym,
|
35
35
|
:parent_manager => @plugins,
|
36
|
-
:resolved_deps => [:system]
|
36
|
+
:resolved_deps => [ :system, @name, name_with_manager_s.to_sym ]
|
37
37
|
})
|
38
38
|
end
|
39
39
|
|
File without changes
|
File without changes
|
@@ -14,13 +14,13 @@ module RSence
|
|
14
14
|
require 'json'
|
15
15
|
|
16
16
|
## Shared messaging-object:
|
17
|
-
require '
|
17
|
+
require 'rsence/msg'
|
18
18
|
|
19
19
|
## Unique random number generator:
|
20
20
|
require 'randgen'
|
21
21
|
|
22
22
|
## SessionStorage is the superclass of SessionManager
|
23
|
-
require '
|
23
|
+
require 'rsence/sessionstorage'
|
24
24
|
|
25
25
|
require 'digest/sha1'
|
26
26
|
|
@@ -51,7 +51,11 @@ module RSence
|
|
51
51
|
end
|
52
52
|
|
53
53
|
### Creates a new session
|
54
|
-
def init_ses( msg, ses_seed )
|
54
|
+
def init_ses( msg=nil, ses_seed=false )
|
55
|
+
|
56
|
+
if ses_seed == false
|
57
|
+
ses_seed = @randgen.gen
|
58
|
+
end
|
55
59
|
|
56
60
|
## Assigns new timeout for the session
|
57
61
|
time_now = Time.now.to_i # seconds since epoch
|
@@ -88,6 +92,9 @@ module RSence
|
|
88
92
|
|
89
93
|
# user id, map to your own user management code
|
90
94
|
:user_id => 0,
|
95
|
+
|
96
|
+
# unused in msg context:
|
97
|
+
:_msg_unused => true,
|
91
98
|
|
92
99
|
# user info, map to your own user management code
|
93
100
|
:user_info => {},
|
@@ -108,17 +115,19 @@ module RSence
|
|
108
115
|
|
109
116
|
# map the ses_id to cookie key
|
110
117
|
@session_cookie_keys[ cookie_key ] = ses_id
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
118
|
+
|
119
|
+
if msg
|
120
|
+
### Tell the client what the new key is
|
121
|
+
msg.ses_key = ses_key
|
122
|
+
|
123
|
+
### Set the session data and id to the message object
|
124
|
+
msg.session = ses_data
|
125
|
+
|
126
|
+
# Flag the session as new, so associated
|
127
|
+
# plugins know when to create new data
|
128
|
+
msg.new_session = true
|
129
|
+
end
|
130
|
+
|
122
131
|
# Returns the cookie key, so it can be sent in the response header
|
123
132
|
return cookie_key
|
124
133
|
|
@@ -152,12 +161,11 @@ module RSence
|
|
152
161
|
# tell the client what its new session key is
|
153
162
|
msg.ses_key = ses_key
|
154
163
|
end
|
155
|
-
|
164
|
+
|
156
165
|
if @config[:clone_cookie_sessions] and @clone_targets.has_key? ses_id
|
157
166
|
targets = []
|
158
167
|
@clone_targets[ ses_id ].length.times do |n|
|
159
168
|
target_id = @clone_targets[ ses_id ].shift
|
160
|
-
# warn "target_id: #{target_id}"
|
161
169
|
target_ses = @sessions[ target_id ]
|
162
170
|
if @sessions.has_key?( target_id ) and @sessions[ target_id ].class == Hash
|
163
171
|
targets.push( target_ses )
|
@@ -173,7 +181,22 @@ module RSence
|
|
173
181
|
end
|
174
182
|
|
175
183
|
def clone_ses( msg, old_data, old_id, old_key, ses_seed )
|
176
|
-
|
184
|
+
if @plugins
|
185
|
+
@plugins.delegate( :dump_ses, old_data )
|
186
|
+
@plugins.delegate( :dump_ses_id, old_id )
|
187
|
+
end
|
188
|
+
begin
|
189
|
+
old_dump = Marshal.dump( old_data )
|
190
|
+
if @plugins
|
191
|
+
@plugins.delegate( :load_ses_id, old_id )
|
192
|
+
@plugins.delegate( :load_ses, old_data )
|
193
|
+
end
|
194
|
+
ses_data = Marshal.load( old_dump )
|
195
|
+
rescue => e
|
196
|
+
warn "Unable to clone session #{old_id}, because: #{e.message}"
|
197
|
+
init_ses( msg, ses_seed )
|
198
|
+
return
|
199
|
+
end
|
177
200
|
old_data[:timeout] = Time.now.to_i + @config[:cloned_session_expires_in]
|
178
201
|
timeout = Time.now.to_i + @config[:timeout_secs]
|
179
202
|
cookie_key = @randgen.gen_many(@config[:cookie_key_multiplier]).join('')
|
@@ -191,6 +214,10 @@ module RSence
|
|
191
214
|
@session_cookie_keys[ cookie_key ] = ses_id
|
192
215
|
msg.ses_key = ses_key
|
193
216
|
msg.session = ses_data
|
217
|
+
if @plugins
|
218
|
+
@plugins.delegate( :load_ses_id, ses_id )
|
219
|
+
@plugins.delegate( :load_ses, ses_data )
|
220
|
+
end
|
194
221
|
if @clone_targets.has_key? old_id
|
195
222
|
@clone_targets[ old_id ].push( ses_id )
|
196
223
|
else
|
@@ -215,7 +242,7 @@ module RSence
|
|
215
242
|
# get the session's data based on its id
|
216
243
|
ses_data = @sessions[ ses_id ]
|
217
244
|
|
218
|
-
if @config[:clone_cookie_sessions] and ses_seed
|
245
|
+
if not ses_data.has_key?(:_msg_unused) and @config[:clone_cookie_sessions] and ses_seed
|
219
246
|
clone_ses( msg, ses_data, ses_id, ses_key, ses_seed )
|
220
247
|
return [true, true]
|
221
248
|
else
|
@@ -223,9 +250,9 @@ module RSence
|
|
223
250
|
return [true, false]
|
224
251
|
end
|
225
252
|
|
226
|
-
|
227
253
|
## The session was either faked or expired:
|
228
|
-
|
254
|
+
elsif RSence.args[:debug]
|
255
|
+
|
229
256
|
### Tells the client to stop connecting with its session key and reload instead to get a new one.
|
230
257
|
stop_client_with_message( msg,
|
231
258
|
@config[:messages][:invalid_session][:title],
|
@@ -235,6 +262,18 @@ module RSence
|
|
235
262
|
|
236
263
|
## Return failure
|
237
264
|
return [false, false]
|
265
|
+
|
266
|
+
else
|
267
|
+
|
268
|
+
msg.error_msg( [
|
269
|
+
"COMM.Transporter.stop = true;",
|
270
|
+
"setTimeout(function(){window.location.reload(true);},3000);",
|
271
|
+
"COMM.Transporter.setInterruptAnim('Session failure, reloading in 3 seconds..','#039');",
|
272
|
+
"setTimeout(function(){COMM.Transporter.setInterruptAnim('Reloading...');},2500);",
|
273
|
+
"setTimeout(function(){COMM.Transporter.setInterruptAnim('Session failure, reloading in 1 seconds..');},2000);",
|
274
|
+
"setTimeout(function(){COMM.Transporter.setInterruptAnim('Session failure, reloading in 2 seconds..');},1000);",
|
275
|
+
] )
|
276
|
+
return [ false, false ]
|
238
277
|
end
|
239
278
|
|
240
279
|
end
|
@@ -255,6 +294,23 @@ module RSence
|
|
255
294
|
"ReloadApp.nu( #{js_str(title)}, #{js_str(descr)}, #{js_str(uri)} );"
|
256
295
|
] )
|
257
296
|
end
|
297
|
+
|
298
|
+
def servlet_cookie_ses( request, response )
|
299
|
+
cookie_raw = request.cookies
|
300
|
+
if cookie_raw.has_key?('ses_key')
|
301
|
+
cookie_key = cookie_raw['ses_key'].split(';')[0]
|
302
|
+
else
|
303
|
+
cookie_key = nil
|
304
|
+
end
|
305
|
+
unless @session_cookie_keys.has_key?( cookie_key )
|
306
|
+
cookie_key = init_ses
|
307
|
+
end
|
308
|
+
ses_id = @session_cookie_keys[ cookie_key ]
|
309
|
+
ses_data = @sessions[ ses_id ]
|
310
|
+
ses_data[:timeout] = Time.now.to_i + @config[:timeout_secs]
|
311
|
+
renew_cookie_req_res( request, response, cookie_key, request.fullpath )
|
312
|
+
return ses_data
|
313
|
+
end
|
258
314
|
|
259
315
|
### Checks / Sets cookies
|
260
316
|
def check_cookie( msg, ses_seed )
|
@@ -302,18 +358,20 @@ module RSence
|
|
302
358
|
cookie_key = msg.session[:cookie_key]
|
303
359
|
@valuemanager.resend_session_values( msg )
|
304
360
|
elsif ses_status
|
305
|
-
|
306
|
-
@
|
307
|
-
|
308
|
-
|
309
|
-
cookie_key = @randgen.gen_many(@config[:cookie_key_multiplier]).join('')
|
310
|
-
|
311
|
-
# map the new cookie key to the old session identifier
|
312
|
-
@session_cookie_keys[ cookie_key ] = ses_id
|
313
|
-
|
314
|
-
# binds the new cookie key to the old session data
|
315
|
-
@sessions[ses_id][:cookie_key] = cookie_key
|
361
|
+
|
362
|
+
unless @sessions[ses_id].has_key?(:_msg_unused)
|
363
|
+
# delete the old cookie key:
|
364
|
+
@session_cookie_keys.delete( cookie_key )
|
316
365
|
|
366
|
+
# get a new cookie key
|
367
|
+
cookie_key = @randgen.gen_many(@config[:cookie_key_multiplier]).join('')
|
368
|
+
|
369
|
+
# map the new cookie key to the old session identifier
|
370
|
+
@session_cookie_keys[ cookie_key ] = ses_id
|
371
|
+
|
372
|
+
# binds the new cookie key to the old session data
|
373
|
+
@sessions[ses_id][:cookie_key] = cookie_key
|
374
|
+
end
|
317
375
|
|
318
376
|
msg.session[:plugin_incr] = @plugins.incr
|
319
377
|
|
@@ -353,19 +411,23 @@ module RSence
|
|
353
411
|
end
|
354
412
|
|
355
413
|
def renew_cookie( msg, cookie_key )
|
414
|
+
renew_cookie_req_res( msg.request, msg.response, cookie_key )
|
415
|
+
end
|
416
|
+
|
417
|
+
def renew_cookie_req_res( request, response, cookie_key, ses_cookie_path=nil )
|
356
418
|
# Uses a cookie comment to tell the user what the
|
357
419
|
# cookie is for, change it to anything valid in the
|
358
420
|
# configuration.
|
359
421
|
ses_cookie_comment = @config[:ses_cookie_comment]
|
360
422
|
|
361
423
|
## mod_rewrite changes the host header to x-forwarded-host:
|
362
|
-
if
|
363
|
-
domain =
|
424
|
+
if request.header.has_key?('x-forwarded-host')
|
425
|
+
domain = request.header['x-forwarded-host']
|
364
426
|
|
365
427
|
## direct access just uses host (at least mongrel
|
366
428
|
## does mod_rewrite header translation):
|
367
429
|
else
|
368
|
-
domain =
|
430
|
+
domain = request.host
|
369
431
|
end
|
370
432
|
|
371
433
|
if domain == 'localhost'
|
@@ -373,7 +435,7 @@ module RSence
|
|
373
435
|
return
|
374
436
|
end
|
375
437
|
|
376
|
-
server_port =
|
438
|
+
server_port = request.port
|
377
439
|
|
378
440
|
## if the host address is a real domain
|
379
441
|
## (not just hostname or 'localhost'),
|
@@ -396,10 +458,10 @@ module RSence
|
|
396
458
|
## prevents unnecessary cookie-juggling in xhr's
|
397
459
|
if @config[:trust_cookies]
|
398
460
|
ses_cookie_path = '/'
|
399
|
-
|
461
|
+
elsif ses_cookie_path == nil
|
400
462
|
ses_cookie_path = RSence.config[:broker_urls][:hello]
|
401
463
|
end
|
402
|
-
|
464
|
+
|
403
465
|
## Formats the cookie to string
|
404
466
|
## (through array, to keep it readable in the source)
|
405
467
|
ses_cookie_arr = [
|
@@ -412,7 +474,7 @@ module RSence
|
|
412
474
|
]
|
413
475
|
|
414
476
|
### Sets the set-cookie header
|
415
|
-
|
477
|
+
response['Set-Cookie'] = ses_cookie_arr.join('; ')
|
416
478
|
end
|
417
479
|
|
418
480
|
def expire_ses_by_req( req, res )
|
@@ -478,7 +540,7 @@ module RSence
|
|
478
540
|
|
479
541
|
## get the ses_key from the request query:
|
480
542
|
ses_key = query[ 'ses_key' ]
|
481
|
-
|
543
|
+
|
482
544
|
## The message object binds request, response
|
483
545
|
## and all user/session -related data to one
|
484
546
|
## object, which is passed around where
|