rsence-pre 2.1.0.21 → 2.1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/INSTALL.rdoc +61 -46
- data/README.rdoc +17 -1
- data/VERSION +1 -1
- data/conf/rsence_command_strings.yaml +16 -16
- data/js/comm/sessionwatcher/sessionwatcher.js +5 -4
- data/js/comm/transporter/transporter.js +62 -4
- data/js/comm/values/values.js +62 -0
- data/js/controls/button/themes/default/button.css +7 -7
- data/js/controls/imageview/imageview.js +15 -6
- data/js/controls/stringview/stringview.js +16 -2
- data/js/controls/textcontrol/textcontrol.js +56 -3
- data/js/core/elem/elem.js +38 -12
- data/js/datetime/timesheet/timesheet.js +141 -32
- data/js/datetime/timesheet_item/timesheet_item.js +82 -22
- data/js/foundation/application/application.js +10 -4
- data/js/foundation/control/control.js +5 -3
- data/js/foundation/control/dyncontrol/dyncontrol.js +17 -3
- data/js/foundation/control/eventresponder/eventresponder.js +31 -2
- data/js/foundation/eventmanager/eventmanager.js +202 -74
- data/js/foundation/json_renderer/json_renderer.js +5 -2
- data/js/foundation/system/system.js +13 -11
- data/js/foundation/view/morphanimation/morphanimation.js +9 -5
- data/js/foundation/view/view.js +22 -10
- data/js/lists/propertylist/propertylist.js +5 -0
- data/js/menus/minimenu/minimenu.js +3 -8
- data/lib/conf/default.rb +0 -3
- data/lib/http/broker.rb +6 -5
- data/lib/http/rackup.rb +3 -3
- data/lib/http/response.rb +28 -2
- data/lib/session/msg.rb +30 -18
- data/lib/transporter/transporter.rb +4 -0
- data/lib/values/hvalue.rb +4 -134
- data/lib/values/valuemanager.rb +36 -22
- data/plugins/client_pkg/lib/client_pkg_serve.rb +195 -152
- data/plugins/main/main.rb +8 -10
- data/plugins/ticket/lib/common.rb +4 -4
- data/plugins/ticket/lib/favicon.rb +1 -1
- data/plugins/ticket/lib/rsrc.rb +1 -1
- data/plugins/ticket/lib/upload.rb +2 -2
- data/plugins/ticket/ticket.rb +3 -3
- data/setup/welcome/gui/welcome.yaml +1 -1
- metadata +10 -11
- data/lib/util/ruby19_fixes.rb +0 -18
data/INSTALL.rdoc
CHANGED
@@ -4,21 +4,33 @@ If you already have a working ruby environment and know what to do, the easiest
|
|
4
4
|
|
5
5
|
gem install rsence
|
6
6
|
|
7
|
-
|
7
|
+
If you have an older version of rsence installed, it's be automatically
|
8
|
+
updated along other gems when you run:
|
8
9
|
|
10
|
+
gem update
|
9
11
|
|
10
|
-
|
12
|
+
For system-wide installs, run the gem command as a superuser. A common way
|
13
|
+
for doing so is prefixing the command with sudo.
|
14
|
+
|
15
|
+
RSence 2.1 is verified to be compatible with Rubinius. To use RSence with
|
16
|
+
Rubinius, just use "rbx gem" instead of just "gem" for installation.
|
17
|
+
|
18
|
+
The following instructions contain detailed steps for installing Ruby, RSence
|
19
|
+
and its dependencies on each supported platform:
|
20
|
+
|
21
|
+
|
22
|
+
== System Dependencies
|
11
23
|
|
12
24
|
This is a list of system level dependencies. You only need to do this step once; follow the steps of for your target operating system.
|
13
25
|
|
14
|
-
===
|
26
|
+
=== Mac OS X
|
15
27
|
|
16
|
-
====
|
28
|
+
==== Mac OS X 10.6
|
17
29
|
|
18
30
|
* Install *XCode*[http://developer.apple.com/mac/] to get the essential development tools, like compilers.
|
19
31
|
* Proceed to section 3.0
|
20
32
|
|
21
|
-
====
|
33
|
+
==== Mac OS X 10.4 and 10.5
|
22
34
|
|
23
35
|
This step applies only to Mac OS X 10.4 "Tiger" and 10.5 "Leopard". The default ruby build of these versions of Mac OS X is somewhat broken.
|
24
36
|
|
@@ -29,7 +41,7 @@ This step applies only to Mac OS X 10.4 "Tiger" and 10.5 "Leopard". The default
|
|
29
41
|
sudo port install rb-rubygems
|
30
42
|
* Proceed to section 3.0
|
31
43
|
|
32
|
-
===
|
44
|
+
=== Debian and Ubuntu Linux
|
33
45
|
|
34
46
|
This step applies only to Debian, Ubuntu and similar Linux distributions.
|
35
47
|
|
@@ -37,28 +49,27 @@ This step applies only to Debian, Ubuntu and similar Linux distributions.
|
|
37
49
|
sudo apt-get install build-essential ruby-full rubygems rake
|
38
50
|
* Proceed to section 3.0
|
39
51
|
|
40
|
-
===
|
52
|
+
=== Microsoft Windows
|
41
53
|
|
42
54
|
RSence works just fine on Windows too, with a few limitations.
|
43
55
|
Windows compatibility has been officially tested on Windows XP SP3 and Windows 7 (64 bit).
|
44
56
|
|
45
|
-
====
|
46
|
-
* Download Ruby 1.8.7-
|
57
|
+
==== Install ruby 1.8.7:
|
58
|
+
* Download Ruby 1.8.7-p302 from http://rubyinstaller.org/downloads
|
47
59
|
* Run the downloaded exe to install ruby
|
48
60
|
* In the installation and destination prompt, check these options:
|
49
61
|
* Add Ruby executables to your PATH
|
50
62
|
* Associate .rb and .rbw files with this Ruby installation
|
51
|
-
* Download and Install the Development Kit from http://rubyinstaller.org/downloads
|
52
|
-
* Extract the included directories into the directory where you installed ruby.
|
53
|
-
* It's +C:\ruby+ by default.
|
63
|
+
* Download and Install the Development Kit (DevKit-tdm-...-sfx.exe) from http://rubyinstaller.org/downloads
|
64
|
+
* Extract the included directories into the directory where you installed ruby, which is +C:\ruby+ by default.
|
54
65
|
|
55
|
-
====
|
66
|
+
==== Install RSence
|
56
67
|
* In the command prompt, run:
|
57
68
|
gem update --system
|
58
69
|
gem install rsence
|
59
70
|
rsence help
|
60
71
|
|
61
|
-
====
|
72
|
+
==== Create RSence environment
|
62
73
|
|
63
74
|
Replace the +\my_projects+ path with the path to the directory where you want to run or develop your projects. Likewise, replace +my_project+ with something descriptive for your project.
|
64
75
|
|
@@ -72,7 +83,7 @@ Replace the +\my_projects+ path with the path to the directory where you want to
|
|
72
83
|
* If the address is +0.0.0.0+, enter +127.0.0.1+ instead.
|
73
84
|
* Using just defaults, the following URL should work: http://127.0.0.1:8001
|
74
85
|
|
75
|
-
====
|
86
|
+
==== Windows limitations
|
76
87
|
If you install the sqlite dll and the sqlite3-ruby gem, you'll gain persistent sessions and this warning message will disappear:
|
77
88
|
`Warning: Session database is not available. Can't use persistent sessions`
|
78
89
|
|
@@ -83,7 +94,7 @@ Backgrounding on Windows is not yet implemented, because POSIX signals are not f
|
|
83
94
|
However, if you run RSence under Cygwin, everything should work like on a UNIX machines.
|
84
95
|
|
85
96
|
|
86
|
-
===
|
97
|
+
=== Other UNIX / Linux systems:
|
87
98
|
|
88
99
|
This step applies to systems not listed above.
|
89
100
|
|
@@ -98,13 +109,13 @@ You'll have to figure out how to install the dependencies on your own, but gener
|
|
98
109
|
* gcc, make etc.
|
99
110
|
|
100
111
|
|
101
|
-
==
|
112
|
+
== Ruby Library Dependencies
|
102
113
|
|
103
114
|
The `rsence` gem depends on the dummy `rsence-deps` gem, which depends on all essential dependencies of RSence.
|
104
115
|
Optionally, you probably want at a database and a database adapter supported by Sequel[http://sequel.rubyforge.org]
|
105
116
|
This not only enables SessionStorage (persistent sessions between RSence restarts), but some plugins written for RSence depend on at least Sqlite.
|
106
117
|
|
107
|
-
===
|
118
|
+
=== Detailed list of ruby libraries used
|
108
119
|
|
109
120
|
* *rake*[http://rake.rubyforge.org]
|
110
121
|
* Ruby build tool
|
@@ -134,23 +145,27 @@ This not only enables SessionStorage (persistent sessions between RSence restart
|
|
134
145
|
* Some plugins depend on it directly.
|
135
146
|
|
136
147
|
|
137
|
-
==
|
148
|
+
== Setting up RSence
|
138
149
|
|
139
150
|
The primary installation method of RSence is via RubyGems.
|
140
151
|
|
141
152
|
To ensure your RubyGems is up-to-date, run:
|
142
153
|
sudo gem update --system
|
154
|
+
* gem update --system is disabled in Debian based systems, such as Ubuntu. It's okay to skip on these systems.
|
143
155
|
|
144
156
|
Even if RubyGems is up-to-date, ensure your installed gems are up-to-date, some of these are updated frequently. This will also update RSence release versions to the most recent version, if installed.
|
145
157
|
sudo gem update
|
146
158
|
|
147
|
-
===
|
159
|
+
=== Install RSence
|
148
160
|
|
149
161
|
This will install RSence via RubyGems, the preferred method. All dependencies are installed too, except for the ones you already might have installed.
|
150
162
|
gem install rsence
|
151
163
|
|
164
|
+
Debian/Ubuntu users need to include /var/lib/gems/1.8/bin into PATH either by adding it directly there or by making a symbolic link:
|
165
|
+
sudo ln -s /var/lib/gems/1.8/bin/rsence /usr/local/bin/rsence
|
166
|
+
|
152
167
|
Optionally, you might want to contribute to RSence development, just clone or fork the GIT repository on Github:
|
153
|
-
|
168
|
+
http://github.com/rsence/rsence
|
154
169
|
|
155
170
|
When installed, ensure it works by exploring the help of the 'rsence' command, like:
|
156
171
|
rsence
|
@@ -160,9 +175,9 @@ When installed, ensure it works by exploring the help of the 'rsence' command, l
|
|
160
175
|
rsence help init
|
161
176
|
etc..
|
162
177
|
|
163
|
-
===
|
178
|
+
=== Setting up
|
164
179
|
|
165
|
-
====
|
180
|
+
==== Creating a RSence project environment
|
166
181
|
|
167
182
|
To set up an environment for your RSence project, use the init command. In this example '/home/me/projects' is assumed as your project directory. Replace that with a path that matches your own environment. The RSence project directory must either be empty or will be created automatically.
|
168
183
|
rsence init /home/me/projects/my_first_rsence_project
|
@@ -200,29 +215,29 @@ You may edit the conf/config.yaml at a later time to change these settings. The
|
|
200
215
|
|
201
216
|
Any differences in your local configuration replace the default. If the configuration option type is an Array, the defaults are not replaced, the defaults are appended to. If your configuration only has partial items of a Hash defined, only those are applied to the default.
|
202
217
|
|
203
|
-
====
|
218
|
+
==== Start RSence in the development mode with logs printed to the standard output:
|
204
219
|
|
205
220
|
The debug/development mode has the most verbose output and is the intended mode of RSence for development. Changes in your code are automatically (re)loaded and the javascript is not obfuscated or minimized in any way. Values also have human-readable id's.
|
206
221
|
cd /home/me/projects/my_first_rsence_project
|
207
222
|
rsence run -df
|
208
223
|
|
209
|
-
====
|
224
|
+
==== Open a web browser
|
210
225
|
* By default, the RSence listens on port 8001
|
211
226
|
* To test it, open the address http://127.0.0.1:8001/
|
212
227
|
* If everything works:
|
213
228
|
* A welcome message is displayed
|
214
229
|
* Check the "Don't show again" checkbox and click the "Close" button to make the 'welcome' plugin uninstall itself.
|
215
230
|
|
216
|
-
====
|
231
|
+
==== Stop RSence
|
217
232
|
Just press CTRL-C in the terminal, if RSence was started using the 'run' command.
|
218
233
|
|
219
234
|
|
220
|
-
==
|
235
|
+
== Modes of operation
|
221
236
|
|
222
237
|
RSence supports two main modes of operation: in the foreground and in the background. Each have various options. Use the 'rsence help run' and 'rsence help start' commands to read more about them.
|
223
238
|
|
224
239
|
|
225
|
-
===
|
240
|
+
=== Starting RSence as a foreground process.
|
226
241
|
|
227
242
|
The 'run' mode is well suited for development. Especially when combined with the -d and -f options.
|
228
243
|
|
@@ -238,26 +253,26 @@ Starting in foreground mode with debug and logging in foreground:
|
|
238
253
|
Stopping in foreground mode: Press CTRL-C
|
239
254
|
|
240
255
|
|
241
|
-
===
|
256
|
+
=== Starting RSence as a daemon (background mode).
|
242
257
|
|
243
258
|
In the background mode, standard output and standard errors are logged in the 'log' directory of your project and the PID file is written in the 'run' directory. This mode of operation is best suited for production deployment and it's not available on Microsoft Windows, because full POSIX compliance is not available on Windows.
|
244
259
|
rsence start
|
245
260
|
|
246
|
-
===
|
261
|
+
=== Stopping RSence in background mode
|
247
262
|
rsence stop
|
248
263
|
|
249
|
-
===
|
264
|
+
=== Checking RSence status in background mode
|
250
265
|
rsence status
|
251
266
|
|
252
|
-
===
|
267
|
+
=== To store the RSence sessions into the session database while in background mode
|
253
268
|
rsence save
|
254
269
|
|
255
270
|
The sessions are also stored when stopping and restarting RSence. Use the 'save' command regularly from a cron script or equivalent in a production environment.
|
256
271
|
|
257
|
-
===
|
272
|
+
=== Restarting RSence in background mode
|
258
273
|
rsence restart
|
259
274
|
|
260
|
-
===
|
275
|
+
=== Re-setting the sessions
|
261
276
|
This is needed only, if the session storage becomes corrupt in a development environment (changing value definitions and such). This invalidates all ongoing sessions.
|
262
277
|
Just apply the --reset-sessions option after the run, start or restart command in the command prompt.
|
263
278
|
rsence restart --reset-sessions
|
@@ -267,11 +282,11 @@ The '-r' switch is equivalent to '--reset-sessions'
|
|
267
282
|
*NOTE: All the sessions currently connected clients are invalidated and need to reload the page*
|
268
283
|
|
269
284
|
|
270
|
-
===
|
285
|
+
=== Running in development mode
|
271
286
|
Just apply the -d option after the *run*, *start* or *restart* command in the command prompt.
|
272
287
|
rsence restart -d
|
273
288
|
|
274
|
-
====
|
289
|
+
==== What does development mode do?
|
275
290
|
* Plugins are (re)loaded automatically in the background, if they are changed, disabled, added or removed.
|
276
291
|
* This is also enabled with the -a switch (--auto-update)
|
277
292
|
* Javascript packages are automatically re-built, if they are changed.
|
@@ -279,22 +294,22 @@ Just apply the -d option after the *run*, *start* or *restart* command in the co
|
|
279
294
|
* Much more verbose logging
|
280
295
|
* Code obfuscation / minimizing options are turned off.
|
281
296
|
|
282
|
-
===
|
297
|
+
=== Other command-line options
|
283
298
|
Just run this command to see the available options:
|
284
299
|
rsence help <command>
|
285
300
|
example:
|
286
301
|
rsence help run
|
287
302
|
|
288
|
-
===
|
303
|
+
=== Running RSence using rackup
|
289
304
|
rackup conf/config.ru
|
290
305
|
|
291
|
-
===
|
306
|
+
=== Running RSence using unicorn
|
292
307
|
unicorn conf/config.ru -c conf/unicorn.conf
|
293
308
|
|
294
309
|
|
295
|
-
==
|
310
|
+
== Plugin installation
|
296
311
|
|
297
|
-
If you followed the previous steps, you are ready to
|
312
|
+
If you followed the previous steps, you are ready to install some plugins.
|
298
313
|
* In development mode (see 4.4.), plugins are (re/un)loaded when:
|
299
314
|
* Adding a new plugin into the plugins directory
|
300
315
|
* Removing a plugin from the plugins directory
|
@@ -302,25 +317,25 @@ If you followed the previous steps, you are ready to deploy some software.
|
|
302
317
|
* Enabling a plugin by removing a file or folder named "disabled" in the plugin's bundle directory
|
303
318
|
* The plugin's ruby or yaml files are changed.
|
304
319
|
|
305
|
-
* In production mode, a RSence restart is required (see 4.4.), unless running with the '-a' ('--auto-update') option enabled. Enabling it is a good idea for production environments where the code is updated frequently. It enables nearly zero downtime, if code updates are thoroughly tested before being
|
320
|
+
* In production mode, a RSence restart is required (see 4.4.), unless running with the '-a' ('--auto-update') option enabled. Enabling it is a good idea for production environments where the code is updated frequently. It enables nearly zero downtime, if code updates are thoroughly tested before being upgraded.
|
306
321
|
|
307
322
|
* By default, the "plugins" directory in the "rsence" directory is the only plugin directory.
|
308
323
|
* Edit the configuration file to enable other directories.
|
309
324
|
* Sample plugins are available at http://rsence.org/
|
310
325
|
|
311
326
|
|
312
|
-
===
|
327
|
+
=== Installing plugins
|
313
328
|
Copy or move a plugin bundle directory into the "plugins" directory.
|
314
329
|
|
315
|
-
===
|
330
|
+
=== Un-Installing plugins
|
316
331
|
Move a plugin bundle out of the the "plugins" directory.
|
317
332
|
|
318
|
-
===
|
333
|
+
=== Temporarily disabling a plugin
|
319
334
|
Create an empty file named "disabled" in the plugin bundle to disable it.
|
320
335
|
touch plugins/legacy/disabled
|
321
336
|
|
322
337
|
|
323
|
-
==
|
338
|
+
== Getting more information
|
324
339
|
|
325
340
|
* Explore http://rsence.org/
|
326
341
|
* Join our chat room on IRC (IRCNet and FreeNode):
|
data/README.rdoc
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
RSence is a RIA framework designed for responsive GUI applications on the web; it's implemented as a hybrid Ruby - Javascript system. The server is written in Ruby and C. Applications are installed as plugin bundles. The GUI framework is written in Javascript; it doesn't strictly require the server, but has extensive transport support with automatic data synchronization with the server. User interfaces are usually described in structured view trees represented by YAML data structures, which are automatically converted for rendering in the client.
|
7
7
|
|
8
|
-
Javascript knowledge is required only when creating custom client-driven functionality; basic understanding of the YAML GUITree structures is enough in most cases. Likewise, no Ruby knowledge is needed if you want to create stand-alone Javascript applitations. Javascript component themes are easily created with just basic web designer skills. Data API's are easy to link no matter what language is used to create them. Skills in your organization are easily combined for various parts of larger applications.
|
8
|
+
Javascript knowledge is required only when creating custom client-driven functionality; basic understanding of the YAML GUITree structures is enough in most cases. Likewise, no prior Ruby knowledge is needed if you want to create stand-alone Javascript applitations. Javascript component themes are easily created with just basic web designer skills. Data API's are easy to link no matter what language is used to create them. Skills in your organization are easily combined for various parts of larger applications.
|
9
9
|
|
10
10
|
RSence is not primarily targeted as an engine for plain old html web sites, there are plenty of other tools for that purpose and RSence is easily integrated with them in various ways.
|
11
11
|
|
@@ -87,6 +87,22 @@ Each command-line tool command takes a number of options, the +env_dir+ argument
|
|
87
87
|
|
88
88
|
For more detailed installation and usage instructions, read the {file:INSTALL Install Guide} document.
|
89
89
|
|
90
|
+
=== The bleeding edge (for developers)
|
91
|
+
RSence comes in two varieties:
|
92
|
+
1. rsence : The stable (no major new featuers, just bugfixes) release.
|
93
|
+
2. rsence-pre : The active development snaphot released periodically.
|
94
|
+
|
95
|
+
Both varieties can be installed simultaneously and it's suggested to use
|
96
|
+
the stable "rsence" package for production installations and to use the
|
97
|
+
"rsence-pre" package for development purposes, because the RSence crew
|
98
|
+
can't possibly test each and every application available. It's your
|
99
|
+
responsibility as a developer to report any RSence issues effecting your
|
100
|
+
software. The sooner reported, the better; it ensures better release
|
101
|
+
versions.
|
102
|
+
|
103
|
+
To use "rsence-pre", install the "rsence-pre" gem and use the "rsence-pre"
|
104
|
+
command instead of the "rsence" command.
|
105
|
+
|
90
106
|
=== Licensing and commercial support options
|
91
107
|
* {file:LICENSE.txt *GPL*} version 3 by default.
|
92
108
|
* Riassence[http://riassence.com/] Inc. provides commercial support, custom licensing arrangements and various other services.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.0.
|
1
|
+
2.1.8.0.pre
|
@@ -421,35 +421,35 @@
|
|
421
421
|
|
422
422
|
:version: |+
|
423
423
|
usage: 'rsence version'
|
424
|
-
|
424
|
+
|
425
425
|
The 'version' command simply outputs the version number of RSence.
|
426
|
-
|
427
|
-
RSence follows the
|
428
|
-
scheme. The scheme is defined like: major.minor[.maintenance
|
429
|
-
|
426
|
+
|
427
|
+
RSence follows the common three-numbered sequence-based version identification
|
428
|
+
scheme. The scheme is defined like: major.minor[.maintenance]
|
429
|
+
|
430
430
|
The major number designates major changes in functionality, sometimes limiting
|
431
431
|
backwards compatibility with software written for previous versions.
|
432
|
-
|
432
|
+
|
433
433
|
The minor number designates minor changes in functionality, like minor or
|
434
434
|
moderate changes in functionality that usually don't impact backwards
|
435
435
|
compatibilty of software written for a previous release with the same major
|
436
436
|
version.
|
437
|
-
|
437
|
+
|
438
438
|
The maintenance number designates bug fixes and other minimal changes to
|
439
439
|
the release. In a maintenance number change, no new features are introduced.
|
440
|
-
|
440
|
+
|
441
441
|
The package number is a sequence used for the package release. Rubygems
|
442
442
|
requires an unique version for each gem released, so pre-releases usually
|
443
443
|
occupy the first package numbers of any release.
|
444
|
-
|
445
|
-
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
444
|
+
|
445
|
+
RSence also comes in a '-pre' variety. Consider RSence prereleases as
|
446
|
+
anything between 'Alpha', 'Beta' and 'Release Candidate'. The prereleases
|
447
|
+
are have a fourth number in their version number string. That number
|
448
|
+
is the 'package' or 'build' number.
|
449
|
+
|
450
450
|
Version number conventions in written text should include both major and
|
451
451
|
minor version numbers prefixed with 'RSence'. The maintennance number
|
452
452
|
is usally not mentioned unless an issue is fix or such is discussed.
|
453
|
-
|
454
|
-
|
453
|
+
|
454
|
+
Example: "RSence 2.0 has undergone some major refactoring since 1.2.1"
|
455
455
|
|
@@ -25,14 +25,15 @@
|
|
25
25
|
COMM.SessionWatcher = HApplication.extend({
|
26
26
|
constructor: function( _timeoutSecs, _sesTimeoutValueId ){
|
27
27
|
|
28
|
-
// onIdle is called when HSystem's ticker count % 100 == 0
|
29
|
-
// this means it's 5 seconds with HSystemTickerInterval 50
|
30
|
-
this.base(10, 'SesWatcher');
|
31
|
-
|
32
28
|
// gets the HValue represented by
|
33
29
|
// sesTimeoutValueId (:client_time in server)
|
34
30
|
this.sesTimeoutValue = COMM.Values.values[_sesTimeoutValueId];
|
35
31
|
this.timeoutSecs = _timeoutSecs;
|
32
|
+
|
33
|
+
// onIdle is called when HSystem's ticker count % 100 == 0
|
34
|
+
// this means it's 5 seconds with HSystemTickerInterval 50
|
35
|
+
this.base(10, 'SesWatcher');
|
36
|
+
|
36
37
|
},
|
37
38
|
|
38
39
|
// Tells the server the client's current time
|
@@ -27,7 +27,8 @@ COMM.Transporter = HApplication.extend({
|
|
27
27
|
**/
|
28
28
|
constructor: function(){
|
29
29
|
var _this = this;
|
30
|
-
|
30
|
+
_this._detectNativeJSONSupport();
|
31
|
+
_this.serverLostMessage = 'Server Connection Lost: Reconnecting...';
|
31
32
|
_this.label = 'Transporter';
|
32
33
|
_this.url = false;
|
33
34
|
_this.busy = false;
|
@@ -37,6 +38,17 @@ COMM.Transporter = HApplication.extend({
|
|
37
38
|
_this._busyFlushTimeout = false;
|
38
39
|
_this.base(1);
|
39
40
|
},
|
41
|
+
|
42
|
+
_detectNativeJSONSupport: function(){
|
43
|
+
if(window['JSON']){
|
44
|
+
var
|
45
|
+
_JSON = window.JSON,
|
46
|
+
_fun = 'function';
|
47
|
+
if((typeof _JSON['parse'] === _fun) && (typeof _JSON['stringify'] === _fun)){
|
48
|
+
this.parseResponseArray = this._nativeParseResponseArray;
|
49
|
+
}
|
50
|
+
}
|
51
|
+
},
|
40
52
|
|
41
53
|
/** Tries to (re)connect to the server as often as possible,
|
42
54
|
* mandated essentially by the priority of its
|
@@ -64,6 +76,49 @@ COMM.Transporter = HApplication.extend({
|
|
64
76
|
COMM.Values._encodeString(_this._clientEvalError):'';
|
65
77
|
},
|
66
78
|
|
79
|
+
parseResponseArray: function( _responseText ){
|
80
|
+
var _arr = eval( _responseText );
|
81
|
+
return _arr;
|
82
|
+
},
|
83
|
+
|
84
|
+
_nativeParseResponseArray: function( _responseText ){
|
85
|
+
var _arr = JSON.parse( _responseText );
|
86
|
+
return _arr;
|
87
|
+
},
|
88
|
+
|
89
|
+
setValues: function( _values ){
|
90
|
+
if(!_values instanceof Object){
|
91
|
+
console.log("Invalid values block: ", _values );
|
92
|
+
return;
|
93
|
+
}
|
94
|
+
var
|
95
|
+
i = 0,
|
96
|
+
_valueManager = COMM.Values,
|
97
|
+
_itemtype,
|
98
|
+
_valueId,
|
99
|
+
_valueData;
|
100
|
+
if(_values['new'] instanceof Array){
|
101
|
+
for(i=0;i<_values['new'].length;i++){
|
102
|
+
_valueId = _values['new'][i][0];
|
103
|
+
_valueData = _values['new'][i][1];
|
104
|
+
_valueManager.create( _valueId, _valueData );
|
105
|
+
}
|
106
|
+
}
|
107
|
+
if(_values['set'] instanceof Array){
|
108
|
+
for(i=0;i<_values['set'].length;i++){
|
109
|
+
_valueId = _values['set'][i][0];
|
110
|
+
_valueData = _values['set'][i][1];
|
111
|
+
_valueManager.s( _valueId, _valueData );
|
112
|
+
}
|
113
|
+
}
|
114
|
+
if(_values['del'] instanceof Array){
|
115
|
+
for(i=0;i<_values['del'].length;i++){
|
116
|
+
_valueId = _values['del'][i];
|
117
|
+
_valueManager.del( _valueId );
|
118
|
+
}
|
119
|
+
}
|
120
|
+
},
|
121
|
+
|
67
122
|
/** = Description
|
68
123
|
* Handles synchronization responses.
|
69
124
|
*
|
@@ -83,10 +138,11 @@ COMM.Transporter = HApplication.extend({
|
|
83
138
|
_this.failure(resp);
|
84
139
|
return;
|
85
140
|
}
|
86
|
-
var _responseArray =
|
87
|
-
i =
|
141
|
+
var _responseArray = _this.parseResponseArray(resp.X.responseText),
|
142
|
+
i = 2,
|
88
143
|
_responseArrayLen = _responseArray.length,
|
89
144
|
_sesKey = _responseArray[0],
|
145
|
+
_values = _responseArray[1],
|
90
146
|
_session = COMM.Session,
|
91
147
|
_queue = COMM.Queue;
|
92
148
|
if(_sesKey === ''){
|
@@ -95,6 +151,7 @@ COMM.Transporter = HApplication.extend({
|
|
95
151
|
else {
|
96
152
|
_session.newKey(_sesKey);
|
97
153
|
}
|
154
|
+
_this.setValues( _values );
|
98
155
|
for(;i<_responseArrayLen;i++){
|
99
156
|
try {
|
100
157
|
_queue.pushEval( _responseArray[i] );
|
@@ -123,7 +180,7 @@ COMM.Transporter = HApplication.extend({
|
|
123
180
|
failMessage: function(_title,_message){
|
124
181
|
var _this = COMM.Transporter,
|
125
182
|
_queue = COMM.Queue;
|
126
|
-
console.log('failMessage
|
183
|
+
console.log('failMessage title:',_title,', message:',_message);
|
127
184
|
_this.stop = true;
|
128
185
|
_queue.push(function(){jsLoader.load('default_theme');});
|
129
186
|
_queue.push(function(){jsLoader.load('controls');});
|
@@ -240,6 +297,7 @@ COMM.Transporter = HApplication.extend({
|
|
240
297
|
// console.log('sync.');
|
241
298
|
this.busy = true;
|
242
299
|
if(window['sesWatcher'] && window.sesWatcher['sesTimeoutValue']){
|
300
|
+
// Sets the value of the session watcher to the current time. It could cause an unnecessary re-sync poll immediately after this sync otherwise.
|
243
301
|
sesWatcher.sesTimeoutValue.set( new Date().getTime() );
|
244
302
|
}
|
245
303
|
var _this = this,
|
data/js/comm/values/values.js
CHANGED
@@ -322,6 +322,11 @@ COMM.Values = HClass.extend({
|
|
322
322
|
return _str;
|
323
323
|
},
|
324
324
|
|
325
|
+
_nativeEncode: function(_obj){
|
326
|
+
return JSON.stringify( _obj );
|
327
|
+
},
|
328
|
+
|
329
|
+
|
325
330
|
/** = Description
|
326
331
|
* Decodes a JSON object. Decodes url-encoded strings contained.
|
327
332
|
*
|
@@ -355,6 +360,29 @@ COMM.Values = HClass.extend({
|
|
355
360
|
return _obj;
|
356
361
|
},
|
357
362
|
|
363
|
+
_nativeDecode: function(_ibj){
|
364
|
+
var _obj, _type, _this = this;
|
365
|
+
if(_ibj !== null && _ibj !== undefined){
|
366
|
+
_type = _this.type(_ibj);
|
367
|
+
if(!_type){
|
368
|
+
return null;
|
369
|
+
}
|
370
|
+
switch(_type){
|
371
|
+
case 'b': _obj = _ibj; break;
|
372
|
+
case 'n': _obj = _ibj; break;
|
373
|
+
case 's': _obj = _this._decodeString(_ibj); break;
|
374
|
+
case 'd': _obj = _ibj; break;
|
375
|
+
case 'a': _obj = JSON.parse(_ibj); break;
|
376
|
+
case 'h': _obj = JSON.parse(_ibj); break;
|
377
|
+
default: _obj = null; break;
|
378
|
+
}
|
379
|
+
}
|
380
|
+
else {
|
381
|
+
return null;
|
382
|
+
}
|
383
|
+
return _obj;
|
384
|
+
},
|
385
|
+
|
358
386
|
/** = Description
|
359
387
|
* Makes a deep copy of the object.
|
360
388
|
*
|
@@ -408,6 +436,24 @@ COMM.Values = HClass.extend({
|
|
408
436
|
}
|
409
437
|
},
|
410
438
|
|
439
|
+
_nativeClone: function( _obj ){
|
440
|
+
if(_obj === null){
|
441
|
+
return null;
|
442
|
+
}
|
443
|
+
else if (_obj === undefined){
|
444
|
+
console.log('Undefined object, supplementing with null.');
|
445
|
+
return null;
|
446
|
+
}
|
447
|
+
if( (_obj instanceof Array) || (_obj instanceof Object) ){
|
448
|
+
// conversion via encoding/decoding via JSON string.
|
449
|
+
return JSON.parse( JSON.stringify( _obj ) );
|
450
|
+
}
|
451
|
+
else {
|
452
|
+
// no conversion needed (numbers, strings, booleans etc..)
|
453
|
+
return _obj;
|
454
|
+
}
|
455
|
+
},
|
456
|
+
|
411
457
|
/** = Description
|
412
458
|
* Returns an URI-encoded string representation of all the changed values to
|
413
459
|
* synchronize to the server.
|
@@ -431,9 +477,25 @@ COMM.Values = HClass.extend({
|
|
431
477
|
_syncValues[_id] = _value;
|
432
478
|
}
|
433
479
|
return encodeURIComponent(_this.encode(_syncValues));
|
480
|
+
},
|
481
|
+
|
482
|
+
_detectNativeJSONSupport: function(){
|
483
|
+
if(window['JSON']){
|
484
|
+
var
|
485
|
+
_JSON = window.JSON,
|
486
|
+
_fun = 'function';
|
487
|
+
if((typeof _JSON['parse'] === _fun) && (typeof _JSON['stringify'] === _fun)){
|
488
|
+
// console.log('Has native JSON support. Re-routing encode, decode and clone methods of COMM.Values...');
|
489
|
+
this.clone = this._nativeClone;
|
490
|
+
this.encode = this._nativeEncode;
|
491
|
+
// this.decode = this._nativeDecode;
|
492
|
+
}
|
493
|
+
}
|
434
494
|
}
|
435
495
|
});
|
436
496
|
|
497
|
+
COMM.Values._detectNativeJSONSupport();
|
498
|
+
|
437
499
|
// Backwards compatibility assignment for code that still
|
438
500
|
// uses HVM as a reference of the Value Manager:
|
439
501
|
HVM = COMM.Values;
|
@@ -25,7 +25,7 @@
|
|
25
25
|
}
|
26
26
|
|
27
27
|
.button_edge_left {
|
28
|
-
left: 0px; width:
|
28
|
+
left: 0px; width: 6px;
|
29
29
|
background-position: 0px 0px;
|
30
30
|
}
|
31
31
|
.disabled > .button_control > .button_edge_left {
|
@@ -39,21 +39,21 @@
|
|
39
39
|
}
|
40
40
|
|
41
41
|
.button_edge_right {
|
42
|
-
right: 0px; width:
|
43
|
-
background-position: -
|
42
|
+
right: 0px; width: 6px;
|
43
|
+
background-position: -42px 0px;
|
44
44
|
}
|
45
45
|
.disabled > .button_control > .button_edge_right {
|
46
|
-
background-position: -
|
46
|
+
background-position: -42px -144px;
|
47
47
|
}
|
48
48
|
.enabled > .button_control:hover > .button_edge_right {
|
49
|
-
background-position: -
|
49
|
+
background-position: -42px -48px;
|
50
50
|
}
|
51
51
|
.enabled > .button_control:active > .button_edge_right {
|
52
|
-
background-position: -
|
52
|
+
background-position: -42px -96px;
|
53
53
|
}
|
54
54
|
|
55
55
|
.button_center {
|
56
|
-
left:
|
56
|
+
left: 6px; right: 6px;
|
57
57
|
background-position: 0px -24px;
|
58
58
|
}
|
59
59
|
.disabled > .button_control > .button_center {
|