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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/VERSION +1 -1
  3. data/client/conf/client_pkg.yaml +6 -2
  4. data/client/js/comm/queue/queue.js +32 -44
  5. data/client/js/comm/transporter/transporter.js +24 -16
  6. data/client/js/comm/values/values.js +27 -15
  7. data/client/js/controls/button/button.coffee +14 -5
  8. data/client/js/controls/button/themes/default/button.css +4 -2
  9. data/client/js/controls/checkbox/checkbox.js +4 -4
  10. data/client/js/controls/dialogs/sheet/sheet.js +11 -11
  11. data/client/js/controls/dialogs/sheet/themes/default/sheet.html +1 -1
  12. data/client/js/controls/imageview/imageview.js +15 -15
  13. data/client/js/controls/numerictextcontrol/numerictextcontrol.coffee +32 -10
  14. data/client/js/controls/onoffbutton/onoffbutton.coffee +5 -5
  15. data/client/js/controls/progress/progressbar/progressbar.js +6 -7
  16. data/client/js/controls/progress/progressbar/themes/default/progressbar.css +4 -4
  17. data/client/js/controls/progress/progressbar/themes/default/progressbar.html +1 -2
  18. data/client/js/controls/sliders/slider/slider.js +74 -79
  19. data/client/js/controls/stepper/stepper.js +31 -31
  20. data/client/js/controls/stringview/stringview.js +20 -8
  21. data/client/js/controls/tab/tab.js +57 -63
  22. data/client/js/controls/tab/themes/default/tab.html +4 -1
  23. data/client/js/controls/textcontrol/textcontrol.coffee +13 -3
  24. data/client/js/controls/validatorview/validatorview.js +4 -4
  25. data/client/js/controls/window/window.js +43 -56
  26. data/client/js/core/class/class.js +25 -23
  27. data/client/js/core/elem/elem.coffee +8 -1
  28. data/client/js/core/rsence_ns/rsence_ns.coffee +6 -2
  29. data/client/js/core/util/util_methods/util_methods.coffee +57 -15
  30. data/client/js/datetime/calendar/calendar.coffee +196 -199
  31. data/client/js/datetime/calendar/themes/default/calendar.css +81 -159
  32. data/client/js/datetime/calendar/themes/default/calendar.html +9 -18
  33. data/client/js/datetime/datepicker/datepicker.coffee +18 -3
  34. data/client/js/datetime/datetimepicker/datetimepicker.coffee +6 -1
  35. data/client/js/datetime/datetimevalue/datetimevalue.coffee +194 -0
  36. data/client/js/datetime/momentjs/momentjs.js +310 -76
  37. data/client/js/datetime/timepicker/timepicker.coffee +6 -1
  38. data/client/js/datetime/timesheet/timesheet.js +59 -61
  39. data/client/js/foundation/control/control.js +45 -44
  40. data/client/js/foundation/control/controldefaults/controldefaults.js +13 -9
  41. data/client/js/foundation/control/dyncontrol/dyncontrol.js +45 -57
  42. data/client/js/foundation/control/eventresponder/eventresponder.js +97 -97
  43. data/client/js/foundation/control/valuematrix/valuematrix.js +13 -13
  44. data/client/js/foundation/eventmanager/eventmanager.coffee +50 -32
  45. data/client/js/foundation/geom/rect/rect.js +43 -32
  46. data/client/js/foundation/locale_settings/locale_settings.js +36 -25
  47. data/client/js/foundation/system/system.js +79 -67
  48. data/client/js/foundation/thememanager/thememanager.coffee +11 -1
  49. data/client/js/foundation/value/pullvalue/pullvalue.coffee +7 -0
  50. data/client/js/foundation/value/pushvalue/pushvalue.coffee +25 -0
  51. data/client/js/foundation/value/value.js +22 -15
  52. data/client/js/foundation/view/view.js +94 -55
  53. data/client/js/foundation/view/viewdefaults/viewdefaults.js +5 -1
  54. data/client/js/lists/listitems/listitems.js +26 -4
  55. data/client/js/menus/combobox/combobox.coffee +55 -0
  56. data/client/js/menus/minimenu/minimenu.js +61 -30
  57. data/client/js/menus/minimenu/themes/default/minimenu.css +1 -6
  58. data/client/js/menus/minimenu/themes/default/minimenu.html +5 -4
  59. data/client/js/menus/minimenuitem/minimenuitem.js +6 -6
  60. data/client/js/menus/popupmenu/themes/default/popupmenu.css +1 -6
  61. data/client/js/menus/popupmenu/themes/default/popupmenu.html +5 -4
  62. data/client/js/tables/table/table.coffee +109 -64
  63. data/client/js/tables/table/themes/default/table.css +4 -0
  64. data/lib/rsence/msg.rb +64 -64
  65. data/lib/rsence/plugins/plugin.rb +68 -52
  66. data/lib/rsence/session/sequel_sessionstorage.rb +5 -5
  67. data/lib/rsence/value.rb +79 -59
  68. data/plugins/client_pkg/lib/client_pkg_build.rb +5 -1
  69. data/plugins/client_pkg/lib/client_pkg_serve.rb +40 -32
  70. data/plugins/main/js/main.js +46 -28
  71. metadata +6 -8
  72. data/client/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
  73. data/client/js/datetime/calendar/themes/default/calendar_bg.png +0 -0
  74. data/client/js/datetime/calendar/themes/default/calendar_parts1.png +0 -0
  75. data/client/js/datetime/calendar/themes/default/calendar_parts2.png +0 -0
  76. data/client/js/datetime/datetimepicker/datetimepicker.js +0 -210
  77. data/client/js/datetime/datetimevalue/datetimevalue.js +0 -265
