rsence 2.1.6 → 2.1.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.6
1
+ 2.1.7
@@ -31,6 +31,7 @@ HTimeSheet = HControl.extend({
31
31
  pxPerHour: null,
32
32
  itemOffsetLeft: null,
33
33
  itemOffsetRight: null,
34
+ itemMinHeight: 24,
34
35
  newItemLabel: 'New Item',
35
36
  constructor: function(_ctrl){
36
37
  if(this.pxPerHour !== null){
@@ -173,6 +174,9 @@ HTimeSheet = HControl.extend({
173
174
  _top = _origY+1,
174
175
  _right = this.rect.width - this.itemOffsetRight - 1,
175
176
  _bottom = _origY + _lineHeight - 2;
177
+ if( (_top - _bottom) < this.options.itemMinHeight ){
178
+ _bottom = _top + this.options.itemMinHeight;
179
+ }
176
180
  return HRect.nu( _left, _top, _right, _bottom );
177
181
  },
178
182
 
@@ -289,9 +289,17 @@ HTimeSheetItem = HControl.extend({
289
289
  **/
290
290
  refreshValue: function(){
291
291
  if ( HVM.type(this.value) === 'h' ){
292
- this.setLabel( this._getValueLabel( this.value ) );
293
- this.rect.setTop( this._getValueTop( this.value ) );
294
- this.rect.setBottom( this._getValueBottom( this.value ) );
292
+ var
293
+ _label = this._getValueLabel( this.value ),
294
+ _top = this._getValueTop( this.value ),
295
+ _bottom = this._getValueBottom( this.value ),
296
+ _minHeight = this.parent.options.itemMinHeight;
297
+ this.setLabel( _label );
298
+ if( (_bottom - _top) < _minHeight ){
299
+ _bottom = _top + _minHeight;
300
+ }
301
+ this.rect.setTop( _top );
302
+ this.rect.setBottom( _bottom );
295
303
  this.drawRect();
296
304
  }
297
305
  }
@@ -13,9 +13,6 @@ require 'yaml'
13
13
 
14
14
 
15
15
 
16
- require 'util/ruby19_fixes' if RUBY_VERSION.to_f >= 1.9
17
-
18
-
19
16
  module RSence
20
17
 
21
18
 
@@ -24,7 +24,7 @@ class Broker
24
24
 
25
25
  # This method is called from Rack.
26
26
  # @param [Hash] env is the Rack environment.
27
- # @return [Array(Number, Hash, String)] Rack-style response status, header, body
27
+ # @return [Array(Number, Hash, Array)] Rack-style response status, header, body
28
28
  def call( env )
29
29
  sleep @@ping_sim if @@ping_sim
30
30
  unless @@transporter.online?
@@ -35,7 +35,7 @@ class Broker
35
35
  'Refresh' => "2; #{env['REQUEST_URI']}",
36
36
  'Content-Length' => '4'
37
37
  }
38
- return [ 503, headers, 'BUSY' ]
38
+ return [ 503, headers, ['BUSY'] ]
39
39
  end
40
40
  request = Request.new(env)
41
41
  response = Response.new
@@ -43,8 +43,9 @@ class Broker
43
43
  dispatcher = dispatcher_class.new( request, response )
44
44
  dispatcher.send( request_method )
45
45
  content_type = dispatcher.content_type
46
- response.header['Content-Length'] = response.body.length.to_s unless response.header.has_key?('Content-Length')
47
- return [response.status, response.header, response.body]
46
+ response_body = response.body
47
+ response.header['Content-Length'] = response.body_bytes unless response.header.has_key?('Content-Length')
48
+ return [response.status, response.header, response_body]
48
49
  end
49
50
 
50
51
  # Returns a dynamically created "REST Dispatcher" kind of class that has
@@ -121,7 +122,7 @@ class Broker
121
122
  @response.status = 404
122
123
  err404 = '<html><head><title>404 - Page Not Found</title></head><body>404 - Page Not Found</body></html>'
123
124
  @response['Content-Type'] = 'text/html; charset=UTF-8'
124
- @response['Content-Length'] = err404.length.to_s
125
+ @response['Content-Length'] = err404.bytesize.to_s
125
126
  @response.body = err404
126
127
  end
127
128
 
@@ -74,7 +74,7 @@ module Broker
74
74
  else
75
75
  puts "unsupported method: #{request_method.inspect}"
76
76
  end
77
- response.header['Content-Length'] = response.body.length.to_s unless response.header.has_key?('Content-Length')
77
+ response.header['Content-Length'] = response.body.bytesize.to_s unless response.header.has_key?('Content-Length')
78
78
  return [response.status, response.header, response.body]
79
79
  end
80
80
 
@@ -82,8 +82,8 @@ module Broker
82
82
  puts "/404: #{request.fullpath.inspect}" if $DEBUG_MODE
83
83
  response.status = 404
84
84
  err404 = '<html><head><title>404 - Page Not Found</title></head><body>404 - Page Not Found</body></html>'
85
- response['content-type'] = 'text/html; charset=UTF-8'
86
- response['content-length'] = err404.length.to_s
85
+ response['Content-Type'] = 'text/html; charset=UTF-8'
86
+ response['Content-Length'] = err404.bytesize.to_s
87
87
  response.body = err404
88
88
  end
89
89
 
@@ -17,6 +17,19 @@ module RSence
17
17
  # Adds the + method "operator" to an extended Array.
18
18
  # Used for pushing http body data.
19
19
  class ResponseBody < Array
20
+ def push( body_data )
21
+ super( sanitize_body_data( body_data ) )
22
+ end
23
+ def sanitize_body_data( body_data )
24
+ if body_data.class == String
25
+ return body_data
26
+ elsif body_data.respond_to?(:to_s)
27
+ return body_data.to_s
28
+ else
29
+ warn "Invalid response data: #{body_data.inspect[0..100]}"
30
+ return ''
31
+ end
32
+ end
20
33
  def +(body_data)
21
34
  self.push(body_data)
22
35
  end
@@ -33,10 +46,21 @@ module RSence
33
46
  end
34
47
  def body=(body_data)
35
48
  @body = ResponseBody.new(1)
36
- @body[0] = body_data
49
+ @body[0] = @body.sanitize_body_data( body_data )
37
50
  end
38
51
  def body
39
- @body.join
52
+ @body
53
+ end
54
+ def body_bytes
55
+ bytes = 0
56
+ @body.each do |part|
57
+ if part.respond_to?(:to_s)
58
+ bytes += part.to_s.bytesize
59
+ else
60
+ warn "body data part does not respond to to_s: #{part.inspect[0..100]}"
61
+ end
62
+ end
63
+ return bytes.to_s
40
64
  end
41
65
  def content_type=(new_content_type)
42
66
  @header['Content-Type'] = new_content_type
@@ -135,7 +135,7 @@ module RSence
135
135
  if options[:servlet]
136
136
  @do_gzip = false
137
137
  else
138
- @response.content_type = 'text/javascript; charset=utf-8'
138
+ @response['Content-Type'] = 'text/javascript; charset=utf-8'
139
139
  @response['Cache-Control'] = 'no-cache'
140
140
 
141
141
  # gnu-zipped responses:
@@ -268,7 +268,7 @@ module RSence
268
268
  outp = buf_json(buffer)
269
269
  end
270
270
 
271
- @response['content-length'] = outp.size
271
+ @response['Content-Length'] = outp.bytesize.to_s
272
272
  @response.body = outp
273
273
 
274
274
  @response_sent = true
@@ -84,10 +84,7 @@ module RSence
84
84
  if RSence.args[:debug] and meta[:name] and not msg.valuemanager.id_exists?( msg, meta[:name] )
85
85
  @value_id = meta[:name]
86
86
  else
87
- @value_id = '_'
88
- while @value_id[0] == 95 # ascii for '_'
89
- @value_id = msg.valuemanager.randgen.gen
90
- end
87
+ @value_id = msg.valuemanager.ses_unique_id( msg )
91
88
  end
92
89
 
93
90
  @meta = meta
@@ -35,6 +35,40 @@ module RSence
35
35
 
36
36
  end
37
37
 
38
+
39
+ # @private Returns a session-unique random string
40
+ def ses_unique_id( msg )
41
+ new_id = randgen.gen while id_exists?( msg, new_id )
42
+ return new_id
43
+ end
44
+
45
+
46
+ # @private Regenerate a value id
47
+ def reshuffle_id( msg, ses_values, val_obj, old_id )
48
+
49
+ new_id = ses_unique_id( msg )
50
+
51
+ # replace the old id in the hvalue itself
52
+ val_obj.val_id = new_id
53
+
54
+ # re-associate the value with the new id
55
+ ses_values[:by_id][new_id] = val_obj
56
+ ses_values[:by_id].delete(old_id)
57
+
58
+ # replace the id in the unvalidated values (:check) array
59
+ if ses_values[:check].include?(old_id)
60
+ old_idx = ses_values[:check].index(old_id)
61
+ ses_values[:check][old_idx] = new_id
62
+ end
63
+
64
+ # replace the id in the unsynchronized values (:sync) array
65
+ if ses_values[:sync].include?(old_id)
66
+ old_idx = ses_values[:sync].index(old_id)
67
+ ses_values[:sync][old_idx] = new_id
68
+ end
69
+ end
70
+
71
+
38
72
  # @private Re-constructs all stored values and sends them to the client.
39
73
  # Used for restoring and cloning session values.
40
74
  def resend_session_values( msg )
@@ -56,28 +90,7 @@ module RSence
56
90
 
57
91
  # make a new id
58
92
  unless RSence.args[:debug] and val_obj.meta[:name]
59
- new_id = @randgen.gen
60
- new_id = @randgen.gen while new_id[0] == 95 or id_exists?( msg, new_id )
61
-
62
- # replace the old id in the hvalue itself
63
- val_obj.val_id = new_id
64
-
65
- # re-associate the value with the new id
66
- ses_values[:by_id][new_id] = val_obj
67
- ses_values[:by_id].delete(old_id)
68
-
69
- # replace the id in the unvalidated values (:check) array
70
- if ses_values[:check].include?(old_id)
71
- old_idx = ses_values[:check].index(old_id)
72
- ses_values[:check][old_idx] = new_id
73
- end
74
-
75
- # replace the id in the unsynchronized values (:sync) array
76
- if ses_values[:sync].include?(old_id)
77
- old_idx = ses_values[:sync].index(old_id)
78
- ses_values[:sync][old_idx] = new_id
79
- end
80
-
93
+ reshuffle_id( msg, ses_values, val_obj, old_id )
81
94
  end
82
95
 
83
96
  # tell the hvalue to send its client-side initialization
@@ -96,6 +109,7 @@ module RSence
96
109
 
97
110
  # @private Verifies new_id is unique.
98
111
  def id_exists?( msg, new_id )
112
+ return true unless new_id.class == String
99
113
  return msg.session[:values][:by_id].has_key?(new_id)
100
114
  end
101
115
 
@@ -112,7 +112,7 @@ module ClientPkgServe
112
112
  else
113
113
 
114
114
  response.status = 200
115
- response.content_type = 'text/javascript; charset=utf-8'
115
+ response['Content-Type'] = 'text/javascript; charset=utf-8'
116
116
 
117
117
  # these browsers have issues with gzipped js content
118
118
  support_gzip = false if (is_safari or is_msie or is_symbian)
@@ -121,14 +121,14 @@ module ClientPkgServe
121
121
  #response['Transfer-Encoding'] = 'chunked,gzip'
122
122
  response['Last-Modified'] = @client_cache.last_modified
123
123
  body = @client_cache.gz_cache[ req_file ]+"\r\n\r\n"
124
- response['Content-Length'] = body.length.to_s
124
+ response['Content-Length'] = body.bytesize.to_s
125
125
  response['Content-Encoding'] = 'gzip'
126
126
  response.body = body
127
127
  else
128
128
 
129
129
  response['Last-Modified'] = @client_cache.last_modified
130
130
  body = @client_cache.js_cache[ req_file ]
131
- response['Content-Length'] = body.length.to_s
131
+ response['Content-Length'] = body.bytesize.to_s
132
132
  response.body = body
133
133
 
134
134
  end
@@ -160,7 +160,7 @@ module ClientPkgServe
160
160
 
161
161
  if not has_theme_file and req_file == 'common.css'
162
162
  response.status = 200
163
- response.content_type = 'text/css'
163
+ response['Content-Type'] = 'text/css'
164
164
  response.body = ''
165
165
  end
166
166
 
@@ -180,7 +180,7 @@ module ClientPkgServe
180
180
  response.status = 200
181
181
 
182
182
  file_ext = req_file.split('.')[-1]
183
- response.content_type = {
183
+ response['Content-Type'] = {
184
184
  'html' => 'text/html; charset=utf-8',
185
185
  'css' => 'text/css; charset=utf-8',
186
186
  'png' => 'image/png',
@@ -195,7 +195,7 @@ module ClientPkgServe
195
195
  if support_gzip
196
196
  response['Last-Modified'] = @client_cache.last_modified
197
197
  body = @client_cache.theme_cache[theme_name][theme_part][ req_file+'.gz' ]
198
- response['Content-Length'] = body.length.to_s
198
+ response['Content-Length'] = body.bytesize.to_s
199
199
  response['Content-Encoding'] = 'gzip'
200
200
  response.body = body
201
201
  else
@@ -213,7 +213,7 @@ module ClientPkgServe
213
213
  warn "ClientPkgServe#get: empty body for #{request.path}"
214
214
  body = ''
215
215
  end
216
- response['Content-Length'] = body.length.to_s
216
+ response['Content-Length'] = body.bytesize.to_s
217
217
  response.body = body
218
218
 
219
219
  end
@@ -154,11 +154,11 @@ class MainPlugin < Plugin
154
154
  gzwriter = Zlib::GzipWriter.new( index_gzip, 9 )
155
155
  gzwriter.write( index_html )
156
156
  gzwriter.close
157
- response['Content-Length'] = index_gzip.length
157
+ response['Content-Length'] = index_gzip.bytesize.to_s
158
158
  response['Content-Encoding'] = 'gzip'
159
159
  response.body = index_gzip
160
160
  else
161
- response['Content-Length'] = index_html.length
161
+ response['Content-Length'] = index_html.bytesize.to_s
162
162
  response.body = index_html
163
163
  end
164
164
  end
@@ -229,14 +229,14 @@ class MainPlugin < Plugin
229
229
 
230
230
 
231
231
  # New session initialization, called just once per session.
232
- def init_ses(msg)
232
+ def init_ses( msg )
233
233
  super
234
234
  restore_ses( msg )
235
235
  end
236
236
 
237
237
 
238
238
  # Called once when a session is restored or cloned using the cookie's ses_key
239
- def restore_ses(msg)
239
+ def restore_ses( msg )
240
240
  super
241
241
  ## Resets session data to defaults
242
242
  ses = get_ses( msg )
@@ -391,7 +391,6 @@ class MainPlugin < Plugin
391
391
  def idle(msg)
392
392
 
393
393
  ses = get_ses( msg )
394
-
395
394
  if ses[:boot] == 0
396
395
  boot0( msg, ses )
397
396
  elsif ses[:boot] == 1
@@ -156,7 +156,7 @@ module Common
156
156
  (content_type, filename) = format
157
157
 
158
158
  # content size for the header
159
- content_size = content.size.to_s
159
+ content_size = content.bytesize.to_s
160
160
 
161
161
  storage_hash = @files
162
162
  storage_arr = [content_type,content_size,content,msg.ses_id,filename]
@@ -270,7 +270,7 @@ module Common
270
270
  }
271
271
 
272
272
  # content size for the header
273
- content_size = content.size.to_s
273
+ content_size = content.bytesize.to_s
274
274
 
275
275
  # content type for the header
276
276
  content_type = @content_types[format]
@@ -335,12 +335,12 @@ module Common
335
335
  end
336
336
  if @raw_uris.include?(blobobj_id)
337
337
  content_type = @raw_uris[blobobj_id].mime
338
- content_size = @raw_uris[blobobj_id].size
338
+ content_size = @raw_uris[blobobj_id].bytesize
339
339
  content = @raw_uris[blobobj_id].data
340
340
  elsif @blob_objs[:by_id].include?(blobobj_id)
341
341
  (ses_id, blobobj) = @blob_objs[:by_id][blobobj_id]
342
342
  content_type = blobobj.mime
343
- content_size = blobobj.size
343
+ content_size = blobobj.bytesize
344
344
  content = blobobj.data
345
345
  if req.header.has_key?('keep-alive') and req.header['keep-alive'].size > 0
346
346
  keep_alive = req.header['keep-alive'][0].to_i
@@ -30,7 +30,7 @@ module Favicon
30
30
  # Sets favicon. First parameter is favicon data and the second one is content type which defaults to false.
31
31
  def set_favicon( ico_data, content_type=false )
32
32
  @raw_uris['favicon.ico'][0] = content_type if content_type
33
- @raw_uris['favicon.ico'][1] = ico_data.size.to_s
33
+ @raw_uris['favicon.ico'][1] = ico_data.bytesize.to_s
34
34
  @raw_uris['favicon.ico'][2] = ico_data
35
35
 
36
36
  end
@@ -23,7 +23,7 @@ module Rsrc
23
23
  rsrc_id = @randgen.gen
24
24
  #puts "rsrc_id: #{rsrc_id.inspect}"
25
25
 
26
- content_size = content.size.to_s
26
+ content_size = content.bytesize.to_s
27
27
 
28
28
  @raw_uris[rsrc_id] = [content_type,content_size,content]
29
29
 
@@ -176,8 +176,8 @@ create table rsence_uploads (
176
176
  }
177
177
 
178
178
  response.status = 200
179
- response['content-type'] = 'text/html; charset=UTF-8'
180
- response['content-length'] = response_body.size.to_s
179
+ response['Content-Type'] = 'text/html; charset=UTF-8'
180
+ response['Content-Length'] = response_body.bytesize.to_s
181
181
  response.body = response_body
182
182
  end
183
183
 
@@ -110,8 +110,8 @@ class TicketPlugin < Plugin
110
110
  puts "/U/iframe_html: #{uri.inspect}" if RSence.args[:verbose]
111
111
  res.status = 200
112
112
  http_body = '<html><head><title>Empty Iframe for Uploading</title></head><body></body></html>'
113
- res['content-type'] = 'text/html; charset=UTF-8'
114
- res['content-length'] = http_body.size.to_s
113
+ res['Content-Type'] = 'text/html; charset=UTF-8'
114
+ res['Content-Length'] = http_body.bytesize.to_s
115
115
  res.body = http_body
116
116
  end
117
117
  end
@@ -158,7 +158,7 @@ class TicketPlugin < Plugin
158
158
 
159
159
  # @return [Number] The size (in bytes) of the data
160
160
  def size
161
- return @data.size
161
+ return @data.bytesize
162
162
  end
163
163
 
164
164
  # Implement, if you need to do cleanup before destructing
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease: false
4
+ hash: 5
5
+ prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
- - 6
10
- version: 2.1.6
9
+ - 7
10
+ version: 2.1.7
11
11
  platform: ruby
12
12
  authors:
13
13
  - Riassence Inc.
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-16 00:00:00 +02:00
18
+ date: 2011-01-03 00:00:00 +02:00
19
19
  default_executable: rsence
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -26,14 +26,14 @@ dependencies:
26
26
  requirements:
27
27
  - - "="
28
28
  - !ruby/object:Gem::Version
29
- hash: 1919
29
+ hash: 1925
30
30
  segments:
31
- - 958
32
- version: "958"
31
+ - 963
32
+ version: "963"
33
33
  type: :runtime
34
34
  version_requirements: *id001
35
35
  description: |
36
- RSence is a RIA framework designed for responsive GUI applications on the web.
36
+ RSence is a RIA ("HTML5" or "Ajax" if you like those terms better) framework designed for responsive GUI applications on the web.
37
37
 
38
38
  RSence is a flexible and high-performance RIA framework aimed on building responsive, scalable and over-all as high-performance GUI Applications as possible with the chosen technologies.
39
39
 
@@ -76,7 +76,6 @@ files:
76
76
  - lib/session/sessionstorage.rb
77
77
  - lib/transporter/transporter.rb
78
78
  - lib/util/gzstring.rb
79
- - lib/util/ruby19_fixes.rb
80
79
  - lib/values/hvalue.rb
81
80
  - lib/values/valuemanager.rb
82
81
  - setup/welcome/gui/welcome.yaml
@@ -404,7 +403,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
404
403
  requirements: []
405
404
 
406
405
  rubyforge_project: rsence-
407
- rubygems_version: 1.3.7
406
+ rubygems_version: 1.4.1
408
407
  signing_key:
409
408
  specification_version: 3
410
409
  summary: Release 2.1 version of the RSence framework.
@@ -1,18 +0,0 @@
1
-
2
- # NOTE: Ruby 1.9 isn't fully supported yet.
3
- # There are some encoding handlers and some of the dependencies are not fully working yet.
4
- # One should wait for Ruby 2.0 for production use anyway.
5
-
6
- # Ruby 1.9 encoding defaults.
7
- # This is clearly not enough but a good start for fixing the encoding madness.
8
- Encoding.default_external = Encoding::BINARY
9
- Encoding.default_internal = Encoding::BINARY
10
-
11
- # Ruby 1.9 doesn't have String#each anymore.
12
- # This is a backwards-compatible work-around.
13
- class String
14
- def each
15
- self.split($/).each { |e| yield e }
16
- end
17
- end
18
-