rsence-pre 2.1.0.13 → 2.1.0.14
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.
- data/VERSION +1 -1
- data/lib/session/sessionstorage.rb +1 -0
- data/plugins/ticket/lib/upload.rb +57 -5
- data/plugins/ticket/ticket.rb +3 -2
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.1.0.
|
1
|
+
2.1.0.14.pre
|
@@ -10,10 +10,62 @@
|
|
10
10
|
|
11
11
|
require 'sequel'
|
12
12
|
|
13
|
-
#
|
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 =
|
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.
|
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.
|
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]),
|
data/plugins/ticket/ticket.rb
CHANGED
@@ -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
|
-
|
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
|
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
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rsence-pre
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 123
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 2
|
8
8
|
- 1
|
9
9
|
- 0
|
10
|
-
-
|
11
|
-
version: 2.1.0.
|
10
|
+
- 14
|
11
|
+
version: 2.1.0.14
|
12
12
|
platform: ruby
|
13
13
|
authors:
|
14
14
|
- Riassence Inc.
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-11-
|
19
|
+
date: 2010-11-17 00:00:00 +02:00
|
20
20
|
default_executable: rsence-pre
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|