data/lib/rsence/msg.rb CHANGED
@@ -5,7 +5,7 @@ module RSence
5
5
 
6
6
  # A Message instance is used as a `messenger class` while processing client-server requests. It's initialized by the system and the convention guideline for its instance is +msg+, pass it on wherever msg might be needed.
7
7
  # In most cases, the use of +msg+ is to just pass the same +msg+ onward from a method to another.
8
- #
8
+ #
9
9
  # @example Logs a message in the client javascript console.
10
10
  # msg.console "#{Time.new.to_s} -- Testing.."
11
11
  #
@@ -27,87 +27,87 @@ module RSence
27
27
  # ses[:example_value] = HValue.new( msg, default_data )
28
28
  # end
29
29
  # end
30
- #
30
+ #
31
31
  class Message
32
-
32
+
33
33
  # @private Session data placeholder, assigned by SessionManager.
34
- attr_accessor :session
35
-
34
+ attr_accessor :session
35
+
36
36
  # Flag for a new session's first request.
37
37
  # Check it in your code to decide what to do, when a new session is encountered.
38
38
  # In systems that require authentication, this may be used as a trigger to display a login/register dialog.
39
39
  # @return [Boolean] This flag is true on the first request of a newly created session.
40
40
  attr_accessor :new_session
41
-
41
+
42
42
  # Flag for a restored session's first request.
43
43
  # Check it in your code to decide what to do, when a restored session is encountered.
44
44
  # @return [Boolean] This flag is true on the first request of a newly restored session.
45
45
  attr_accessor :restored_session
46
-
46
+
47
47
  # Contains the source ses on the first request after the active session was cloned from another session.
48
48
  # @return [false, Hash]
49
- attr_accessor :cloned_source
50
-
49
+ attr_accessor :cloned_source
50
+
51
51
  # Contains the target sessions packed in an Array on the first request after another session was cloned from the active session.
52
52
  # @return [false, Array<Hash>]
53
53
  attr_accessor :cloned_targets
54
-
54
+
55
55
  # @private The session is not valid by default, it's set by SessionManager, if everything seems ok.
