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
@@ -0,0 +1,96 @@
|
|
1
|
+
|
2
|
+
= Overview
|
3
|
+
Plugin bundles are the "building blocks" of RSence applications.
|
4
|
+
A bundle is a directory that groups together the software code
|
5
|
+
and its related resources.
|
6
|
+
|
7
|
+
Plugin bundles are constructed of at least a directory and a ruby
|
8
|
+
source file either named "main.rb" or the same name as the
|
9
|
+
directory plus + ".rb".
|
10
|
+
|
11
|
+
The main ruby file has to contain at least one class extended from one
|
12
|
+
of the three types of plugins:
|
13
|
+
- {RSence::Plugins::Plugin__ Plugin}, which is the simplest main logic plugin model.
|
14
|
+
- {RSence::Plugins::GUIPlugin__ GUIPlugin}, which is an extended model of plugin with built-in user interface support.
|
15
|
+
- {RSence::Plugins::Servlet__ Servlet}, which is a "traditional" request/response handler for GET/POST url's.
|
16
|
+
|
17
|
+
== Example 1: A very simple plugin bundle structure
|
18
|
+
!!!plain
|
19
|
+
simple_plugin/
|
20
|
+
`-- main.rb
|
21
|
+
|
22
|
+
=== Simplest possible contents of the "main.rb" as above
|
23
|
+
class SimplePlugin < Plugin
|
24
|
+
end
|
25
|
+
|
26
|
+
A plugin like this just gets registered as a plugin named :simple_plugin when RSence finds it in one of its "plugins" directories. By default, one "plugins" directory is distributed as a part of RSence and contains some core services common to most applications. The other is the "plugins" directory inside your RSence project environment directory.
|
27
|
+
|
28
|
+
To make the plugin do something useful, extend its model. To know more about that, just read the documentation about the model classes: {RSence::Plugins::Plugin__ Plugin}, {RSence::Plugins::GUIPlugin__ GUIPlugin}, {RSence::Plugins::Servlet__ Servlet}.
|
29
|
+
|
30
|
+
=== Extending the simple plugin to say "Hello" to your web browser's javascript console.
|
31
|
+
class SimplePlugin < Plugin
|
32
|
+
def init_ui( msg )
|
33
|
+
msg.console( "Hello" )
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
== Example 2: {file:ExampleGuiPlugin The "welcome" GUIPlugin bundle}
|
38
|
+
This example is rather lengthy, so read it {file:ExampleGuiPlugin here}.
|
39
|
+
|
40
|
+
|
41
|
+
= Plugin meta-information files
|
42
|
+
|
43
|
+
These files are optional parts of a bundle, but are supported by the system. Most bundles will contain several other files as well, as defined by each bundle's software code.
|
44
|
+
|
45
|
+
=== Supported by all bundle types, including {RSence::Plugins::Servlet__ Servlet}:
|
46
|
+
- An {file:PluginBundleInfo info.yaml file}
|
47
|
+
- Defines the meta-information about the bundle, like its name, description, version, system requirements, dependencies etc.
|
48
|
+
- Each bundle *should* include an +info.yaml+ file.
|
49
|
+
- Any extra information, like default settings of the plugin itself can be stored here
|
50
|
+
|
51
|
+
=== Supported by {RSence::Plugins::Plugin__ Plugin} and {RSence::Plugins::GUIPlugin__ GUIPlugin} bundles:
|
52
|
+
- A {file:Values values.yaml file}
|
53
|
+
- Defines the default client-server {RSence::HValue HValue} objects to create for each user session.
|
54
|
+
- Contains what the default data is for each value.
|
55
|
+
- Defines if the data should be reset when the page is reloaded.
|
56
|
+
- Defines if the data should be the return-value of a plugin method.
|
57
|
+
- Binds the values to responder methods.
|
58
|
+
- Defines which plugins to bind
|
59
|
+
- The plugin defaults to the plugin bundle which defined the method
|
60
|
+
- Defines which methods to bind
|
61
|
+
- When the data of the value is changed by the client, the system calls the bound plugin methods to respond to and validate the data.
|
62
|
+
|
63
|
+
=== Supported by {RSence::Plugins::GUIPlugin__ GUIPlugin} bundles:
|
64
|
+
- A {file:JavascriptBundles client_pkgs.yaml file}
|
65
|
+
- Defines the packages of any extra javascript bundles and their themes, when contained in the bundle.
|
66
|
+
- The contents of the packages are loaded and built automatically by the built-in {ClientPkgPlugin +client_pkg+} plugin.
|
67
|
+
- A {file:GUITreeYaml gui/main.yaml file}
|
68
|
+
- Instead of +main.yaml+, can optionally be named like +simple_plugin.yaml+ if the bundle name is +simple_plugin+
|
69
|
+
- Defines structure of the default user interface.
|
70
|
+
- Defines client-side {RSence::HValue value} bindings
|
71
|
+
- The values used must be defined, like using the {file:Values +values.yaml+} file
|
72
|
+
- May define other mappings, like localized strings and other static data.
|
73
|
+
- The system builds a user interface based on this file automatically when a RSence web page is loaded (and reloaded) by the user.
|
74
|
+
|
75
|
+
= Values and data transfer
|
76
|
+
The description is rather lengthy, so it's in its own document {file:Values HERE}.
|
77
|
+
|
78
|
+
= Messages and sessions
|
79
|
+
As a side effect of having the same instances of plugins serve the requests of all sessions, the request/response/session messaging is implemented as messaging objects. These objects contain or delegate all the necessary hooks required by the complete request/response cycle.
|
80
|
+
|
81
|
+
The naming convention of the {RSence::Message Message} instance is +msg+ and it's given as the first parameter of methods using it directly.
|
82
|
+
|
83
|
+
Use {RSence::Message#session_id +msg.session_id+} to identify the session's serial number and {RSence::Message#user_id +msg.user_id+} to identify the user's identity. Both are Numbers.
|
84
|
+
|
85
|
+
Use the {RSence::Message#session +msg.session+} +Hash+ to store any persistent data associated with the user's session, preferably using the name of the plugin or its registered name as the primary key entry in the Hash. To do so automatically, just call the {RSence::Plugins::Plugin__#get_ses +get_ses+} method in your Plugin or GUIPlugin.
|
86
|
+
|
87
|
+
The session data is persistent; it's stored in the session database by the main {RSence::SessionStorage SessionStorage} instance automatically, if a database connection string is properly configured.
|
88
|
+
|
89
|
+
The +msg+ also provides access to the {RSence::Request +msg.request+} and {RSence::Response +msg.response+} objects directly, but don't mess around with them unless you know exactly what you are doing.
|
90
|
+
|
91
|
+
Use the {RSence::PluginManager#method_missing +@plugins+} object to call other plugins, like this:
|
92
|
+
@plugins.plugin_name.method_name( param1, param2 )
|
93
|
+
|
94
|
+
To append Javascript source code to be executed in the client, use the {RSence::Message#reply +msg.reply+} method. The {RSence::Message#console +msg.console+} method displays debugging messages in the browser's Javascript console.
|
95
|
+
|
96
|
+
|
data/docs/Values.rdoc
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
= Overview
|
2
|
+
The data exchange system exists to support bi-directional data synchronization between the browser and the plugin. The values are stored in the session as +HValue+ instances.
|
3
|
+
|
4
|
+
Values support Hashes, Arrays, Strings, Numbers, Booleans and logically correct combinations of those. The data is automatically converted between ruby objects (server) and json objects (client). For dates and times, use Numbers as seconds since or before UTC epoch; (1970-01-01 00:00:00.0 equals 0.0) and convert accordingly for the representation intended.
|
5
|
+
|
6
|
+
Each instance may be bound to plugin methods that are used as value change notification responders.
|
7
|
+
|
8
|
+
When a method is bound to the value, the method is called as an event notification whenever the client has changed the value and synchronizes it to the server. The responders act as validators by default.
|
9
|
+
|
10
|
+
Values may be bound in the client to instances of classes that implement the HValueResponder interface, like any derivate of HControl. See the client documentation for instructions about using them.
|
11
|
+
|
12
|
+
To define a value responder method, it needs to respond to exactly two parameters: {RSence::Message +msg+} and {RSence::HValue +value+} (in that specific order). The method's return value must be either +true+ or +false+. When the method returns +false+, the change is discarded and the previously server-set value is sent back to the client.
|
13
|
+
|
14
|
+
= Defining values
|
15
|
+
The simplest and recommended way of defining the values is to define the value configuration file +values.yaml+ at the root level of your plugin bundle. The definition is then copied to each session automatically. Values created using +values.yaml+ files are accessible by their name in each user's session object.
|
16
|
+
|
17
|
+
For instance, if a value has been defined as +:myvalue+, it's accessible in code like this:
|
18
|
+
ses = get_ses(msg) # gets the session object of the local plugin
|
19
|
+
my_value = ses[:myvalue] # reference to the value instance
|
20
|
+
|
21
|
+
=== Syntax reference of the contents of a +values.yaml+ file:
|
22
|
+
|
23
|
+
The name of the value, +:value_name+ in this case. It's a Hash key in the yaml syntax
|
24
|
+
!!!yaml
|
25
|
+
:value_name:
|
26
|
+
|
27
|
+
Definitions of the value; all definitions are optional.
|
28
|
+
|
29
|
+
The static value definition, a string "Foo" in this case. The default is +0+
|
30
|
+
!!!yaml
|
31
|
+
:value: Foo
|
32
|
+
|
33
|
+
A plugin method to call to define the default value dynamically instead of the static value defined in +:value+
|
34
|
+
!!!yaml
|
35
|
+
:value_call:
|
36
|
+
|
37
|
+
The name of the plugin where the responder method is found. It Defaults to the plugin where defined
|
38
|
+
!!!yaml
|
39
|
+
:plugin: plugin_name
|
40
|
+
|
41
|
+
The name of the responder method. Mandatory item when defining a value call. In this case a method named +method_name+
|
42
|
+
!!!yaml
|
43
|
+
:method: method_name
|
44
|
+
|
45
|
+
Optionally, list of parameters for the +:method+ in the order of defined. In this case, three parameters: 1, 'foo' and 3
|
46
|
+
!!!yaml
|
47
|
+
:args:
|
48
|
+
- 1
|
49
|
+
- foo
|
50
|
+
- 3
|
51
|
+
|
52
|
+
If +:uses_msg+ is set to false, the {RSence::Message +msg+} won't be passed as the first parameter to the +:method+. It's +true+ by default.
|
53
|
+
!!!yaml
|
54
|
+
:uses_msg: false
|
55
|
+
|
56
|
+
Restores the default, when the session is restored (page reload etc); defaults to +true+
|
57
|
+
!!!yaml
|
58
|
+
:restore_default: false
|
59
|
+
|
60
|
+
List of value responder methods to bind.
|
61
|
+
!!!yaml
|
62
|
+
:responders:
|
63
|
+
|
64
|
+
The name of the plugin and the method to bind. The plugin defaults to the plugin where defined. The responder methods always use the convention (+msg+, +value+) as their parameters.
|
65
|
+
!!!yaml
|
66
|
+
- :plugin: plugin_name
|
67
|
+
:method: method_name
|
68
|
+
|
69
|
+
Another responder, this one using the same plugin where defined:
|
70
|
+
!!!yaml
|
71
|
+
- :method: another_method
|
72
|
+
|
73
|
+
==== Example 1:
|
74
|
+
A value defined using only the defaults by supplying an empty Hash: { value: 0, default restored, no responders or calls }
|
75
|
+
!!!yaml
|
76
|
+
:value_with_defaults: {}
|
77
|
+
|
78
|
+
==== Example 2:
|
79
|
+
This value defines a Number (123) and doesn't restore the default, when restoring the session.
|
80
|
+
!!!yaml
|
81
|
+
:one_two_three:
|
82
|
+
:value: 123
|
83
|
+
:restore_default: false
|
84
|
+
|
85
|
+
==== Example 3:
|
86
|
+
This value gets a random string and specifies a responder, that ensures it's unique, if changed in the client. (Such methods aren't predefined).
|
87
|
+
!!!yaml
|
88
|
+
:random_unique_string:
|
89
|
+
:value_call:
|
90
|
+
:method: get_unique_random_string
|
91
|
+
:uses_msg: false
|
92
|
+
:responders:
|
93
|
+
- :method: ensure_unique_random_string
|
94
|
+
|
95
|
+
|
96
|
+
= Using values in code
|
97
|
+
|
98
|
+
=== Creating a HValue object in ruby and creates the client representation automatically.
|
99
|
+
Sometimes dynamic value allocation is required. In these cases, use {RSence::HValue HValue} directly in the plugin's ruby code (or any library code that gets a +msg+).
|
100
|
+
a_test_value = HValue.new( msg, 'any_json_mappable_data' )
|
101
|
+
|
102
|
+
=== A minimal value responder method is defined like this:
|
103
|
+
def my_value_responder( msg, my_value )
|
104
|
+
return true
|
105
|
+
end
|
106
|
+
|
107
|
+
=== To access the content of the value, use the {RSence::HValue#data +value.data+} attribute.
|
108
|
+
def int_between_100_and_200( msg, value )
|
109
|
+
data = value.data.to_i
|
110
|
+
return ( data >= 100 and data <= 200 )
|
111
|
+
end
|
112
|
+
|
113
|
+
=== To change the content of the value, use the {RSence::HValue#set +value.set+} method.
|
114
|
+
def int_between_100_and_200( msg, value )
|
115
|
+
data = value.data.to_i
|
116
|
+
value.set( msg, 100 ) if data < 100
|
117
|
+
value.set( msg, 200 ) if data > 200
|
118
|
+
return true
|
119
|
+
end
|
120
|
+
|
121
|
+
=== Setting a HValue object in ruby.
|
122
|
+
Doing the change in ruby sets the client-side accordingly too and causes all client-bound value responders to receive the same data. automatically. The data is synchronized server-client after all server responders have responded to all triggers by the last client-server synchronization, so only the lastly set data of a value is sent to the client.
|
123
|
+
a_test_value.set( msg, 'this_wont_be_on_the_client' )
|
124
|
+
a_test_value.set( msg, ['neither','will','this','be',[true]] )
|
125
|
+
a_test_value.set( msg, { 'and' => 'this', 'also' => 'stays', 'in' => 'the', 'server' => [1,2,3,4] )
|
126
|
+
a_test_value.set( msg, 'this is the last one, this gets through' )
|
127
|
+
|
128
|
+
=== Binding a HValue responder in ruby. Causes the client-server synchronization to respond to all the bound methods.
|
129
|
+
class SomeTestPlugin < Plugin
|
130
|
+
def resp_one( msg, value )
|
131
|
+
puts "got data: #{value.data.inspect}"
|
132
|
+
return true
|
133
|
+
end
|
134
|
+
def resp_two( msg, value )
|
135
|
+
revert_to = "foo foo"
|
136
|
+
value.set( msg, revert_to )
|
137
|
+
puts "got the data too, but changed it to: #{value.data.inspect}"
|
138
|
+
return true
|
139
|
+
end
|
140
|
+
def define_responders( msg )
|
141
|
+
...
|
142
|
+
# the @name is the name of the plugin bundle
|
143
|
+
a_test_value.bind( @name, :resp_one )
|
144
|
+
a_test_value.bind( @name, :resp_two )
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
=== Referring to the value manually in the client, using the server
|
149
|
+
This references the value by id in the client scope and binds it to a new instance of the +HTextArea+ component with its own dedicated app instance.
|
150
|
+
msg.reply( "COMM.Values.values[#{a_test_value.value_id.to_json}].bind( HTextArea.nu( [0,0,100,100], HApplication.nu() ) );" )
|
151
|
+
|
152
|
+
=== Storing a reference to a variable in the session scope.
|
153
|
+
Allows you to retrieve this session-specific object in any scope with access to the same session's +msg+, even in other requests (and server restarts, when a {RSence::SessionStorage SessionStorage} database connection is enabled).
|
154
|
+
get_ses(msg)[:the_test_name] = a_test_value
|
155
|
+
|
156
|
+
=== Freeing a HValue responder, won't be used as a responder anymore
|
157
|
+
a_test_value.release( @name, :resp_two )
|
158
|
+
|
159
|
+
=== Freeing all responders of a value
|
160
|
+
a_test_value.release_all
|
161
|
+
|
162
|
+
=== Destructing a value, releases all bindings on both client and server and destructs the client representation too
|
163
|
+
a_test_value.die!( msg )
|
@@ -10,8 +10,7 @@
|
|
10
10
|
LOAD(
|
11
11
|
function(){
|
12
12
|
COMM.urlResponder=COMM.URLResponder.nu();
|
13
|
-
|
14
|
-
COMM.Transporter.url=HCLIENT_HELLO;
|
13
|
+
COMM.Transporter.url=COMM.Transporter.HelloUrl;
|
15
14
|
COMM.Transporter.stop=false;
|
16
15
|
COMM.Transporter.sync();
|
17
16
|
}
|
File without changes
|
File without changes
|
@@ -14,6 +14,7 @@
|
|
14
14
|
** standard package url.
|
15
15
|
***/
|
16
16
|
|
17
|
+
//var//RSence.Foundation
|
17
18
|
COMM.JSLoader = HClass.extend({
|
18
19
|
|
19
20
|
/** = Description
|
@@ -97,14 +98,11 @@ COMM.JSLoader = HClass.extend({
|
|
97
98
|
}
|
98
99
|
});
|
99
100
|
|
100
|
-
/** -- Global reference ++ **/
|
101
|
-
JSLoader = COMM.JSLoader;
|
102
|
-
|
103
101
|
// Makes the standard jsLoader instance based on the client base url
|
104
102
|
// of the server when the page is loaded.
|
105
103
|
LOAD(
|
106
104
|
function(){
|
107
|
-
COMM.jsLoader = COMM.JSLoader.nu(
|
105
|
+
COMM.jsLoader = COMM.JSLoader.nu( COMM.ClientPrefix + '/js/' );
|
108
106
|
// backwards compatibility aliases:
|
109
107
|
jsLoader = COMM.jsLoader;
|
110
108
|
}
|
File without changes
|
File without changes
|
@@ -15,17 +15,18 @@
|
|
15
15
|
** The server expects this exact algorithm and refuses to serve unless
|
16
16
|
** the SHA1 hash sum of the keys matches.
|
17
17
|
**
|
18
|
-
** Uses a +
|
18
|
+
** Uses a +SHA+ instance for generation.
|
19
19
|
**
|
20
|
-
** +COMM.Queue+ runs as a single instance,
|
20
|
+
** +COMM.Queue+ runs as a single instance, don't try to reconstruct it.
|
21
21
|
***/
|
22
|
+
//var//RSence.COMM
|
22
23
|
COMM.Session = HClass.extend({
|
23
24
|
|
24
25
|
/** The constructor takes no arguments.
|
25
26
|
**/
|
26
27
|
constructor: function(){
|
27
28
|
var _this = this;
|
28
|
-
_this.sha =
|
29
|
+
_this.sha = SHA.nu(8);
|
29
30
|
_this.sha_key = _this.sha.hexSHA1(((new Date().getTime())*Math.random()*1000).toString());
|
30
31
|
_this.ses_key = '0:.o.:'+_this.sha_key;
|
31
32
|
_this.req_num = 0;
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
@@ -13,8 +13,11 @@
|
|
13
13
|
** It's limited to 24px height by the default theme, because
|
14
14
|
** it's much simpler to render that way.
|
15
15
|
***/
|
16
|
+
var//RSence.Controls
|
16
17
|
HButton = HControl.extend({
|
18
|
+
|
17
19
|
componentName: 'button',
|
20
|
+
|
18
21
|
/** = Description
|
19
22
|
* setStyle function for button.
|
20
23
|
*
|
@@ -23,8 +26,10 @@ HButton = HControl.extend({
|
|
23
26
|
ELEM.setStyle(this.markupElemIds.label,_name,_value);
|
24
27
|
return this;
|
25
28
|
}
|
29
|
+
|
26
30
|
});
|
27
31
|
|
32
|
+
|
28
33
|
/*** = Description
|
29
34
|
** Simple HButton extension, operates on its value so it's useful
|
30
35
|
** for sending button clicks to the server and the like.
|
@@ -36,6 +41,7 @@ HButton = HControl.extend({
|
|
36
41
|
** +1+:: Disabled, clicked
|
37
42
|
** +Other+:: Disabled, not clickable, not clicked
|
38
43
|
***/
|
44
|
+
var//RSence.Controls
|
39
45
|
HClickButton = HButton.extend({
|
40
46
|
|
41
47
|
defaultEvents: {
|
@@ -58,6 +64,9 @@ HClickButton = HButton.extend({
|
|
58
64
|
this.setValue(1);
|
59
65
|
}
|
60
66
|
}
|
67
|
+
|
61
68
|
});
|
62
69
|
|
63
|
-
|
70
|
+
var//RSence.Controls
|
71
|
+
HClickValueButton = HClickButton;
|
72
|
+
|
@@ -10,6 +10,7 @@
|
|
10
10
|
** Simple checkbox component, toggles the value of
|
11
11
|
** itself between true and false.
|
12
12
|
***/
|
13
|
+
var//RSence.Controls
|
13
14
|
HCheckbox = HButton.extend({
|
14
15
|
componentName: 'checkbox',
|
15
16
|
|
@@ -44,4 +45,5 @@ HCheckbox = HButton.extend({
|
|
44
45
|
}
|
45
46
|
});
|
46
47
|
//-- Alias for some users:++
|
48
|
+
var//RSence.Controls
|
47
49
|
HCheckBox = HCheckbox;
|