rsence 2.0.9.23 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (74) hide show
  1. data/INSTALL.rdoc +61 -49
  2. data/README.rdoc +20 -4
  3. data/VERSION +1 -1
  4. data/conf/default_conf.yaml +8 -0
  5. data/conf/rsence_command_strings.yaml +31 -20
  6. data/docs/ExampleGuiPlugin.rdoc +2 -2
  7. data/js/comm/comm.js +27 -5
  8. data/js/comm/transporter/transporter.js +1 -1
  9. data/js/comm/values/values.js +12 -5
  10. data/js/controls/button/button.js +12 -2
  11. data/js/controls/dialogs/alert_sheet/alert_sheet.js +13 -1
  12. data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +13 -2
  13. data/js/controls/dialogs/sheet/sheet.js +35 -28
  14. data/js/controls/imageview/imageview.js +13 -13
  15. data/js/controls/progress/progressindicator/progressindicator.js +5 -5
  16. data/js/controls/sliders/slider/slider.js +4 -31
  17. data/js/controls/stepper/stepper.js +12 -19
  18. data/js/controls/textcontrol/textcontrol.js +0 -50
  19. data/js/controls/textcontrol/themes/default/textcontrol.html +1 -1
  20. data/js/controls/window/window.js +1 -1
  21. data/js/core/elem/elem.js +146 -160
  22. data/js/core/rsence_ns/rsence_ns.js +7 -0
  23. data/js/foundation/control/eventresponder/eventresponder.js +8 -7
  24. data/js/foundation/eventmanager/eventmanager.js +81 -48
  25. data/js/foundation/geom/rect/rect.js +1 -1
  26. data/js/foundation/json_renderer/json_renderer.js +4 -1
  27. data/js/foundation/system/system.js +37 -34
  28. data/js/foundation/view/morphanimation/morphanimation.js +53 -43
  29. data/js/foundation/view/view.js +119 -118
  30. data/js/lists/listitems/listitems.js +10 -10
  31. data/js/lists/propertylist/js.inc +0 -0
  32. data/js/lists/propertylist/propertylist.js +574 -0
  33. data/js/lists/propertylist/propertylisteditor/js.inc +0 -0
  34. data/js/lists/propertylist/propertylisteditor/propertylisteditor.js +233 -0
  35. data/js/lists/radiobuttonlist/radiobuttonlist.js +15 -8
  36. data/js/menus/minimenu/js.inc +0 -0
  37. data/js/menus/minimenu/minimenu.js +139 -0
  38. data/js/menus/minimenu/minimenuitem/js.inc +0 -0
  39. data/js/menus/minimenu/minimenuitem/minimenuitem.js +33 -0
  40. data/js/menus/minimenu/minimenuitem/themes/default/minimenuitem.css +45 -0
  41. data/js/menus/minimenu/minimenuitem/themes/default/minimenuitem.html +4 -0
  42. data/js/menus/minimenu/minimenuitem/themes/default/minimenuitem_checkmark.png +0 -0
  43. data/js/menus/minimenu/themes/default/minimenu.css +63 -0
  44. data/js/menus/minimenu/themes/default/minimenu.html +7 -0
  45. data/js/menus/minimenu/themes/default/minimenu.png +0 -0
  46. data/js/util/reloadapp/reloadapp.js +1 -1
  47. data/lib/conf/argv.rb +40 -11
  48. data/lib/daemon/daemon.rb +63 -22
  49. data/lib/plugins/gui_plugin.rb +28 -31
  50. data/lib/plugins/guiparser.rb +37 -7
  51. data/lib/plugins/plugin.rb +260 -28
  52. data/lib/plugins/plugin_base.rb +14 -0
  53. data/lib/plugins/plugin_plugins.rb +11 -1
  54. data/lib/plugins/pluginmanager.rb +127 -44
  55. data/lib/plugins/plugins.rb +10 -1
  56. data/lib/session/msg.rb +25 -1
  57. data/lib/session/sessionmanager.rb +11 -2
  58. data/lib/session/sessionstorage.rb +14 -14
  59. data/lib/transporter/transporter.rb +29 -13
  60. data/lib/values/hvalue.rb +30 -0
  61. data/plugins/client_pkg/info.yaml +2 -2
  62. data/plugins/{index_html → main}/img/loading.gif +0 -0
  63. data/plugins/{index_html → main}/img/riassence.gif +0 -0
  64. data/plugins/main/info.yaml +5 -4
  65. data/plugins/main/main.rb +180 -24
  66. data/plugins/{index_html → main}/tmpl/index.html +4 -2
  67. data/plugins/ticket/info.yaml +2 -2
  68. data/plugins/ticket/lib/upload.rb +57 -5
  69. data/plugins/ticket/ticket.rb +10 -4
  70. data/setup/welcome/info.yaml +2 -2
  71. data/setup/welcome/text/welcome.html +1 -1
  72. metadata +22 -11
  73. data/plugins/index_html/index_html.rb +0 -120
  74. data/plugins/index_html/info.yaml +0 -18