56
- attr_accessor :ses_valid
57
-
56
+ attr_accessor :ses_valid
57
+
58
58
  # The HTTP Request object of the active request.
59
59
  # @return [Request]
60
- attr_accessor :request
61
-
60
+ attr_accessor :request
61
+
62
62
  # The HTTP Response object of the active request.
63
63
  # @return [Response]
64
64
  attr_accessor :response
65
-
65
+
66
66
  # @private Response output buffer, Array of Strings; sent to client using to_json
67
67
  attr_accessor :buffer
68
-
68
+
69
69
  # @private Value response output buffer, Array value setters; sent to client using to_json before {:buffer} is sent
70
70
  attr_accessor :value_buffer
71
-
71
+
72
72
  # @private The request success flag; Boolean.
73
73
  attr_accessor :response_success
74
-
74
+
75
75
  # Reference to {Transporter}
76
76
  # @return [Transporter]
77
77
  attr_accessor :transporter
78
-
78
+
79
79
  # Reference to {ValueManager}
80
80
  # @return [ValueManager]
81
81
  attr_accessor :valuemanager
82
-
82
+
83
83
  # Reference to {SessionManager}
84
84
  # @return [SessionManager]
85
85
  attr_accessor :sessions
86
-
86
+
87
87
  # Reference to the main {PluginManager}
88
88
  # @return [PluginManager]
89
89
  attr_accessor :plugins
90
-
91
- # @private Message is initialized with a valid {Transporter}, {Request} and {Response} objects along with options.
90
+
91
+ # @private Message is initialized with a valid {Transporter}, {Request} and {Response} objects along with options.
92
92
  def initialize( transporter, request, response, options )
93
-
93
+
94
94
  @config = RSence.config
95
-
95
+
96
96
  @request = request
97
97
  @response_success = false
98
98
  @response = response
99
99
  @session = nil
100
100
  @buffer = []
101
-
101
+
102
102
  @options = options
103
-
103
+
104
104
  # Value response output.
105
105
  @value_buffer = {
106
106
  :new => [],
107
107
  :set => [],
108
108
  :del => []
109
109
  }
110
-
110
+
111
111
  # The session key placeholder.
112
112
  @ses_key = false
113
113
  @new_session = false
@@ -116,19 +116,19 @@ module RSence
116
116
  @cloned_targets = false
117
117
  @ses_valid = false
118
118
  @error_js = ''
119
-
119
+
120
120
  # global instances
121
121
  @transporter = transporter
122
122
  @valuemanager = @transporter.valuemanager
123
123
  @sessions = @transporter.sessions
124
124
  @plugins = @transporter.plugins
125
-
125
+
126
126
  if options[:servlet]
127
127
  @do_gzip = false
128
128
  else
129
129
  @response['Content-Type'] = 'application/json; charset=utf-8'
130
130
  @response['Cache-Control'] = 'no-cache'
131
-
131
+
132
132
  # gnu-zipped responses:
133
133
  if @request.header['accept-encoding'] and @request.header['accept-encoding'].include?('gzip') and not @config[:no_gzip]
134
134
  @response['Content-Encoding'] = 'gzip'
@@ -137,48 +137,48 @@ module RSence
137
137
  @do_gzip = false
138
138
  end
139
139
  end
140
-
140
+
141
141
  @response_sent = false
142
142
  end
143
-
143
+
144
144
  # Invalidates the active session.
145
145
  # @return [nil]
146
146
  def expire_session
147
147
  @sessions.expire_session( @session[:ses_id] ) if @session
148
148
  end
149
-
149
+
150
150
  # @private Define the session key.
151
151
  def ses_key=(ses_key)
152
152
  @ses_key = ses_key
153
153
  end
154
-
154
+
155
155
  # @private Getter for session key.
156
156
  # @return [String] The active session key.
157
157
  def ses_key
158
158
  @ses_key
159
159
  end
