rsence 2.0.0.10.pre → 2.0.0.11
Sign up to get free protection for your applications and to get access to all the features.
- data/.yardopts +10 -0
- data/INSTALL.rdoc +52 -86
- data/{LICENSE → LICENSE.txt} +0 -0
- data/README.rdoc +52 -49
- data/VERSION +1 -1
- data/bin/rsence +4 -6
- data/conf/default_conf.yaml +314 -305
- data/conf/default_strings.yaml +70 -71
- data/docs/ExampleGuiPlugin.rdoc +193 -0
- data/{js/comm/comm/autosync/js.inc → docs/JavascriptBundles.rdoc} +0 -0
- data/docs/PluginBundleInfo.rdoc +173 -0
- data/docs/PluginBundles.rdoc +96 -0
- data/docs/Values.rdoc +163 -0
- data/js/comm/{comm/autosync → autosync}/autosync.js +1 -2
- data/js/comm/{comm → autosync}/js.inc +0 -0
- data/js/comm/{comm/comm.js → comm.js} +1 -0
- data/js/comm/{comm/queue/js.inc → js.inc} +0 -0
- data/js/comm/jsloader/jsloader.js +2 -4
- data/js/comm/{comm/session → queue}/js.inc +0 -0
- data/js/comm/{comm/queue → queue}/queue.js +1 -0
- data/js/comm/{comm/sessionwatcher → session}/js.inc +0 -0
- data/js/comm/{comm/session → session}/session.js +4 -3
- data/js/comm/{comm/transporter → sessionwatcher}/js.inc +0 -0
- data/js/comm/{comm/sessionwatcher → sessionwatcher}/sessionwatcher.js +1 -0
- data/js/comm/{comm/urlresponder → transporter}/js.inc +0 -0
- data/js/comm/{comm/transporter → transporter}/transporter.js +1 -0
- data/js/comm/{comm/values → urlresponder}/js.inc +0 -0
- data/js/comm/{comm/urlresponder → urlresponder}/urlresponder.js +1 -0
- data/js/comm/{reloadapp → values}/js.inc +0 -0
- data/js/comm/{comm/values → values}/values.js +1 -0
- data/js/controls/button/button.js +10 -1
- data/js/controls/checkbox/checkbox.js +2 -0
- data/js/controls/dialogs/alert_sheet/alert_sheet.js +1 -0
- data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +1 -0
- data/js/controls/dialogs/sheet/sheet.js +1 -0
- data/js/controls/imageview/imageview.js +1 -0
- data/js/controls/passwordcontrol/passwordcontrol.js +1 -0
- data/js/controls/progress/progressbar/progressbar.js +1 -0
- data/js/controls/progress/progressindicator/progressindicator.js +1 -0
- data/js/controls/radiobutton/radiobutton.js +3 -1
- data/js/controls/sliders/slider/slider.js +1 -0
- data/js/controls/sliders/vslider/vslider.js +1 -0
- data/js/controls/stepper/stepper.js +1 -0
- data/js/controls/stringview/stringview.js +2 -2
- data/js/controls/tab/tab.js +7 -5
- data/js/controls/textarea/textarea.js +1 -0
- data/js/controls/textcontrol/textcontrol.js +3 -1
- data/js/controls/uploader/uploader.js +1 -0
- data/js/controls/validatorview/validatorview.js +62 -59
- data/js/controls/window/window.js +1 -0
- data/js/core/class/class.js +2 -1
- data/js/core/elem/elem.js +27 -27
- data/js/core/event/event.js +3 -874
- data/js/{comm/sha → core/rsence_ns}/js.inc +0 -0
- data/js/core/rsence_ns/rsence_ns.js +15 -0
- data/js/{controls/datetime → datetime}/calendar/calendar.js +1 -0
- data/js/{comm/values/value → datetime/calendar}/js.inc +0 -0
- data/js/{controls/datetime → datetime}/calendar/themes/default/calendar.css +0 -0
- data/js/{controls/datetime → datetime}/calendar/themes/default/calendar.html +0 -0
- data/js/{controls/datetime → datetime}/calendar/themes/default/calendar_arrows-ie6.gif +0 -0
- data/js/{controls/datetime → datetime}/calendar/themes/default/calendar_arrows.png +0 -0
- data/js/{controls/datetime → datetime}/datetimevalue/datetimevalue.js +1 -0
- data/js/{comm/values/valuematrix → datetime/datetimevalue}/js.inc +0 -0
- data/js/{controls/datetime/calendar → datetime/timesheet}/js.inc +0 -0
- data/js/{controls/datetime → datetime}/timesheet/themes/default/timesheet.css +0 -0
- data/js/{controls/datetime → datetime}/timesheet/themes/default/timesheet.html +0 -0
- data/js/{controls/datetime → datetime}/timesheet/timesheet.js +1 -0
- data/js/{controls/datetime/datetimevalue → datetime/timesheet_item}/js.inc +0 -0
- data/js/{controls/datetime → datetime}/timesheet_item/themes/default/timesheet_item.css +0 -0
- data/js/{controls/datetime → datetime}/timesheet_item/themes/default/timesheet_item.html +0 -0
- data/js/{controls/datetime → datetime}/timesheet_item/timesheet_item.js +1 -0
- data/js/{controls/datetime/timesheet → datetime/timesheet_item_edit}/js.inc +0 -0
- data/js/{controls/datetime → datetime}/timesheet_item_edit/timesheet_item_edit.js +1 -1
- data/js/foundation/application/application.js +1 -2
- data/js/foundation/control/control.js +1 -4
- data/js/foundation/control/controldefaults/controldefaults.js +1 -4
- data/js/foundation/control/dummyvalue/dummyvalue.js +1 -0
- data/js/foundation/control/dyncontrol/dyncontrol.js +1 -2
- data/js/foundation/control/eventresponder/eventresponder.js +11 -3
- data/js/{controls/datetime/timesheet_item → foundation/control/valuematrix}/js.inc +0 -0
- data/js/{comm/values → foundation/control}/valuematrix/valuematrix.js +2 -5
- data/js/foundation/control/valueresponder/valueresponder.js +3 -1
- data/js/foundation/eventmanager/eventmanager.js +884 -0
- data/js/{controls/datetime/timesheet_item_edit → foundation/eventmanager}/js.inc +0 -0
- data/js/foundation/geom/point/point.js +2 -2
- data/js/foundation/geom/rect/rect.js +1 -0
- data/js/foundation/json_renderer/json_renderer.js +2 -0
- data/js/foundation/system/system.js +2 -1
- data/js/foundation/thememanager/thememanager.js +29 -23
- data/js/{controls/lists/checkboxlist → foundation/value}/js.inc +0 -0
- data/js/{comm/values → foundation}/value/value.js +1 -0
- data/js/foundation/view/markupview/markupview.js +2 -1
- data/js/foundation/view/morphanimation/morphanimation.js +1 -0
- data/js/foundation/view/view.js +6 -12
- data/js/foundation/view/viewdefaults/viewdefaults.js +1 -0
- data/js/{controls/lists → lists}/checkboxlist/checkboxlist.js +1 -0
- data/js/{controls/lists/listitems → lists/checkboxlist}/js.inc +0 -0
- data/js/{controls/lists/radiobuttonlist → lists/listitems}/js.inc +0 -0
- data/js/{controls/lists → lists}/listitems/listitems.js +22 -3
- data/js/lists/radiobuttonlist/js.inc +0 -0
- data/js/{controls/lists → lists}/radiobuttonlist/radiobuttonlist.js +2 -12
- data/js/util/reloadapp/js.inc +0 -0
- data/js/{comm → util}/reloadapp/reloadapp.js +10 -8
- data/js/{comm → util}/reloadapp/themes/default/reloadapp_warning-ie6.gif +0 -0
- data/js/{comm → util}/reloadapp/themes/default/reloadapp_warning.png +0 -0
- data/js/util/sha/js.inc +0 -0
- data/js/{comm → util}/sha/sha.js +27 -33
- data/js/views/centerview/centerview.js +33 -3
- data/js/views/inlineview/inlineview.js +1 -0
- data/js/views/scrollview/scrollview.js +1 -0
- data/lib/conf/argv.rb +34 -22
- data/lib/conf/default.rb +165 -173
- data/lib/daemon/daemon.rb +9 -9
- data/lib/daemon/sigcomm.rb +4 -4
- data/lib/http/broker.rb +30 -27
- data/lib/http/rackup.rb +2 -3
- data/lib/http/request.rb +1 -2
- data/lib/http/response.rb +10 -10
- data/lib/plugins/dependencies.rb +2 -1
- data/lib/plugins/gui_plugin.rb +77 -50
- data/lib/plugins/guiparser.rb +26 -22
- data/lib/plugins/plugin.rb +207 -427
- data/lib/plugins/plugin_base.rb +162 -0
- data/lib/plugins/plugin_plugins.rb +21 -15
- data/lib/plugins/plugin_sqlite_db.rb +45 -20
- data/lib/plugins/pluginmanager.rb +10 -5
- data/lib/plugins/plugins.rb +65 -31
- data/lib/plugins/servlet.rb +74 -26
- data/lib/rsence.rb +32 -0
- data/lib/session/msg.rb +131 -96
- data/lib/session/sessionmanager.rb +5 -4
- data/lib/session/sessionstorage.rb +4 -3
- data/lib/transporter/transporter.rb +30 -21
- data/lib/util/gzstring.rb +4 -2
- data/lib/util/ruby19_fixes.rb +18 -0
- data/lib/values/hvalue.rb +139 -88
- data/lib/values/valuemanager.rb +60 -46
- data/plugins/client_pkg/client_pkg.rb +6 -5
- data/plugins/client_pkg/lib/client_pkg_build.rb +5 -5
- data/plugins/client_pkg/lib/client_pkg_serve.rb +8 -0
- data/plugins/index_html/index_html.rb +3 -1
- data/plugins/index_html/tmpl/index.html +2 -3
- data/plugins/main/js/main.js +84 -0
- data/plugins/main/main.rb +54 -27
- data/plugins/ticket/lib/common.rb +4 -2
- data/plugins/ticket/lib/favicon.rb +3 -2
- data/plugins/ticket/lib/file.rb +2 -2
- data/plugins/ticket/lib/img.rb +2 -2
- data/plugins/ticket/lib/objblob.rb +2 -2
- data/plugins/ticket/lib/rsrc.rb +2 -2
- data/plugins/ticket/lib/upload.rb +9 -8
- data/plugins/ticket/ticket.rb +141 -8
- data/setup/welcome/welcome.rb +1 -0
- metadata +76 -72
- data/lib/plugins/plugin_util.rb +0 -107
- data/plugins/index_html/tmpl/startup_index.html +0 -29
- data/plugins/main/js/riassence_ns.js +0 -87
- data/setup/legacy/info.yaml +0 -18
- data/setup/legacy/legacy.rb +0 -17
- data/setup/welcome/gui/welcome.yaml +0 -68
- data/setup/welcome/text/welcome.html +0 -8
data/lib/daemon/daemon.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
## RSence
|
3
2
|
# Copyright 2008 Riassence Inc.
|
4
3
|
# http://riassence.com/
|
@@ -6,7 +5,7 @@
|
|
6
5
|
# You should have received a copy of the GNU General Public License along
|
7
6
|
# with this software package. If not, contact licensing@riassence.com
|
8
7
|
##
|
9
|
-
|
8
|
+
|
10
9
|
|
11
10
|
# Use rubygems to load rack
|
12
11
|
require 'rubygems'
|
@@ -14,22 +13,23 @@ require 'rubygems'
|
|
14
13
|
# Transporter is the top-level handler for calls coming from the javascript COMM.Transporter.
|
15
14
|
require 'transporter/transporter'
|
16
15
|
|
17
|
-
|
16
|
+
# Broker routes requests to the correct handler
|
18
17
|
require 'http/broker'
|
19
18
|
|
20
19
|
|
21
|
-
module
|
20
|
+
module RSence
|
22
21
|
|
22
|
+
# @private The process id of the launch process (usually the PID of the 'rsence' command)
|
23
23
|
@@launch_pid = Process.pid
|
24
24
|
|
25
|
-
# Returns the pid of the process when starting up.
|
26
|
-
#
|
25
|
+
# @private Returns the pid of the process when starting up.
|
26
|
+
# PID is different for the forked child process or processes
|
27
27
|
def self.launch_pid
|
28
28
|
return @@launch_pid
|
29
29
|
end
|
30
30
|
|
31
|
-
# The Controller module handles the
|
32
|
-
#
|
31
|
+
# @private The Controller module handles the daemonizing
|
32
|
+
# operations of the process referred to as +daemon+
|
33
33
|
module Daemon
|
34
34
|
|
35
35
|
# Writes the process id to disk, the pid_fn method of the daemon contains
|
@@ -254,7 +254,7 @@ module ::RSence
|
|
254
254
|
|
255
255
|
end
|
256
256
|
|
257
|
-
# Simple process control, constructed here and called from Daemon::Controller
|
257
|
+
# @private Simple process control, constructed here and called from Daemon::Controller
|
258
258
|
class HTTPDaemon
|
259
259
|
|
260
260
|
# RSence top-level run handler. Almost identical to start.
|
data/lib/daemon/sigcomm.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
## RSence
|
3
2
|
# Copyright 2010 Riassence Inc.
|
4
3
|
# http://riassence.com/
|
@@ -6,12 +5,13 @@
|
|
6
5
|
# You should have received a copy of the GNU General Public License along
|
7
6
|
# with this software package. If not, contact licensing@riassence.com
|
8
7
|
##
|
9
|
-
#++
|
10
8
|
|
11
|
-
|
12
|
-
# Utilized by ARGVParser and Daemon.
|
9
|
+
|
13
10
|
|
14
11
|
module RSence
|
12
|
+
|
13
|
+
# @private RSence async signal communication handler, uses temporary files for communication.
|
14
|
+
# Utilized by ARGVParser and Daemon.
|
15
15
|
module SIGComm
|
16
16
|
def self.delete_signal_response( pid_fn )
|
17
17
|
sig_fn = pid_fn+'.response.'+signal
|
data/lib/http/broker.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
## RSence
|
3
2
|
# Copyright 2008 Riassence Inc.
|
4
3
|
# http://riassence.com/
|
@@ -6,11 +5,6 @@
|
|
6
5
|
# You should have received a copy of the GNU General Public License along
|
7
6
|
# with this software package. If not, contact licensing@riassence.com
|
8
7
|
##
|
9
|
-
#++
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
module RSence
|
14
8
|
|
15
9
|
require 'rubygems'
|
16
10
|
require 'rack'
|
@@ -21,12 +15,17 @@ require 'http/response'
|
|
21
15
|
## Minimally WEBrick -compatible request object
|
22
16
|
require 'http/request'
|
23
17
|
|
24
|
-
|
25
|
-
|
18
|
+
|
19
|
+
module RSence
|
20
|
+
|
21
|
+
|
22
|
+
# Broker sets up Rack and routes requests to the proper request processing instance.
|
26
23
|
class Broker
|
27
24
|
|
28
|
-
# This method is called from Rack.
|
29
|
-
|
25
|
+
# This method is called from Rack.
|
26
|
+
# @param [Hash] env is the Rack environment.
|
27
|
+
# @return [Array(Number, Hash, String)] Rack-style response status, header, body
|
28
|
+
def call( env )
|
30
29
|
sleep @@ping_sim if @@ping_sim
|
31
30
|
unless @@transporter.online?
|
32
31
|
puts "#{Time.now.strftime('%Y-%m-%d %H:%M:%S')} -- Server busy."
|
@@ -50,10 +49,9 @@ class Broker
|
|
50
49
|
|
51
50
|
# Returns a dynamically created "REST Dispatcher" kind of class that has
|
52
51
|
# request and response as instance variables and the rest of the Broker
|
53
|
-
# class as the superclass.
|
54
|
-
#
|
55
|
-
#
|
56
|
-
# Broker currently implements only get and post methods.
|
52
|
+
# class as the superclass. It calls the method according to the http method. Called from {#call}
|
53
|
+
# Broker currently implements only the {#get} and {#post} methods.
|
54
|
+
# @return [Broker] An instance of Broker with a {Request} instance as +@request+ and a {Response} instance as +@response+
|
57
55
|
def dispatcher_class
|
58
56
|
@dispatcher ||= Class.new(self.class) do
|
59
57
|
attr_accessor :content_type
|
@@ -64,13 +62,14 @@ class Broker
|
|
64
62
|
end
|
65
63
|
end
|
66
64
|
|
67
|
-
#
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
#
|
72
|
-
#
|
73
|
-
|
65
|
+
# Creates the Rack instance and set up itself accordingly.
|
66
|
+
#
|
67
|
+
# @param [Transporter] transporter The single {Transporter} instance initialized by {HTTPDaemon}
|
68
|
+
# @param [Hash{Symbol => String}] conf Rack initialization settings
|
69
|
+
# @option conf [String] :bind_address ('127.0.0.1') The TCP/IP address or mask to bind to.
|
70
|
+
# @option conf [#to_i] :port ('8001') The TCP port to bind to.
|
71
|
+
# @option conf [String] :rack_require ('mongrel') The Rack handler to use.
|
72
|
+
def self.start( transporter, conf = {:bind_address => '127.0.0.1', :port => '8001', :rack_require => 'mongrel'} )
|
74
73
|
|
75
74
|
host = conf[:bind_address]
|
76
75
|
port = conf[:port]
|
@@ -115,21 +114,25 @@ class Broker
|
|
115
114
|
|
116
115
|
end
|
117
116
|
|
117
|
+
=begin
|
118
|
+
# Extends the receiver with SingletonMethods
|
118
119
|
def self.included( receiver )
|
119
120
|
receiver.extend( SingletonMethods )
|
120
121
|
end
|
122
|
+
=end
|
123
|
+
|
121
124
|
|
122
|
-
# Generic 404 handler
|
125
|
+
# Generic 404 error handler. Just sets up response status, headers, body as a small "Page Not Found" html page
|
123
126
|
def not_found
|
124
127
|
puts "/404: #{@request.fullpath.inspect}" if RSence.args[:verbose]
|
125
128
|
@response.status = 404
|
126
129
|
err404 = '<html><head><title>404 - Page Not Found</title></head><body>404 - Page Not Found</body></html>'
|
127
|
-
@response['
|
128
|
-
@response['
|
130
|
+
@response['Content-Type'] = 'text/html; charset=UTF-8'
|
131
|
+
@response['Content-Length'] = err404.length.to_s
|
129
132
|
@response.body = err404
|
130
133
|
end
|
131
134
|
|
132
|
-
|
135
|
+
# Routes POST requests to {Transporter#servlet}
|
133
136
|
def post
|
134
137
|
|
135
138
|
puts "post: #{@request.fullpath}" if RSence.args[:verbose]
|
@@ -138,7 +141,7 @@ class Broker
|
|
138
141
|
|
139
142
|
end
|
140
143
|
|
141
|
-
|
144
|
+
# Routes GET requests to {Transporter#servlet}
|
142
145
|
def get
|
143
146
|
|
144
147
|
puts "get: #{@request.fullpath}" if RSence.args[:verbose]
|
@@ -147,7 +150,7 @@ class Broker
|
|
147
150
|
|
148
151
|
end
|
149
152
|
|
150
|
-
### -- Add more http methods here when we have some apps to test with
|
153
|
+
### -- Add more http methods here when we have some apps to test with CalDAV implementation maybe? ++
|
151
154
|
|
152
155
|
end
|
153
156
|
|
data/lib/http/rackup.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
## RSence
|
3
2
|
# Copyright 2008 Riassence Inc.
|
4
3
|
# http://riassence.com/
|
@@ -6,7 +5,7 @@
|
|
6
5
|
# You should have received a copy of the GNU General Public License along
|
7
6
|
# with this software package. If not, contact licensing@riassence.com
|
8
7
|
##
|
9
|
-
|
8
|
+
|
10
9
|
|
11
10
|
warn "Current RSence rackup Broker implementation does not work."
|
12
11
|
warn "Please try again in a future revision."
|
@@ -47,7 +46,7 @@ module Broker
|
|
47
46
|
@@transporter = Transporter.new
|
48
47
|
|
49
48
|
def self.start
|
50
|
-
conf =
|
49
|
+
conf = RSence.config[:http_server][:latency]
|
51
50
|
if conf == 0
|
52
51
|
@@ping_sim = false
|
53
52
|
else
|
data/lib/http/request.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
## RSence
|
3
2
|
# Copyright 2008 Riassence Inc.
|
4
3
|
# http://riassence.com/
|
@@ -6,7 +5,7 @@
|
|
6
5
|
# You should have received a copy of the GNU General Public License along
|
7
6
|
# with this software package. If not, contact licensing@riassence.com
|
8
7
|
##
|
9
|
-
|
8
|
+
|
10
9
|
|
11
10
|
|
12
11
|
require 'rubygems'
|
data/lib/http/response.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
#--
|
2
1
|
## RSence
|
3
2
|
# Copyright 2008 Riassence Inc.
|
4
3
|
# http://riassence.com/
|
@@ -6,22 +5,23 @@
|
|
6
5
|
# You should have received a copy of the GNU General Public License along
|
7
6
|
# with this software package. If not, contact licensing@riassence.com
|
8
7
|
##
|
9
|
-
|
8
|
+
|
10
9
|
|
11
10
|
|
12
11
|
module RSence
|
13
12
|
|
14
|
-
# Simply adds the + method "operator" to an extended Array.
|
15
|
-
# Used for pushing http body data.
|
16
|
-
class ResponseBody < Array
|
17
|
-
def +(body_data)
|
18
|
-
self.push(body_data)
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
13
|
# Classic WEBrick -compatible Response object for Rack.
|
23
14
|
# Implements only the methods used by the framework.
|
24
15
|
class Response
|
16
|
+
|
17
|
+
# Adds the + method "operator" to an extended Array.
|
18
|
+
# Used for pushing http body data.
|
19
|
+
class ResponseBody < Array
|
20
|
+
def +(body_data)
|
21
|
+
self.push(body_data)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
25
|
def initialize
|
26
26
|
@body = ResponseBody.new(1)
|
27
27
|
@body[0] = ''
|
data/lib/plugins/dependencies.rb
CHANGED
@@ -6,6 +6,7 @@
|
|
6
6
|
# with this software package. If not, contact licensing@riassence.com
|
7
7
|
##
|
8
8
|
|
9
|
+
|
9
10
|
module RSence
|
10
11
|
|
11
12
|
# = Description:
|
@@ -126,7 +127,7 @@ module RSence
|
|
126
127
|
# List of categories
|
127
128
|
attr_reader :categories
|
128
129
|
|
129
|
-
# Adds the
|
130
|
+
# Adds the category +name+.
|
130
131
|
def add_category( name )
|
131
132
|
@categories.push( name ) unless @categories.include?( name )
|
132
133
|
end
|
data/lib/plugins/gui_plugin.rb
CHANGED
@@ -6,32 +6,31 @@
|
|
6
6
|
# with this software package. If not, contact licensing@riassence.com
|
7
7
|
##
|
8
8
|
|
9
|
-
|
9
|
+
|
10
|
+
module RSence
|
10
11
|
module Plugins
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
##
|
30
|
-
##
|
31
|
-
##
|
32
|
-
class GUIPluginTemplate < PluginTemplate
|
13
|
+
# The CUIPlugin__ is actually available as +GUIPlugin+ from plugin bundle code using the {RSence::Plugins::GUIPlugin} class mimic method.
|
14
|
+
#
|
15
|
+
# GUIPlugin extends {Plugin__ Plugin} by automatically initializing an {GUIParser} instance as +@gui+.
|
16
|
+
#
|
17
|
+
# Read {Plugin__ Plugin} for usage of the API, {file:ExampleGuiPlugin Example GUIPlugin} for an example of use and {file:PluginBundles Plugin Bundles} for overall information about plugin bundle usage.
|
18
|
+
#
|
19
|
+
# * It implements automatic dependency loading based on the dependencies item in the YAML gui declaration.
|
20
|
+
# * It inits the gui automatically.
|
21
|
+
#
|
22
|
+
# = User Interface -related hooks:
|
23
|
+
# * {#init_ui +#init_ui+} -- Extend to implement logic when the {MainPlugin} plugin has started the client. The {GUIPlugin__ +GUIPlugin+} class extends this method to automatically load and initialize the user interface from a +GUITree+ data structure defined in the +gui/main.yaml+ document in the bundle directory.
|
24
|
+
# * {#gui_params +#gui_params+} -- Extend to define your own params for the gui data.
|
25
|
+
#
|
26
|
+
class GUIPlugin__ < Plugin__
|
27
|
+
|
28
|
+
# @private Class type identifier for the PluginManager.
|
29
|
+
# @return [:GUIPlugin]
|
33
30
|
def self.bundle_type; :GUIPlugin; end
|
34
|
-
|
31
|
+
|
32
|
+
|
33
|
+
# @private Placeholder for actual gui yaml file.
|
35
34
|
@@default_yaml_src = <<-END
|
36
35
|
type: GUITree
|
37
36
|
version: 0.6
|
@@ -41,8 +40,10 @@ options:
|
|
41
40
|
label: "Dummy Application"
|
42
41
|
|
43
42
|
END
|
44
|
-
|
45
|
-
#
|
43
|
+
|
44
|
+
# In addition to {Plugin__#init Plugin#init}, also automatically initializes a {GUIParser} instance as +@gui+
|
45
|
+
#
|
46
|
+
# @return [nil]
|
46
47
|
def init
|
47
48
|
super
|
48
49
|
yaml_src = file_read( "gui/#{@name}.yaml" )
|
@@ -52,16 +53,36 @@ options:
|
|
52
53
|
@client_pkgs = false
|
53
54
|
end
|
54
55
|
|
55
|
-
# Extend this method to return custom params to GUIParser#init.
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
56
|
+
# Extend this method to return custom params to {GUIParser#init}.
|
57
|
+
#
|
58
|
+
# Called from {#init_ui}.
|
59
|
+
#
|
60
|
+
# By default assigns the session values as :values to use for +bind: :values.my_value_name+ in the YAML GUI file for client-side value bindings.
|
61
|
+
#
|
62
|
+
# @param [Message] msg The message is supplied by the system.
|
63
|
+
#
|
64
|
+
# @return [Hash] Parameters for {GUIParser#init @gui#init}
|
65
|
+
#
|
66
|
+
# @example To provide extra parameters, do this:
|
67
|
+
# def gui_params( msg )
|
68
|
+
# params = super
|
69
|
+
# params[:extra] = {
|
70
|
+
# :foo => "Foo", # use in the GUITree as :extra.foo
|
71
|
+
# :num => 124334, # use in the GUITree as :extra.num
|
72
|
+
# :bar => {
|
73
|
+
# :barbar => "Bar" # use in the GUITree as :extra.bar.barbar
|
74
|
+
# }
|
75
|
+
# :arr => [1,2,4,8] # use in the GUITree as :extra.arr
|
76
|
+
# }
|
77
|
+
# params[:more] = "More" # use in the GUITree as :more
|
78
|
+
# return params
|
79
|
+
# end
|
80
|
+
#
|
59
81
|
def gui_params( msg )
|
60
|
-
|
61
|
-
:values => @gui.values( get_ses( msg ) )
|
62
|
-
}
|
82
|
+
{ :values => @gui.values( get_ses( msg ) ) }
|
63
83
|
end
|
64
|
-
|
84
|
+
|
85
|
+
# @private Method that implements +client_pkgs.yaml+ loading
|
65
86
|
def install_client_pkgs
|
66
87
|
if @client_pkgs
|
67
88
|
warn "install_client_pkgs: called with @client_pkgs defined; returning"
|
@@ -82,7 +103,8 @@ options:
|
|
82
103
|
@plugins.client_pkg.rebuild_client
|
83
104
|
end
|
84
105
|
end
|
85
|
-
|
106
|
+
|
107
|
+
# @private Method that implements +client_pkgs.yaml+ unloading
|
86
108
|
def uninstall_client_pkgs
|
87
109
|
if not @client_pkgs
|
88
110
|
warn "uninstall_client_pkgs: called without @client_pkgs defined"
|
@@ -101,33 +123,38 @@ options:
|
|
101
123
|
end
|
102
124
|
@client_pkgs = false
|
103
125
|
end
|
104
|
-
|
126
|
+
|
127
|
+
# @private calls install_client_pkgs, if a 'client_pkgs.yaml' file is found
|
105
128
|
def open
|
106
129
|
super
|
107
130
|
install_client_pkgs if File.exist? bundle_path( 'client_pkgs.yaml' )
|
108
131
|
end
|
109
|
-
|
132
|
+
|
133
|
+
# @private calls uninstall_client_pkgs, if a 'client_pkgs.yaml' file was loaded
|
110
134
|
def close
|
111
135
|
super
|
112
136
|
uninstall_client_pkgs if @client_pkgs
|
113
137
|
end
|
114
|
-
|
115
|
-
# Sends gui specification to the main plugin
|
138
|
+
|
139
|
+
# @private Sends gui specification to the main plugin
|
116
140
|
def spec_ui( msg )
|
117
141
|
# TODO
|
118
142
|
end
|
119
|
-
|
120
|
-
# Automatically inits the UI using GUIParser#init
|
121
|
-
#
|
122
|
-
|
123
|
-
|
124
|
-
#
|
125
|
-
def
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
143
|
+
|
144
|
+
# Automatically inits the UI using {GUIParser#init}
|
145
|
+
#
|
146
|
+
# @param [Message] msg The message is supplied by the system.
|
147
|
+
#
|
148
|
+
# @return [nil]
|
149
|
+
def init_ui( msg )
|
150
|
+
@gui.init( msg, gui_params( msg ) )
|
151
|
+
end
|
152
|
+
|
153
|
+
# @private Automatically kills the UI using {GUIParser#kill}
|
154
|
+
def kill_ui( msg )
|
155
|
+
@gui.kill( msg )
|
156
|
+
end
|
157
|
+
|
131
158
|
end
|
132
159
|
end
|
133
160
|
end
|