@@ -9,7 +9,9 @@ __SCRIPT_DEPS__
9
9
 
10
10
  <script>
11
11
 
12
- /** Runtime configuration: **/
13
- RSence.serverConf('__CLIENT_BASE__','__CLIENT_HELLO__');
12
+ var RSenceInit = function(){
13
+ /** Runtime configuration: **/
14
+ RSence.serverConf('__CLIENT_BASE__','__CLIENT_HELLO__');
15
+ };
14
16
 
15
17
  </script></head><body id="body"><noscript>__NOSCRIPT__</noscript></body></html>
@@ -3,7 +3,7 @@
3
3
  title: Ticket services
4
4
 
5
5
  # The human-readable version of the package
6
- version: 2.0.0
6
+ version: 2.1.0
7
7
 
8
8
  # A brief description of the package (rdoc formatting supported)
9
9
  description: |
@@ -13,7 +13,7 @@ description: |
13
13
  reloadable: false
14
14
 
15
15
  # System version requirement.
16
- sys_version: '>= 2.0.0'
16
+ sys_version: '>= 2.1.0'
17
17
 
18
18
  category: :system
19
19
 
@@ -10,10 +10,62 @@
10
10
 
11
11
  require 'sequel'
12
12
 
13
- # @private Inner workings of Ticket
13
+ # Inner workings of Ticket
14
14
  module TicketService
15
+
16
+
17
+ =begin
18
+
19
+ # Here is an example how to implement "simple" upload value management.
20
+ #
21
+ # Define the component in yaml like this:
22
+ #
23
+ # - class: HUploader
24
+ # rect: [ 10, 10, 200, 24 ]
25
+ # bind: :values.upload
26
+ # options:
27
+ # label: Upload
28
+ # events:
29
+ # click: true
30
+ #
31
+ #
32
+ # Expects a value named :upload, it is defined like this in values.yaml:
33
+ #
34
+ # :upload:
35
+ # :responders:
36
+ # - :method: upload
37
+ #
38
+ #
39
+ class UploadPlugin < GUIPlugin
40
+ def init_ses_values( msg )
41
+ super
42
+ upload_id( msg )
43
+ end
44
+ def restore_ses_values( msg )
45
+ super
46
+ upload_id( msg )
47
+ end
48
+ def upload_id( msg )
49
+ upload_ticket = ticket.upload_key( msg, get_ses( msg, :upload ).value_id )
50
+ get_ses( msg, :upload ).set( msg, upload_ticket )
51
+ end
52
+ def upload( msg, value )
53
+ if value.data.start_with?('2:::') # upload is completed
54
+ ticket_id = value.data.split(':::')[1]
55
+ ticket_data = ticket.get_uploads( ticket_id, true )
56
+ ticket_data.each do |ticket_item|
57
+ file_write( bundle_path( ticket_item[:name], 'uploaded' ), ticket_item[:data] )
58
+ end
59
+ ticket.del_uploads( msg, ticket_id )
60
+ value.set( msg, '3:::' + ticket_id ) # upload is processed
61
+ elsif value.data.start_with?('4:::') # client wants a new id
62
+ upload_id( msg )
63
+ end
64
+ return true
65
+ end
66
+ end
67
+ =end
15
68
 
16
- # @private Inner workings of Ticket
17
69
  module Upload
18
70
 
19
71
  =begin