160
-
160
+
161
161
  # Getter for the user id
162
162
  # @return [Number, String] The current user id. Returns 0 by default.
163
163
  def user_id
164
164
  @session[:user_id]
165
165
  end
166
-
166
+
167
167
  # Getter for the user info hash
168
168
  # @return [Hash] The current user info hash. Returns {} by default.
169
169
  def user_info
170
170
  @session[:user_info] = {} unless @session.has_key?(:user_info)
171
171
  @session[:user_info]
172
- end
173
-
172
+ end
173
+
174
174
  # Getter for the user language
175
175
  # @return [Hash] The current user language. Returns RSence.config[:lang] by default
176
176
  def lang
177
177
  uinfo = user_info
178
178
  uinfo[:lang] = RSence.config[:lang] unless uinfo.has_key? :lang
179
179
  uinfo[:lang]
180
- end
181
-
180
+ end
181
+
182
182
  # @private used for automatic reload of page, when the plugins have been changed.
183
183
  def refresh_page?( plugin_incr )
184
184
  if plugin_incr != @session[:plugin_incr]
@@ -188,7 +188,7 @@ module RSence
188
188
  end
189
189
  return false
190
190
  end
191
-
191
+
192
192
  # Setter for the user id
193
193
  # @param [Number, String] user_id The user id to set. Use in login situations to store the user id.
194
194
  # @return [nil]
@@ -202,47 +202,47 @@ module RSence
202
202
  def user_info=(user_info)
203
203
  @session[:user_info] = user_info
204
204
  end
205
-
205
+
206
206
  # Setter for the user language
207
207
  # @param [String] lang The language to set. Use in login situations to store the user language.
208
208
  # @return [nil]
209
209
  def lang=(lang)
210
210
  @session[:user_info][:lang] = lang
211
211
  end
212
-
212
+
213
213
  # Returns the session id
214
214
  # @return [Number]
215
215
  def ses_id
216
216
  @session[:ses_id]
217
217
  end
218
218
  alias session_id ses_id
219
-
219
+
220
220
  # @private Sets the session id
221
221
  # @param [Number] ses_id The session id to set.
222
222
  # @return [nil]
223
223
  def ses_id=(ses_id)
224
224
  @session[:ses_id] = ses_id
225
225
  end
226
-
226
+
227
227
  # @private Sets the error message
228
228
  # @param [String] error_js The error script to send instead of the regular buffers.
229
229
  def error_msg( error_js )
230
230
  @error_js = error_js
231
231
  # response_done
232
232
  end
233
-
233
+
234
234
  # @private Converts the buffer to JSON
235
235
  def buf_json(buffer)
236
236
  buffer.to_json
237
237
  end
238
-
238
+
239
239
  # @private Called to flush buffer.
240
240
  def response_done
241
241
  return if @response_sent
242
242
  if not @response_success
243
243
  @response.status = 200
244
244
  #@response.status = 503
245
-
245
+
246
246
  buffer = [
247
247
  "", # empty session key will stop the syncing
248
248
  {}, # no session values
@@ -251,7 +251,7 @@ module RSence
251
251
  @session.delete( :_msg_unused ) if @session.has_key?( :_msg_unused )
252
252
  ## The response status should always be 200 (OK)
253
253
  @response.status = 200
254
-
254
+
255
255
  @value_buffer.delete( :new ) if @value_buffer[:new].empty?
256
256
  @value_buffer.delete( :set ) if @value_buffer[:set].empty?
257
257
  @value_buffer.delete( :del ) if @value_buffer[:del].empty?
@@ -259,9 +259,9 @@ module RSence
259
259
  @ses_key,
260
260
  @value_buffer,
261
261
  ] + @buffer
262
-
262
+
263
263
  end
264
-
264
+
265
265
  # flush the output
266
266
  if @do_gzip
267
267
  outp = GZString.new('')
@@ -271,13 +271,13 @@ module RSence
271
271
  else
