rsence-pre 3.0.0.8 → 3.0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/client/conf/client_pkg.yaml +6 -2
- data/client/js/comm/queue/queue.js +32 -44
- data/client/js/comm/transporter/transporter.js +24 -16
- data/client/js/comm/values/values.js +27 -15
- data/client/js/controls/button/button.coffee +14 -5
- data/client/js/controls/button/themes/default/button.css +4 -2
- data/client/js/controls/checkbox/checkbox.js +4 -4
- data/client/js/controls/dialogs/sheet/sheet.js +11 -11
- data/client/js/controls/dialogs/sheet/themes/default/sheet.html +1 -1
- data/client/js/controls/imageview/imageview.js +15 -15
- data/client/js/controls/numerictextcontrol/numerictextcontrol.coffee +32 -10
- data/client/js/controls/onoffbutton/onoffbutton.coffee +5 -5
- data/client/js/controls/progress/progressbar/progressbar.js +6 -7
- data/client/js/controls/progress/progressbar/themes/default/progressbar.css +4 -4
- data/client/js/controls/progress/progressbar/themes/default/progressbar.html +1 -2
- data/client/js/controls/sliders/slider/slider.js +74 -79
- data/client/js/controls/stepper/stepper.js +31 -31
- data/client/js/controls/stringview/stringview.js +20 -8
- data/client/js/controls/tab/tab.js +57 -63
- data/client/js/controls/tab/themes/default/tab.html +4 -1
- data/client/js/controls/textcontrol/textcontrol.coffee +13 -3
- data/client/js/controls/validatorview/validatorview.js +4 -4
- data/client/js/controls/window/window.js +43 -56
- data/client/js/core/class/class.js +25 -23
- data/client/js/core/elem/elem.coffee +8 -1
- data/client/js/core/rsence_ns/rsence_ns.coffee +6 -2
- data/client/js/core/util/util_methods/util_methods.coffee +57 -15
- data/client/js/datetime/calendar/calendar.coffee +196 -199
- data/client/js/datetime/calendar/themes/default/calendar.css +81 -159
- data/client/js/datetime/calendar/themes/default/calendar.html +9 -18
- data/client/js/datetime/datepicker/datepicker.coffee +18 -3
- data/client/js/datetime/datetimepicker/datetimepicker.coffee +6 -1
- data/client/js/datetime/datetimevalue/datetimevalue.coffee +194 -0
- data/client/js/datetime/momentjs/momentjs.js +310 -76
- data/client/js/datetime/timepicker/timepicker.coffee +6 -1
- data/client/js/datetime/timesheet/timesheet.js +59 -61
- data/client/js/foundation/control/control.js +45 -44
- data/client/js/foundation/control/controldefaults/controldefaults.js +13 -9
- data/client/js/foundation/control/dyncontrol/dyncontrol.js +45 -57
- data/client/js/foundation/control/eventresponder/eventresponder.js +97 -97
- data/client/js/foundation/control/valuematrix/valuematrix.js +13 -13
- data/client/js/foundation/eventmanager/eventmanager.coffee +50 -32
- data/client/js/foundation/geom/rect/rect.js +43 -32
- data/client/js/foundation/locale_settings/locale_settings.js +36 -25
- data/client/js/foundation/system/system.js +79 -67
- data/client/js/foundation/thememanager/thememanager.coffee +11 -1
- data/client/js/foundation/value/pullvalue/pullvalue.coffee +7 -0
- data/client/js/foundation/value/pushvalue/pushvalue.coffee +25 -0
- data/client/js/foundation/value/value.js +22 -15
- data/client/js/foundation/view/view.js +94 -55
- data/client/js/foundation/view/viewdefaults/viewdefaults.js +5 -1
- data/client/js/lists/listitems/listitems.js +26 -4
- data/client/js/menus/combobox/combobox.coffee +55 -0
- data/client/js/menus/minimenu/minimenu.js +61 -30
- data/client/js/menus/minimenu/themes/default/minimenu.css +1 -6
- data/client/js/menus/minimenu/themes/default/minimenu.html +5 -4
- data/client/js/menus/minimenuitem/minimenuitem.js +6 -6
- data/client/js/menus/popupmenu/themes/default/popupmenu.css +1 -6
- data/client/js/menus/popupmenu/themes/default/popupmenu.html +5 -4
- data/client/js/tables/table/table.coffee +109 -64
- data/client/js/tables/table/themes/default/table.css +4 -0
- data/lib/rsence/msg.rb +64 -64
- data/lib/rsence/plugins/plugin.rb +68 -52
- data/lib/rsence/session/sequel_sessionstorage.rb +5 -5
- data/lib/rsence/value.rb +79 -59
- data/plugins/client_pkg/lib/client_pkg_build.rb +5 -1
- data/plugins/client_pkg/lib/client_pkg_serve.rb +40 -32
- data/plugins/main/js/main.js +46 -28
- metadata +6 -8
- data/client/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
- data/client/js/datetime/calendar/themes/default/calendar_bg.png +0 -0
- data/client/js/datetime/calendar/themes/default/calendar_parts1.png +0 -0
- data/client/js/datetime/calendar/themes/default/calendar_parts2.png +0 -0
- data/client/js/datetime/datetimepicker/datetimepicker.js +0 -210
- data/client/js/datetime/datetimevalue/datetimevalue.js +0 -265
data/lib/rsence/value.rb
CHANGED
@@ -5,98 +5,102 @@ module RSence
|
|
5
5
|
# HValue is the model for client-server synchronized values.
|
6
6
|
# A value contains its payload {#data} and enough meta-data to define its behavior.
|
7
7
|
class HValue
|
8
|
-
|
8
|
+
|
9
9
|
# The validity of the data. Defaults to false, when the data comes from the client.
|
10
10
|
# @return [Boolean] True, when set by the server. False when initially set by the client. Also false, unless all responders return true.
|
11
11
|
attr_reader :is_valid
|
12
|
-
|
12
|
+
|
13
13
|
# @private Is true when changed by the server. Causes the ValueManager to send its client-side representation.
|
14
14
|
attr_reader :sync
|
15
|
-
|
15
|
+
|
16
16
|
# @private The unique ID of the value.
|
17
17
|
attr_reader :value_id
|
18
18
|
alias val_id value_id
|
19
|
-
|
19
|
+
|
20
20
|
# The payload data. Use {#set} to change.
|
21
21
|
attr_reader :data
|
22
|
-
|
22
|
+
|
23
23
|
# @private List of responders
|
24
24
|
attr_reader :members
|
25
|
-
|
25
|
+
|
26
26
|
# @private
|
27
27
|
attr_writer :is_valid
|
28
|
-
|
28
|
+
|
29
29
|
# @private
|
30
30
|
def value_id=(new_id)
|
31
31
|
@value_id = new_id
|
32
32
|
end
|
33
33
|
# @private
|
34
34
|
alias val_id= value_id=
|
35
|
-
|
35
|
+
|
36
36
|
alias valid is_valid
|
37
37
|
alias valid? is_valid
|
38
|
-
|
38
|
+
|
39
39
|
# @private Method for binding the value to the session data.
|
40
40
|
def add( msg )
|
41
|
-
|
41
|
+
|
42
42
|
# get the value storage from the session data
|
43
43
|
session_values = msg.session[:values][:by_id]
|
44
|
-
|
44
|
+
|
45
45
|
## Store the object here
|
46
46
|
session_values[ @value_id ] = self
|
47
|
-
|
47
|
+
|
48
48
|
## Sends the client-side description
|
49
49
|
restore( msg )
|
50
|
-
|
50
|
+
|
51
51
|
## Set the valid flag, so we know that the value is initially in sync
|
52
52
|
@is_valid = true
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
# @private (Re-)Send the client-size representation
|
56
56
|
def restore( msg )
|
57
|
-
|
57
|
+
|
58
58
|
## Tags itself as a new value from the client's point of view
|
59
59
|
@is_new_to_client = true
|
60
|
-
|
60
|
+
|
61
61
|
add_to_sync( msg )
|
62
|
-
|
62
|
+
|
63
63
|
end
|
64
|
-
|
64
|
+
|
65
65
|
# Value meta-data. The third constructor parameter
|
66
66
|
attr_accessor :meta
|
67
|
-
|
67
|
+
|
68
68
|
# Creates a new client-server automatically synchronized data wrapper object.
|
69
69
|
# @param [Message] msg Just pass on the +msg+ from the scope you call from.
|
70
70
|
# @param [#to_json] data Any data that can be converted to JSON.
|
71
71
|
# @param [Hash] meta Has no effect yet.
|
72
|
-
def initialize( msg, data, meta = { :name => nil } )
|
73
|
-
|
72
|
+
def initialize( msg, data, meta = { :name => nil, :type => 0 } )
|
73
|
+
|
74
74
|
## Get an unique integer id for the value
|
75
75
|
if RSence.args[:debug] and meta[:name] and not msg.valuemanager.id_exists?( msg, meta[:name] )
|
76
76
|
@value_id = meta[:name]
|
77
77
|
else
|
78
78
|
@value_id = msg.valuemanager.ses_unique_id( msg )
|
79
79
|
end
|
80
|
-
|
80
|
+
|
81
81
|
@meta = meta
|
82
|
-
|
82
|
+
|
83
|
+
if meta[:type] == 2
|
84
|
+
@buffer = []
|
85
|
+
end
|
86
|
+
|
83
87
|
## set the data of the hvalue
|
84
88
|
set( msg, data, true )
|
85
|
-
|
89
|
+
|
86
90
|
## the @sync flag is raised, when the client data is older than the server data
|
87
91
|
@sync = false
|
88
|
-
|
92
|
+
|
89
93
|
## the @is_valid flag is lowered, when the client data is newer than the server data
|
90
94
|
@is_valid = true
|
91
|
-
|
95
|
+
|
92
96
|
## Bind the value to the value manager and report it to the client
|
93
97
|
add( msg )
|
94
|
-
|
98
|
+
|
95
99
|
## storage for validator bindings
|
96
100
|
@members = {}
|
97
|
-
|
101
|
+
|
98
102
|
end
|
99
|
-
|
103
|
+
|
100
104
|
# Binds the value to a responder. The responder is an instance of {Plugins::Plugin__ Plugin} or {Plugins::GUIPlugin__ GUIPlugin}.
|
101
105
|
# Responders are called once, when the client requests the data to be changed.
|
102
106
|
# Responders must return +true+, if they accept the change. Otherwise the data is treated as invalid.
|
@@ -112,7 +116,7 @@ module RSence
|
|
112
116
|
@members[plugin_name].push( method_name ) unless @members[plugin_name].include?( method_name )
|
113
117
|
return true
|
114
118
|
end
|
115
|
-
|
119
|
+
|
116
120
|
# Checks, if the plugin_name and method_name pairing is already bound with the bind method. Returns true or false.
|
117
121
|
def bound?( plugin_name, method_name )
|
118
122
|
plugin_name = plugin_name.to_sym unless plugin_name.class == Symbol
|
@@ -120,7 +124,7 @@ module RSence
|
|
120
124
|
return false unless @members.has_key?(plugin_name)
|
121
125
|
return @members[plugin_name].include?(method_name)
|
122
126
|
end
|
123
|
-
|
127
|
+
|
124
128
|
# Releases the responder of the value, both params as in bind, but optional +method_name+ can be omitted, matching all methods bound to the +plugin_name+.
|
125
129
|
# @param [Symbol] plugin_name The name of the plugin acting as a responder to the value.
|
126
130
|
# @param [Symbol] method_name The name of the method of the plugin acting as a responder to the value.
|
@@ -132,7 +136,7 @@ module RSence
|
|
132
136
|
return false unless @members.has_key?( plugin_name )
|
133
137
|
if not method_name
|
134
138
|
@members.delete( plugin_name )
|
135
|
-
else
|
139
|
+
else
|
136
140
|
@members[plugin_name].slice!(@members[plugin_name].index( method_name )) if @members[plugin_name].include?(method_name)
|
137
141
|
if @members[plugin_name].empty?
|
138
142
|
@members.delete( plugin_name )
|
@@ -140,23 +144,32 @@ module RSence
|
|
140
144
|
end
|
141
145
|
return true
|
142
146
|
end
|
143
|
-
|
147
|
+
|
144
148
|
# Releases all responders.
|
145
149
|
# @return [true]
|
146
150
|
def release_all
|
147
151
|
@members = {}
|
148
152
|
return true
|
149
153
|
end
|
150
|
-
|
154
|
+
|
151
155
|
# @deprecated Use {#release} as the opposite to bind.
|
152
156
|
alias unbind release
|
153
|
-
|
157
|
+
|
154
158
|
# @private Tell all bound instances that the value is changed.
|
155
159
|
def tell( msg )
|
156
160
|
invalid_count = 0
|
157
161
|
@members.each_key do |plugin_name|
|
158
162
|
@members[plugin_name].each do |method_name|
|
159
|
-
|
163
|
+
if @meta[:type] == 1
|
164
|
+
data = @data
|
165
|
+
for item in data
|
166
|
+
@data = item
|
167
|
+
msg.plugins.run_plugin( plugin_name, method_name, msg, self )
|
168
|
+
end
|
169
|
+
@data = data
|
170
|
+
else
|
171
|
+
invalid_count += 1 unless msg.plugins.run_plugin( plugin_name, method_name, msg, self )
|
172
|
+
end
|
160
173
|
end
|
161
174
|
end
|
162
175
|
if invalid_count == 0
|
@@ -164,29 +177,29 @@ module RSence
|
|
164
177
|
msg.session[:values][:check].delete( @value_id )
|
165
178
|
end
|
166
179
|
end
|
167
|
-
|
180
|
+
|
168
181
|
# @private Handle updates from the client.
|
169
182
|
def from_client( msg, data )
|
170
183
|
# only process changes, if different from the one already stored.
|
171
184
|
if @data != data
|
172
|
-
|
185
|
+
|
173
186
|
# puts "data sync from client: #{@data.inspect} -> #{data.inspect} (#{@meta[:name]})"
|
174
187
|
|
175
188
|
## set takes care of the setting..
|
176
189
|
@data = data
|
177
|
-
|
190
|
+
|
178
191
|
## change the valid state, because the value was set by the client!
|
179
192
|
@is_valid = false
|
180
|
-
|
193
|
+
|
181
194
|
## add the id to the values to be checked
|
182
195
|
check_ids = msg.session[:values][:check]
|
183
196
|
unless check_ids.include?( @value_id )
|
184
197
|
check_ids.push( @value_id )
|
185
198
|
end
|
186
199
|
end
|
187
|
-
|
200
|
+
|
188
201
|
end
|
189
|
-
|
202
|
+
|
190
203
|
# @private Adds the value to the sync array.
|
191
204
|
def add_to_sync( msg )
|
192
205
|
## add the id to the values to be synchronized (to client)
|
@@ -195,68 +208,75 @@ module RSence
|
|
195
208
|
sync_ids.push( @value_id )
|
196
209
|
end
|
197
210
|
end
|
198
|
-
|
211
|
+
|
199
212
|
# Sets the data of the value, the change will be synced with the client.
|
200
213
|
# @param [Message] msg The {Message} instance.
|
201
214
|
# @param [#to_json] data Any data that can be mapped to JSON and handled by the client.
|
202
215
|
# @param [Boolean] dont_tell_client Doesn't notify the client about the change, if true.
|
203
216
|
def set( msg, data, dont_tell_client=false )
|
204
|
-
|
217
|
+
|
205
218
|
@data = data
|
206
|
-
|
219
|
+
|
207
220
|
# won't tell the client about the change, usually not needed
|
208
221
|
unless dont_tell_client
|
222
|
+
@buffer.push( data ) if @meta[:type] == 2
|
209
223
|
## update the flags
|
210
224
|
@sync = false
|
211
225
|
@is_valid = true
|
212
|
-
|
226
|
+
|
213
227
|
add_to_sync( msg )
|
214
228
|
end
|
215
229
|
end
|
216
|
-
|
230
|
+
|
217
231
|
# Sets the key of the hash data of the value, the change will be synced with the client.
|
218
232
|
# @param [Message] msg The {Message} instance.
|
219
233
|
# @param [String] key The key of data to change
|
220
234
|
# @param [#to_json] data Any data that can be mapped to JSON and handled by the client.
|
221
235
|
# @param [Boolean] dont_tell_client Doesn't notify the client about the change, if true.
|
222
236
|
def set_key( msg, key, data, dont_tell_client=false )
|
223
|
-
|
237
|
+
|
224
238
|
@data[key] = data
|
225
|
-
|
239
|
+
|
226
240
|
# won't tell the client about the change, usually not needed
|
227
241
|
unless dont_tell_client
|
228
242
|
## update the flags
|
229
243
|
@sync = false
|
230
244
|
@is_valid = true
|
231
|
-
|
245
|
+
|
232
246
|
add_to_sync( msg )
|
233
247
|
end
|
234
248
|
end
|
235
|
-
|
249
|
+
|
236
250
|
# @private Tell the client that the value changed.
|
237
251
|
def to_client( msg )
|
252
|
+
if @meta[:type] == 2
|
253
|
+
data = @buffer.clone
|
254
|
+
@buffer = []
|
255
|
+
else
|
256
|
+
data = @data
|
257
|
+
end
|
238
258
|
if @is_new_to_client
|
239
259
|
## Initialize a new client value
|
240
|
-
msg.reply_value( :new, @value_id,
|
260
|
+
msg.reply_value( :new, @value_id, data, @meta[:type] )
|
241
261
|
@is_new_to_client = false
|
242
262
|
else
|
243
263
|
## Sets the client value
|
244
|
-
msg.reply_value( :set, @value_id,
|
264
|
+
msg.reply_value( :set, @value_id, data )
|
245
265
|
end
|
246
266
|
end
|
247
|
-
|
267
|
+
|
248
268
|
# Destructor method. If msg is supplied, deletes the client representation too.
|
249
269
|
# @param [false, Message] A {Message} instance. When supplied, deletes the client representation.
|
250
270
|
def die!( msg=false )
|
251
|
-
|
271
|
+
|
252
272
|
release_all
|
253
|
-
|
273
|
+
|
254
274
|
# get the value storage from the session data
|
255
275
|
session_values = msg.session[:values][:by_id]
|
256
|
-
|
276
|
+
|
257
277
|
## Store the object here
|
258
278
|
session_values.delete( @value_id )
|
259
|
-
|
279
|
+
|
260
280
|
if msg and not @is_new_to_client
|
261
281
|
msg.reply_value( :del, @value_id )
|
262
282
|
end
|
@@ -266,7 +286,7 @@ module RSence
|
|
266
286
|
def inspect
|
267
287
|
"#<RSence::HValue value_id:#{@value_id.inspect}, valid: #{@is_valid.inspect}, sync: #{@sync.inspect}, is_new_to_client: #{@is_new_to_client.inspect}, meta: #{@meta.inspect[0..100]}, data: #{@data.inspect[0..100]} ...>"
|
268
288
|
end
|
269
|
-
|
289
|
+
|
270
290
|
end
|
271
291
|
|
272
292
|
end
|
@@ -107,7 +107,11 @@ class ClientPkgBuild
|
|
107
107
|
tmpl.gsub!( HEIGHT_RE, ']H[')
|
108
108
|
tmpl.gsub!( TMPL_RE ) do
|
109
109
|
( js_type, js_code ) = [ $1, $2 ]
|
110
|
-
|
110
|
+
begin
|
111
|
+
js_code = CoffeeScript.compile( js_code, :bare => true ) if js_code.start_with?('#!coffee')
|
112
|
+
rescue ExecJS::RuntimeError
|
113
|
+
js_code = "console.log('Invalid coffee in template #{theme_name}/#{component_name}:',#{js_code.to_json})"
|
114
|
+
end
|
111
115
|
if cached_idx.has_key?( js_code )
|
112
116
|
seq_id = cached_idx[ js_code ]
|
113
117
|
else
|
@@ -3,27 +3,27 @@ module ClientPkgServe
|
|
3
3
|
def broker_urls
|
4
4
|
::RSence.config[:broker_urls]
|
5
5
|
end
|
6
|
-
|
6
|
+
|
7
7
|
def match( uri, request_type )
|
8
8
|
uri.match( /^#{broker_urls[:h]}/ )
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
# Helper method to return the time formatted according to the HTTP RFC
|
12
12
|
def httime(time)
|
13
13
|
return time.gmtime.strftime('%a, %d %b %Y %H:%M:%S %Z')
|
14
14
|
end
|
15
|
-
|
15
|
+
|
16
16
|
def build_busy_wait
|
17
17
|
while @build_busy
|
18
18
|
puts "-- build not finished, waiting.. --"
|
19
19
|
sleep 0.4
|
20
20
|
end
|
21
21
|
end
|
22
|
-
|
22
|
+
|
23
23
|
def set_headers( response )
|
24
24
|
# Sets the response date header to the current time:
|
25
25
|
response['Date'] = httime( Time.now )
|
26
|
-
|
26
|
+
|
27
27
|
# Controls caching with headers based on the configuration
|
28
28
|
if ::RSence.config[:cache_maximize]
|
29
29
|
response['Expires'] = httime(Time.now+::RSence.config[:cache_expire])
|
@@ -31,7 +31,7 @@ module ClientPkgServe
|
|
31
31
|
response['Cache-Control'] = 'no-cache'
|
32
32
|
end
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
def check_ua( request )
|
36
36
|
support_gzip = (request.header.has_key?('Accept-Encoding') and request.header['Accept-Encoding'].include?('gzip'))
|
37
37
|
support_gzip = false if ::RSence.config[:no_gzip]
|
@@ -51,27 +51,27 @@ module ClientPkgServe
|
|
51
51
|
:version => version
|
52
52
|
}
|
53
53
|
end
|
54
|
-
|
54
|
+
|
55
55
|
def support_gzip?( ua )
|
56
56
|
doesnt_support = (ua[:safari] and ua[:version] < 533)
|
57
57
|
return ( not doesnt_support )
|
58
58
|
end
|
59
|
-
|
59
|
+
|
60
60
|
def serve_js( request, response, request_path, ua )
|
61
61
|
# the file-specific identifier ('core', 'basic' etc)
|
62
62
|
req_file = request_path[3][0..-4]
|
63
|
-
|
63
|
+
|
64
64
|
if not @client_cache.js_cache.has_key?( req_file )
|
65
65
|
response.status = 404
|
66
66
|
response.body = '/* 404 - Not Found */'
|
67
67
|
else
|
68
|
-
|
68
|
+
|
69
69
|
response.status = 200
|
70
70
|
response['Content-Type'] = 'text/javascript; charset=utf-8'
|
71
|
-
|
71
|
+
|
72
72
|
# these browsers have issues with gzipped js content
|
73
73
|
support_gzip = support_gzip?( ua )
|
74
|
-
|
74
|
+
|
75
75
|
if support_gzip
|
76
76
|
#response['Transfer-Encoding'] = 'chunked,gzip'
|
77
77
|
response['Last-Modified'] = @client_cache.last_modified
|
@@ -80,39 +80,39 @@ module ClientPkgServe
|
|
80
80
|
response['Content-Encoding'] = 'gzip'
|
81
81
|
response.body = body
|
82
82
|
else
|
83
|
-
|
83
|
+
|
84
84
|
response['Last-Modified'] = @client_cache.last_modified
|
85
85
|
body = @client_cache.js_cache[ req_file ]
|
86
86
|
response['Content-Length'] = body.bytesize.to_s
|
87
87
|
response.body = body
|
88
|
-
|
88
|
+
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
92
|
-
|
92
|
+
|
93
93
|
def serve_theme( request, response, request_path, ua )
|
94
94
|
# Get the name of the theme
|
95
95
|
theme_name = request_path[3]
|
96
|
-
|
96
|
+
|
97
97
|
# Get the theme resource type (html/css/gfx)
|
98
98
|
theme_part = request_path[4].to_sym
|
99
|
-
|
99
|
+
|
100
100
|
# Get the theme resource identifier
|
101
101
|
req_file = request_path[5]
|
102
|
-
|
102
|
+
|
103
103
|
# checks for theme name
|
104
104
|
has_theme = @client_cache.theme_cache.has_key?( theme_name )
|
105
|
-
|
105
|
+
|
106
106
|
# checks for theme part (css/html/gfx)
|
107
107
|
if theme_part == :css or theme_part == :html
|
108
108
|
has_theme_part = false
|
109
109
|
else
|
110
110
|
has_theme_part = ( has_theme and @client_cache.theme_cache[theme_name].has_key?(theme_part) )
|
111
111
|
end
|
112
|
-
|
112
|
+
|
113
113
|
# checks for theme file
|
114
114
|
has_theme_file = ( has_theme_part and @client_cache.theme_cache[theme_name][theme_part].has_key?( req_file ) )
|
115
|
-
|
115
|
+
|
116
116
|
if not has_theme
|
117
117
|
response.status = 404
|
118
118
|
response.body = '404 - Theme Not Found'
|
@@ -143,30 +143,38 @@ module ClientPkgServe
|
|
143
143
|
response.body = body
|
144
144
|
end
|
145
145
|
end
|
146
|
-
|
146
|
+
|
147
147
|
## Responds to get-requests
|
148
148
|
def get( request, response, session )
|
149
|
-
|
150
|
-
|
151
|
-
|
149
|
+
|
150
|
+
if @build_busy
|
151
|
+
puts "#{Time.now.strftime('%Y-%m-%d %H:%M:%S')} -- Client build busy."
|
152
|
+
response['Retry-After'] = '1'
|
153
|
+
response['Content-Type'] = 'text/plain'
|
154
|
+
response['Refresh'] = "1; #{env['REQUEST_URI']}"
|
155
|
+
response['Content-Length'] = '0'
|
156
|
+
response.body = ''
|
157
|
+
response.status = 503
|
158
|
+
end
|
159
|
+
|
152
160
|
ua = check_ua( request )
|
153
|
-
|
161
|
+
|
154
162
|
set_headers( response )
|
155
|
-
|
163
|
+
|
156
164
|
## Split path into an array for determining what to serve
|
157
165
|
request_uri = '/'+request.path.match( /^#{::RSence.config[:broker_urls][:h]}(.*)$/ )[1]
|
158
|
-
|
166
|
+
|
159
167
|
request_path = request_uri.split( '/' )
|
160
|
-
|
168
|
+
|
161
169
|
## Requested type of client resource (js/themes)
|
162
170
|
req_type = request_path[2]
|
163
|
-
|
171
|
+
|
164
172
|
unless ['js','themes'].include? req_type
|
165
173
|
req_rev = req_type
|
166
174
|
req_type = request_path[3]
|
167
175
|
request_path.delete_at(2)
|
168
176
|
end
|
169
|
-
|
177
|
+
|
170
178
|
## Serve compiled client javascript component files:
|
171
179
|
if req_type == 'js'
|
172
180
|
serve_js( request, response, request_path, ua )
|
@@ -174,7 +182,7 @@ module ClientPkgServe
|
|
174
182
|
elsif req_type == 'themes'
|
175
183
|
serve_theme( request, response, request_path, ua )
|
176
184
|
end
|
177
|
-
|
185
|
+
|
178
186
|
end
|
179
187
|
end
|
180
188
|
|
data/plugins/main/js/main.js
CHANGED
@@ -1,39 +1,35 @@
|
|
1
1
|
// List of apps initialized utilizing GUITrees, by GUIPlugin name
|
2
2
|
RSence.apps = { };
|
3
3
|
|
4
|
-
// Subview that utilizes GUITrees
|
5
|
-
RSence.GUIView = HControl.extend({
|
6
|
-
|
7
|
-
});
|
8
|
-
|
9
4
|
// Application that handles GUITrees, populates its values dynamically
|
10
5
|
RSence.GUIApp = HApplication.extend({
|
11
6
|
constructor: function(_options){
|
12
|
-
|
7
|
+
|
13
8
|
var
|
9
|
+
i = 0,
|
14
10
|
_this = this,
|
15
|
-
|
11
|
+
|
16
12
|
// Application priority
|
17
13
|
_priority = _options.priority?_options.priority:100,
|
18
|
-
|
14
|
+
|
19
15
|
// Application label / title
|
20
16
|
_label = _options.label?_options.label:'Untitled Application',
|
21
|
-
|
17
|
+
|
22
18
|
// Application description (multiline)
|
23
19
|
_descr = _options.descr?_options.descr:'No Description',
|
24
|
-
|
20
|
+
|
25
21
|
// Allow multiple instances?
|
26
22
|
_allowMulti = _options.allowMulti?_options.allowMulti:false,
|
27
|
-
|
23
|
+
|
28
24
|
// The GUI Tree
|
29
25
|
_valueObj = _options.valueObj?_options.valueObj:false,
|
30
|
-
|
26
|
+
|
31
27
|
// Signal input (from server to client)
|
32
|
-
_sigInput = _options.sigInput?
|
33
|
-
|
28
|
+
_sigInput = _options.sigInput?_this.getValueById(_options.sigInput):false,
|
29
|
+
|
34
30
|
// Signal output (from client to server)
|
35
|
-
_sigOutput = _options.sigOutput?
|
36
|
-
|
31
|
+
_sigOutput = _options.sigOutput?_this.getValueById(_options.sigOutput):false,
|
32
|
+
|
37
33
|
// Icon image url.
|
38
34
|
// Minimum size is 16x16 and multiple sizes are stacked on top of each other,
|
39
35
|
// largest topmost, smaller versions aligned left below in size order.
|
@@ -48,10 +44,10 @@ RSence.GUIApp = HApplication.extend({
|
|
48
44
|
// 512x896 -> 512x512, 256x256 and 128x128
|
49
45
|
// etc..
|
50
46
|
_iconUrl = _options.iconUrl?COMM.Values.values[_options.iconUrl]:false;
|
51
|
-
|
47
|
+
|
52
48
|
// Construct the application base:
|
53
49
|
_this.base( _priority, _label );
|
54
|
-
|
50
|
+
|
55
51
|
// Options combined from vars above
|
56
52
|
_this.options = HClass.extend(_options).extend({
|
57
53
|
label: _label,
|
@@ -61,17 +57,39 @@ RSence.GUIApp = HApplication.extend({
|
|
61
57
|
sigOutput: _sigOutput,
|
62
58
|
icon: { url: _iconUrl, width: null, height: null },
|
63
59
|
pid: this.appId,
|
60
|
+
elemId: 0,
|
64
61
|
views: []
|
65
62
|
}).nu();
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
63
|
+
this.elemId = _this.options.elemId;
|
64
|
+
|
65
|
+
if( _options.values ){
|
66
|
+
_this.valueIds = _options.values;
|
67
|
+
_this.values = {};
|
68
|
+
for( i in _options.values ){
|
69
|
+
_this.values = _this.getValueById(i);
|
70
|
+
}
|
71
|
+
}
|
72
|
+
|
73
|
+
if( _options.localized ){
|
74
|
+
_this.localized = _options.localized;
|
75
|
+
}
|
76
|
+
|
77
|
+
if( _options.strings ){
|
78
|
+
_this.strings = _options.strings;
|
79
|
+
}
|
80
|
+
|
81
|
+
if(_valueObj){
|
82
|
+
_this.valueObj.bind(_this);
|
83
|
+
}
|
84
|
+
else {
|
85
|
+
_this.value = _options.value;
|
86
|
+
}
|
87
|
+
|
70
88
|
// _this.app = _this;
|
71
|
-
|
72
|
-
//
|
89
|
+
|
90
|
+
//
|
73
91
|
// _this.renderer = COMM.JSONRenderer.extend({
|
74
|
-
//
|
92
|
+
//
|
75
93
|
// }).nu( _this.value, _this );
|
76
94
|
_this.drawSubviews();
|
77
95
|
if( _this.options.subviews ){
|
@@ -82,11 +100,11 @@ RSence.GUIApp = HApplication.extend({
|
|
82
100
|
drawSubviews: function(){
|
83
101
|
|
84
102
|
},
|
85
|
-
|
103
|
+
|
86
104
|
die: function(){
|
87
105
|
this.base();
|
88
|
-
|
106
|
+
|
89
107
|
}
|
90
|
-
|
108
|
+
|
91
109
|
});
|
92
110
|
|