@@ -50,7 +102,7 @@ create table rsence_uploads (
50
102
  =end
51
103
  def upload(request,response)
52
104
 
53
- ticket_id = req.unparsed_uri.match(/^#{::RSence.config[:broker_urls][:u]}(.*)$/)[1]
105
+ ticket_id = request.unparsed_uri.match(/^#{::RSence.config[:broker_urls][:u]+'/'}(.*)$/)[1]
54
106
  value_id = request.query['value_id']
55
107
 
56
108
  if not @upload_slots[:by_id].has_key?(ticket_id)
@@ -144,7 +196,7 @@ create table rsence_uploads (
144
196
  else
145
197
  row_datas = @upload_slots[:rsence_uploads][row_id]
146
198
  end
147
- if row_datas.size == 1
199
+ if row_datas.count == 1
148
200
  row_data = row_datas.first
149
201
  row_hash = {
150
202
  :date => Time.at(row_data[:upload_date]),
@@ -167,7 +219,7 @@ create table rsence_uploads (
167
219
  else
168
220
  row_datas = @upload_slots[:rsence_uploads][row_id]
169
221
  end
170
- if row_datas.size == 1
222
+ if row_datas.count == 1
171
223
  row_data = row_datas.first
172
224
  row_hash = {
173
225
  :date => Time.at(row_data[:upload_date]),
@@ -66,7 +66,8 @@ class TicketPlugin < Plugin
66
66
  # @private Implements this part of the {RSence::Plugins::Servlet__ Servlet} API on a plugin to match the {#broker_urls}
67
67
  def match( uri, request_type )
68
68
  if request_type == :post
69
- return true if uri[0..2] == broker_urls[:u]
69
+ upload_match = uri.start_with?( broker_urls[:u] + '/')
70
+ return true if upload_match
70
71
  elsif request_type == :get
71
72
  if uri.match( /^#{broker_urls[:i]}/ )
72
73
  return true
@@ -118,7 +119,7 @@ class TicketPlugin < Plugin
118
119
  # @private Handles the upload request
119
120
  def post( req, res, ses )
120
121
  uri = req.fullpath
121
- if uri[0..2] == broker_urls[:u]
122
+ if uri.start_with?( broker_urls[:u] + '/')
122
123
  puts "/U: #{uri.inspect}" if RSence.args[:verbose]
123
124
  @ticketserve.upload( req, res )
124
125
  end
@@ -178,9 +179,14 @@ class TicketPlugin < Plugin
178
179
  @ticketserve.serve( msg, content, format, type )
179
180
  end
180
181
 
181
- # @private Removes data used by the session
182
+ # @private Removes data used by the session, takes session id
183
+ def expire_ses_id( ses_id )
184
+ @ticketserve.expire_ses( ses_id )
185
+ end
186
+
187
+ # @private Removes data used by the session, takes msg
182
188
  def expire_ses( msg )
183
- @ticketserve.expire_ses( msg.ses_id )
189
+ expire_ses_id( msg.ses_id )
184
190
  end
185
191
 
186
192
  # Sets a custom favicon for RSence
@@ -3,11 +3,11 @@
3
3
  title: Welcome message
4
4
 
5
5
  # The human-readable version of the package
6
- version: 1.0.1
6
+ version: 1.0.2
7
7
 
8
8
  # A brief description of the package (rdoc formatting supported)
9
9
  description: |
10
10
  This is a simple welcome message plugin. It's installed in new project
11
- environments, when the rsence initenv in executed.
11
+ environments, when the rsence init in executed.
12
12
  You may safely remove this plugin bundle.
13
13
 
@@ -2,7 +2,7 @@
2
2
  <div style="margin-left:40px;margin-top:140px;margin-right:20px">
3
3
  <h1>Congratulations!</h1>
4
4
  <p>This message is served to you by RSence running in your new environment.</p>
5
- <p>The next time you create an RSence environment, use the <code>--blank</code> option of the <code>rsence&nbsp;initenv</code> command to avoid this message.</p>
5
+ <p>The next time you create an RSence environment, use the <code>--blank</code> option of the <code>rsence&nbsp;init</code> command to avoid this message.</p>
6
6
  <p>Use the <code>rsence help</code> command to learn more about the <code>rsence</code> command-line tool and its various commands and options.</p>
7
7
  <p>You may want to install or write some software to run in your new RSence environment next.</p>
8
8
  <p>Go to <a href="http://rsence.org/">rsence.org</a> to learn more about RSence.</p>
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence
3
3
  version: !ruby/object:Gem::Version
4
- hash: 101
4
+ hash: 11
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
+ - 1
8
9
  - 0
9
- - 9
10
- - 23
11
- version: 2.0.9.23
10
+ version: 2.1.0
12
11
  platform: ruby
13
12
  authors:
14
13
  - Riassence Inc.
@@ -16,7 +15,7 @@ autorequire:
16
15
  bindir: bin
17
16
  cert_chain: []
18
17
 
19
- date: 2010-08-28 00:00:00 +03:00
18
+ date: 2010-12-01 00:00:00 +02:00
20
19
  default_executable: rsence
21
20
  dependencies:
22
21
  - !ruby/object:Gem::Dependency
@@ -93,14 +92,12 @@ files:
93
92
  - plugins/client_pkg/lib/client_pkg_build.rb
94
93
  - plugins/client_pkg/lib/client_pkg_cache.rb
95
94
  - plugins/client_pkg/lib/client_pkg_serve.rb
96
- - plugins/index_html/img/loading.gif
97
- - plugins/index_html/img/riassence.gif
98
- - plugins/index_html/index_html.rb
99
- - plugins/index_html/info.yaml
100
- - plugins/index_html/tmpl/index.html
95
+ - plugins/main/img/loading.gif
96
+ - plugins/main/img/riassence.gif
101
97
  - plugins/main/info.yaml
102
98
  - plugins/main/js/main.js
103
99
  - plugins/main/main.rb
100
+ - plugins/main/tmpl/index.html
104
101
  - plugins/main/values.yaml
105
102
  - plugins/ticket/info.yaml
106
103
  - plugins/ticket/lib/common.rb
@@ -337,8 +334,22 @@ files:
337
334
  - js/lists/checkboxlist/js.inc
338
335
  - js/lists/listitems/js.inc
339
336
  - js/lists/listitems/listitems.js
337
+ - js/lists/propertylist/js.inc
338
+ - js/lists/propertylist/propertylist.js
339
+ - js/lists/propertylist/propertylisteditor/js.inc
340
+ - js/lists/propertylist/propertylisteditor/propertylisteditor.js
340
341
  - js/lists/radiobuttonlist/js.inc
341
342
  - js/lists/radiobuttonlist/radiobuttonlist.js
343
+ - js/menus/minimenu/js.inc
344
+ - js/menus/minimenu/minimenu.js
345
+ - js/menus/minimenu/minimenuitem/js.inc
346
+ - js/menus/minimenu/minimenuitem/minimenuitem.js
347
+ - js/menus/minimenu/minimenuitem/themes/default/minimenuitem.css
348
+ - js/menus/minimenu/minimenuitem/themes/default/minimenuitem.html
349
+ - js/menus/minimenu/minimenuitem/themes/default/minimenuitem_checkmark.png
350
+ - js/menus/minimenu/themes/default/minimenu.css
351
+ - js/menus/minimenu/themes/default/minimenu.html
352
+ - js/menus/minimenu/themes/default/minimenu.png
342
353
  - js/util/reloadapp/js.inc
343
354
  - js/util/reloadapp/reloadapp.js
344
355
  - js/util/reloadapp/themes/default/reloadapp_warning-ie6.gif
@@ -396,6 +407,6 @@ rubyforge_project: rsence-
396
407
  rubygems_version: 1.3.7
397
408
  signing_key:
398
409
  specification_version: 3
399
- summary: Release 2.0 version of the RSence framework.
410
+ summary: Release 2.1 version of the RSence framework.
400
411
  test_files: []
401
412
 
@@ -1,120 +0,0 @@
1
- ## RSence
2
- # Copyright 2009 Riassence Inc.
3
- # http://riassence.com/
4
- #
5
- # You should have received a copy of the GNU General Public License along
6
- # with this software package. If not, contact licensing@riassence.com
7
- ##
8
-
9
-
10
-
11
- # @private IndexHtmlPlugin is the servlet plugin that is responsible for initializing the "boot-strap page". It's not intended as a part of the public API at this time.
12
- class IndexHtmlPlugin < Servlet
13
-
14
- def match( uri, method )
15
- if uri == ::RSence.config[:index_html][:respond_address] and method == :get
16
- return true
17
- else
18
- return false
19
- end
20
- end
21
-
22
- def score
23
- return 1000 # allows overriding with anything with a score below 1000
24
- end
25
-
26
- def init
27
- @randgen = RandGen.new( 40 )
28
- ::RSence.config[:index_html][:instance] = self
29
- end
30
-
31
- def open
32
- @index_html_src = file_read( ::RSence.config[:index_html][:index_tmpl] )
33
- render_index_html
34
- end
35
-
36
- def close
37
- @plugins[:ticket].del_rsrc( @loading_gif_id )
38
- end
39
-
40
- def render_index_html
41
-
42
- index_html = @index_html_src.clone
43
-
44
- index_html.gsub!('__DEFAULT_TITLE__',::RSence.config[:index_html][:title])
45
- client_rev = @plugins[:client_pkg].client_cache.client_rev
46
- index_html.gsub!('__CLIENT_REV__',client_rev)
47
- index_html.gsub!('__CLIENT_BASE__',File.join(::RSence.config[:broker_urls][:h],client_rev))
48
- index_html.gsub!('__CLIENT_HELLO__',::RSence.config[:broker_urls][:hello])
49
- index_html.gsub!('__NOSCRIPT__',::RSence.config[:index_html][:noscript])
50
-
51
- deps_src = ''
52
- ::RSence.config[:index_html][:deps].each do |dep|
53
- deps_src += %{<script src="#{dep}" type="text/javascript"></script>}
54
- end
55
- index_html.gsub!('__SCRIPT_DEPS__',deps_src)
56
-
57
- return index_html
58
- end
59
-
60
- def session_index_html( request, response )
61
- ses_key = @randgen.gen
62
- sha_key = ''
63
- buffer = [
64
- "var qP=function(cmd){COMM.Queue.push(cmd);};"
65
- ]
66
- req_num = 0
67
- 3.times do |req_num|
68
- sha_key = Digest::SHA1.hexdigest( ses_key + sha_key )
69
- msg = @plugins.transporter.xhr(
70
- request, response, {
71
- :servlet => true,
72
- :cookie => (req_num==0),
73
- :query => {
74
- 'ses_key' => "#{req_num}:.o.:#{sha_key}"
75
- }
76
- }
77
- )
78
- buffer += msg.value_buffer
79
- msg.buffer.each do |buffer_item|
80
- buffer.push( "qP(function(){#{buffer_item};});")
81
- end
82
- ses_key = msg.ses_key
83
- end
84
- buffer.unshift( "COMM.Session.newKey(#{ses_key.to_json});" )
85
- buffer.unshift( "COMM.Session.sha_key=#{sha_key.to_json};" )
86
- buffer.unshift( "COMM.Session.req_num=#{req_num};" )
87
- index_html = render_index_html
88
- return index_html.gsub('__STARTUP_SEQUENCE__', buffer.join("\n") )
89
- end
90
-
91
- ## Outputs a static web page.
92
- def get( request, response, ses )
93
- index_html = render_index_html
94
- support_gzip = (request.header.has_key?('accept-encoding') and \
95
- request.header['accept-encoding'].include?('gzip')) \
96
- and not ::RSence.config[:no_gzip]
97
-
98
- response.status = 200
99
-
100
- response['Content-Type'] = 'text/html; charset=UTF-8'
101
- response['Date'] = httime( Time.now )
102
- response['Server'] = 'RSence'
103
- response['Cache-Control'] = 'no-cache'
104
-
105
- if support_gzip
106
- index_gzip = GZString.new('')
107
- gzwriter = Zlib::GzipWriter.new( index_gzip, 9 )
108
- gzwriter.write( index_html )
109
- gzwriter.close
110
- response['Content-Length'] = index_gzip.length
111
- response['Content-Encoding'] = 'gzip'
112
- response.body = index_gzip
113
- else
114
- response['Content-Length'] = index_html.length
115
- response.body = index_html
116
- end
117
- end
118
-
119
- end
120
-
@@ -1,18 +0,0 @@
1
-
2
- # The human-readable product name of the package
3
- title: Index HTML Page
4
-
5
- # The human-readable version of the package
6
- version: 2.0.0
7
-
8
- # A brief description of the package (rdoc formatting supported)
9
- description: |
10
- This plugin serves the initial html page.
11
-
12
- # System version requirement.
13
- sys_version: '>= 2.0.0'
14
-
15
- category: :system
16
-
17
- depends_on: :client_pkg
18
-