272
272
  outp = buf_json(buffer)
273
273
  end
274
-
274
+
275
275
  @response['Content-Length'] = outp.bytesize.to_s
276
276
  @response.body = outp
277
-
277
+
278
278
  @response_sent = true
279
279
  end
280
-
280
+
281
281
  # Sends data to the client, usually javascript, but is valid for any data that responds to #to_json
282
282
  # @param [String<js>, #to_json] data Javascript source or object that responds to #to_json
283
283
  # @param [Boolean] dont_squeeze When true, doesn't `squeeze` the contents (jsmin + jscompress)
@@ -293,27 +293,27 @@ module RSence
293
293
  puts data if @config[:trace]
294
294
  @buffer.push( @plugins[:client_pkg].coffee( data ) )
295
295
  end
296
-
296
+
297
297
  # @private For value manager; insert changed values BEFORE other js.
298
- def reply_value( operation_type, value_id, data=nil )
298
+ def reply_value( operation_type, value_id, data=nil, type=0 )
299
299
  if operation_type == :set
300
300
  @value_buffer[:set].push( [ value_id, data ] )
301
301
  elsif operation_type == :new
302
- @value_buffer[:new].push( [ value_id, data ] )
302
+ @value_buffer[:new].push( [ value_id, data, type ] )
303
303
  elsif operation_type == :del
304
304
  @value_buffer[:del].push( value_id )
305
305
  else
306
306
  throw "Invalid reply_value operation: operation_type: #{operation_type.inspect}, value_id: #{value_id.inspect}, data: #{data.inspect}"
307
307
  end
308
308
  end
309
-
309
+
310
310
  # Sends data to the client's javascript console.
311
311
  # @param [#to_json] data Any data that can be presented in the Javascript console.
312
312
  def console(data)
313
313
  reply( "console.log(#{data.to_json});" )
314
314
  end
315
315
  alias puts console
316
-
316
+
317
317
  # Serves an image object and returns its disposable URL.
318
318
  # Calls the default `ticket` plugin.
319
319
  # @param [#to_blob] img_obj RMagick image object.
@@ -324,7 +324,7 @@ module RSence
324
324
  def serve_img( img_obj, img_format='PNG' )
325
325
  call( :ticket, :serve_img, self, img_obj, img_format )
326
326
  end
327
-
327
+
328
328
  # Binary data to be served once as a downloadable file attachment, returns a disposable URL.
329
329
  # Calls the default `ticket` plugin.
330
330
  # @param [String] file_data The binary data to serve
@@ -336,7 +336,7 @@ module RSence
336
336
  def serve_file( file_data, content_type='text/plain', filename='untitled.txt' )
337
337
  call( :ticket, :serve_file, self, file_data, content_type, filename )
338
338
  end
339
-
339
+
340
340
  # Sends any binary to be served indefinitely, returns a unique, random, static URL.
341
341
  # Calls the default `ticket` plugin.
342
342
  # IMPORTANT: PLEASE call {#release_rsrc} manually, when the resource is no longer needed to free the memory occupied!
@@ -350,7 +350,7 @@ module RSence
350
350
  def serve_rsrc( rsrc_data, content_type='text/plain' )
351
351
  call(:ticket,:serve_rsrc,self, rsrc_data, content_type )
352
352
  end
353
-
353
+
354
354
  # Removes the URL served, you *must* call this manually when after a served resource is no longer needed!
355
355
  # Calls the default `ticket` plugin.
356
356
  # @see {#serve_rsrc}
@@ -361,7 +361,7 @@ module RSence
361
361
  call(:ticket,:del_rsrc, uri[3..-1] )
362
362
  end
363
363
  alias unserve_rsrc release_rsrc
364
-
364
+
365
365
  # Calls a method of a registered plugin with optional arguments.
366
366
  # @param [Symbol] plugin_name The plugin to call
367
367
  # @param [Symbol] plugin_method The method of the plugin to call