rsence 2.0.0.5.pre → 2.0.0.6.pre
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +2 -2
- data/VERSION +1 -1
- data/bin/rsence +4 -1
- data/conf/default_conf.yaml +1 -1
- data/conf/rsence_command_strings.yaml +444 -0
- data/js/comm/comm/autosync/autosync.js +1 -1
- data/js/comm/comm/comm.js +1 -1
- data/js/comm/comm/queue/queue.js +1 -1
- data/js/comm/comm/session/session.js +1 -1
- data/js/comm/comm/sessionwatcher/sessionwatcher.js +1 -1
- data/js/comm/comm/transporter/transporter.js +1 -1
- data/js/comm/comm/urlresponder/urlresponder.js +1 -1
- data/js/comm/comm/values/values.js +1 -1
- data/js/comm/jsloader/jsloader.js +1 -1
- data/js/comm/reloadapp/reloadapp.js +1 -1
- data/js/comm/sha/sha.js +1 -1
- data/js/comm/values/value/value.js +1 -1
- data/js/comm/values/valuematrix/valuematrix.js +1 -1
- data/js/controls/button/button.js +1 -1
- data/js/controls/checkbox/checkbox.js +1 -1
- data/js/controls/datetime/calendar/calendar.js +1 -1
- data/js/controls/datetime/datetimevalue/datetimevalue.js +1 -1
- data/js/controls/datetime/timesheet/timesheet.js +1 -1
- data/js/controls/datetime/timesheet_item/timesheet_item.js +1 -1
- data/js/controls/datetime/timesheet_item_edit/timesheet_item_edit.js +1 -1
- data/js/controls/dialogs/alert_sheet/alert_sheet.js +1 -1
- data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +1 -1
- data/js/controls/dialogs/sheet/sheet.js +1 -1
- data/js/controls/imageview/imageview.js +1 -1
- data/js/controls/lists/checkboxlist/checkboxlist.js +1 -1
- data/js/controls/lists/listitems/listitems.js +1 -1
- data/js/controls/lists/radiobuttonlist/radiobuttonlist.js +1 -1
- data/js/controls/passwordcontrol/passwordcontrol.js +1 -1
- data/js/controls/progress/progressbar/progressbar.js +1 -1
- data/js/controls/progress/progressindicator/progressindicator.js +1 -1
- data/js/controls/radiobutton/radiobutton.js +1 -1
- data/js/controls/sliders/slider/slider.js +1 -1
- data/js/controls/sliders/vslider/vslider.js +1 -1
- data/js/controls/stepper/stepper.js +1 -1
- data/js/controls/stringview/stringview.js +1 -1
- data/js/controls/tab/tab.js +1 -1
- data/js/controls/textarea/textarea.js +1 -1
- data/js/controls/textcontrol/textcontrol.js +1 -1
- data/js/controls/uploader/uploader.js +1 -1
- data/js/controls/validatorview/validatorview.js +6 -2
- data/js/controls/window/window.js +1 -1
- data/js/core/class/class.js +1 -1
- data/js/core/elem/elem.js +1 -1
- data/js/core/event/event.js +1 -1
- data/js/core/iefix/iefix.js +1 -1
- data/js/foundation/application/application.js +1 -1
- data/js/foundation/control/control.js +1 -1
- data/js/foundation/control/controldefaults/controldefaults.js +1 -1
- data/js/foundation/control/dummyvalue/dummyvalue.js +1 -1
- data/js/foundation/control/dyncontrol/dyncontrol.js +1 -1
- data/js/foundation/control/eventresponder/eventresponder.js +1 -1
- data/js/foundation/control/valueresponder/valueresponder.js +1 -1
- data/js/foundation/geom/point/point.js +1 -1
- data/js/foundation/geom/rect/rect.js +1 -1
- data/js/foundation/json_renderer/json_renderer.js +1 -1
- data/js/foundation/system/system.js +1 -1
- data/js/foundation/thememanager/thememanager.js +1 -1
- data/js/foundation/view/markupview/markupview.js +1 -1
- data/js/foundation/view/morphanimation/morphanimation.js +1 -1
- data/js/foundation/view/view.js +1 -1
- data/js/foundation/view/viewdefaults/viewdefaults.js +1 -1
- data/js/views/centerview/centerview.js +1 -1
- data/js/views/inlineview/inlineview.js +1 -1
- data/js/views/scrollview/scrollview.js +1 -1
- data/lib/conf/argv.rb +719 -1006
- data/lib/conf/default.rb +14 -3
- data/lib/daemon/daemon.rb +1 -1
- data/lib/daemon/sigcomm.rb +1 -1
- data/lib/http/broker.rb +5 -1
- data/lib/http/rackup.rb +1 -1
- data/lib/http/request.rb +1 -1
- data/lib/http/response.rb +2 -2
- data/lib/plugins/dependencies.rb +36 -0
- data/lib/plugins/gui_plugin.rb +83 -80
- data/lib/plugins/guiparser.rb +7 -3
- data/lib/plugins/plugin.rb +308 -307
- data/lib/plugins/plugin_plugins.rb +5 -1
- data/lib/plugins/plugin_sqlite_db.rb +5 -1
- data/lib/plugins/plugin_util.rb +22 -0
- data/lib/plugins/pluginmanager.rb +95 -95
- data/lib/plugins/plugins.rb +117 -0
- data/lib/plugins/servlet.rb +47 -57
- data/lib/session/msg.rb +1 -1
- data/lib/session/sessionmanager.rb +1 -1
- data/lib/session/sessionstorage.rb +2 -2
- data/lib/transporter/transporter.rb +1 -2
- data/lib/values/hvalue.rb +7 -3
- data/lib/values/valuemanager.rb +7 -1
- data/plugins/client_pkg/client_pkg.rb +15 -48
- data/plugins/client_pkg/info.yaml +1 -1
- data/plugins/client_pkg/lib/client_pkg_build.rb +1 -1
- data/plugins/client_pkg/lib/client_pkg_cache.rb +1 -1
- data/plugins/index_html/index_html.rb +5 -6
- data/plugins/index_html/info.yaml +21 -0
- data/plugins/index_html/tmpl/index.html +1 -1
- data/plugins/index_html/tmpl/startup_index.html +1 -1
- data/plugins/main/info.yaml +21 -0
- data/plugins/main/main.rb +1 -5
- data/plugins/{ticketservices → ticket}/lib/common.rb +92 -2
- data/plugins/{ticketservices → ticket}/lib/favicon.rb +1 -1
- data/plugins/{ticketservices → ticket}/lib/file.rb +1 -1
- data/plugins/{ticketservices → ticket}/lib/img.rb +1 -1
- data/plugins/{ticketservices → ticket}/lib/objblob.rb +1 -1
- data/plugins/{ticketservices → ticket}/lib/rsrc.rb +1 -1
- data/plugins/{ticketservices → ticket}/lib/upload.rb +60 -31
- data/plugins/{ticketservices/ticketservices.rb → ticket/ticket.rb} +50 -118
- data/{plugins → setup}/legacy/info.yaml +0 -0
- data/{plugins → setup}/legacy/legacy.rb +2 -0
- data/setup/welcome/welcome.rb +1 -1
- metadata +27 -21
- data/conf/config.yaml +0 -4
- data/conf/local_conf.yaml.devel +0 -14
- data/lib/conf/wizard.rb +0 -303
- data/plugins/client_pkg/log/build_log +0 -0
- data/plugins/legacy/disabled +0 -0
- data/plugins/legacy/disabled- +0 -0
data/lib/session/msg.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
##
|
1
|
+
## RSence
|
2
2
|
# Copyright 2006 Riassence Inc.
|
3
3
|
# http://riassence.com/
|
4
4
|
#
|
@@ -83,7 +83,7 @@ class SessionStorage
|
|
83
83
|
rescue => e
|
84
84
|
if RSence.args[:debug]
|
85
85
|
err_msg = [
|
86
|
-
"ERROR:
|
86
|
+
"ERROR: SessionStorage couldn't open database",
|
87
87
|
"#{e.class.to_s}, #{e.message}",
|
88
88
|
"Backtrace:",
|
89
89
|
"\t"+e.backtrace.join("\n\t")
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
##
|
2
|
+
## RSence
|
3
3
|
# Copyright 2008 Riassence Inc.
|
4
4
|
# http://riassence.com/
|
5
5
|
#
|
@@ -61,7 +61,6 @@ class Transporter
|
|
61
61
|
end
|
62
62
|
|
63
63
|
def servlet( request_type, request, response )
|
64
|
-
|
65
64
|
broker_urls = ::RSence.config[:broker_urls]
|
66
65
|
uri = request.fullpath
|
67
66
|
|
data/lib/values/hvalue.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
##
|
1
|
+
## RSence
|
2
2
|
# Copyright 2006 Riassence Inc.
|
3
3
|
# http://riassence.com/
|
4
4
|
#
|
@@ -47,10 +47,14 @@ class HValue
|
|
47
47
|
|
48
48
|
# +HValue+ constructor. Binds HValue automatically to the +Message+ instance
|
49
49
|
# given as parameter. Data given as second parameter.
|
50
|
-
def initialize( msg, data )
|
50
|
+
def initialize( msg, data, meta = { :name => nil } )
|
51
51
|
|
52
52
|
## Get an unique integer id for the value
|
53
|
-
|
53
|
+
if RSence.args[:debug] and meta[:name] and not msg.valuemanager.id_exists?( msg, meta[:name] )
|
54
|
+
@val_id = meta[:name]
|
55
|
+
else
|
56
|
+
@val_id = msg.valuemanager.randgen.gen
|
57
|
+
end
|
54
58
|
|
55
59
|
## set the data of the hvalue
|
56
60
|
set( msg, data, true )
|
data/lib/values/valuemanager.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
##
|
1
|
+
## RSence
|
2
2
|
# Copyright 2006 Riassence Inc.
|
3
3
|
# http://riassence.com/
|
4
4
|
#
|
@@ -47,6 +47,7 @@ class ValueManager
|
|
47
47
|
|
48
48
|
# make a new id
|
49
49
|
new_id = @randgen.gen
|
50
|
+
new_id = @randgen.gen while id_exists?( msg, new_id )
|
50
51
|
|
51
52
|
# get the hvalue
|
52
53
|
val_obj = ses_values[:by_id][old_id]
|
@@ -84,6 +85,11 @@ class ValueManager
|
|
84
85
|
|
85
86
|
end
|
86
87
|
|
88
|
+
# Verifies an
|
89
|
+
def id_exists?( msg, new_id )
|
90
|
+
return msg.session[:values][:by_id].has_key?(new_id)
|
91
|
+
end
|
92
|
+
|
87
93
|
# Parses the json from the client and passes it on to associated values
|
88
94
|
def xhr( msg, syncdata_str )
|
89
95
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
##
|
1
|
+
## RSence
|
2
2
|
# Copyright 2007 Riassence Inc.
|
3
3
|
# http://riassence.com/
|
4
4
|
#
|
@@ -6,56 +6,24 @@
|
|
6
6
|
# with this software package. If not, contact licensing@riassence.com
|
7
7
|
##
|
8
8
|
|
9
|
-
#
|
10
|
-
|
11
|
-
# def method_missing( *foo )
|
12
|
-
# puts "variable missing: #{foo.inspect}"
|
13
|
-
# end
|
14
|
-
# BUNDLE_PATH = self.bundle_path
|
15
|
-
# puts "singleton_methods: #{singleton_methods.inspect}"
|
9
|
+
# the library path of this plugin
|
10
|
+
lib_path = File.join( bundle_path, 'lib' )
|
16
11
|
|
12
|
+
# The ClientPkgCache class:
|
13
|
+
require File.join( lib_path, 'client_pkg_cache' )
|
14
|
+
|
15
|
+
# The ClientPkgServe module:
|
16
|
+
require File.join( lib_path, 'client_pkg_serve' )
|
17
|
+
|
18
|
+
# The ClientPkgBuild class:
|
19
|
+
require File.join( lib_path, 'client_pkg_build' )
|
20
|
+
|
21
|
+
|
22
|
+
## The ClientPkg plugin builds and serves the client packages.
|
17
23
|
class ClientPkg < Servlet
|
18
24
|
|
19
|
-
# def accessor( *args )
|
20
|
-
# puts "accessor args: #{args.inspect}"
|
21
|
-
# end
|
22
|
-
|
23
|
-
# puts "----"
|
24
|
-
# puts bundle_path
|
25
|
-
#
|
26
|
-
# puts self.methods.inspect
|
27
|
-
#
|
28
|
-
# def class_variable_get( *foo )
|
29
|
-
# puts "*"
|
30
|
-
# puts foo.inspect
|
31
|
-
# end
|
32
|
-
# puts "="
|
33
|
-
#
|
34
|
-
# def self.method_missing( method_name, *args, &block )
|
35
|
-
# if method_name == :bundle_path
|
36
|
-
# return Module.nesting[1].bundle_path
|
37
|
-
# elsif method_name == :bundle_name
|
38
|
-
# return Module.nesting[1].bundle_name
|
39
|
-
# elsif method_name == :bundle_info
|
40
|
-
# return Module.nesting[1].bundle_info
|
41
|
-
# elsif method_name == :plugin_manager
|
42
|
-
# return Module.nesting[1].plugin_manager
|
43
|
-
# end
|
44
|
-
# end
|
45
|
-
|
46
|
-
# the library path of this plugin
|
47
|
-
lib_path = File.join( @@bundle_path, 'lib' )
|
48
|
-
|
49
|
-
# The ClientPkgCache class:
|
50
|
-
require File.join(lib_path,'client_pkg_cache')
|
51
|
-
|
52
|
-
# The ClientPkgServe module:
|
53
|
-
require File.join(lib_path,'client_pkg_serve')
|
54
25
|
include ClientPkgServe
|
55
26
|
|
56
|
-
# The ClientPkgBuild class:
|
57
|
-
require File.join(lib_path,'client_pkg_build')
|
58
|
-
|
59
27
|
class BuildLogger
|
60
28
|
def initialize( log_path )
|
61
29
|
@last_time = Time.now
|
@@ -155,7 +123,7 @@ class ClientPkg < Servlet
|
|
155
123
|
|
156
124
|
def close
|
157
125
|
if @thr
|
158
|
-
@thr.kill
|
126
|
+
@thr.kill
|
159
127
|
@thr = false
|
160
128
|
end
|
161
129
|
@client_build.flush
|
@@ -185,5 +153,4 @@ class ClientPkg < Servlet
|
|
185
153
|
|
186
154
|
end
|
187
155
|
|
188
|
-
ClientPkg.new
|
189
156
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
|
1
|
+
## RSence
|
2
2
|
# Copyright 2009 Riassence Inc.
|
3
3
|
# http://riassence.com/
|
4
4
|
#
|
@@ -11,7 +11,7 @@
|
|
11
11
|
|
12
12
|
It just loads, caches and sends the page for now.
|
13
13
|
=end
|
14
|
-
class IndexHtmlPlugin <
|
14
|
+
class IndexHtmlPlugin < Servlet
|
15
15
|
|
16
16
|
def match( uri, method )
|
17
17
|
if uri == ::RSence.config[:index_html][:respond_address] and method == :get
|
@@ -42,7 +42,7 @@ class IndexHtmlPlugin < ServletPlugin
|
|
42
42
|
|
43
43
|
def close
|
44
44
|
# $TICKETSERVE.del_rsrc( @riassence_gif_id )
|
45
|
-
@plugins[:
|
45
|
+
@plugins[:ticket].del_rsrc( @loading_gif_id )
|
46
46
|
end
|
47
47
|
|
48
48
|
def render_index_html
|
@@ -118,6 +118,7 @@ class IndexHtmlPlugin < ServletPlugin
|
|
118
118
|
# puts "index_html"
|
119
119
|
# index_html = session_index_html( request, response )
|
120
120
|
index_html = render_index_html
|
121
|
+
# index_html = index_html.encode(Encoding::BINARY)
|
121
122
|
|
122
123
|
support_gzip = (request.header.has_key?('accept-encoding') and \
|
123
124
|
request.header['accept-encoding'].include?('gzip')) \
|
@@ -127,7 +128,7 @@ class IndexHtmlPlugin < ServletPlugin
|
|
127
128
|
|
128
129
|
response['Content-Type'] = 'text/html; charset=UTF-8'
|
129
130
|
response['Date'] = httime( Time.now )
|
130
|
-
response['Server'] = '
|
131
|
+
response['Server'] = 'RSence'
|
131
132
|
response['Cache-Control'] = 'no-cache'
|
132
133
|
|
133
134
|
if support_gzip
|
@@ -146,5 +147,3 @@ class IndexHtmlPlugin < ServletPlugin
|
|
146
147
|
|
147
148
|
end
|
148
149
|
|
149
|
-
index_html = IndexHtmlPlugin.new
|
150
|
-
|
@@ -0,0 +1,21 @@
|
|
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
|
+
# A flag (when false) prevents the plugin from automatically reload when changed.
|
13
|
+
reloadable: true
|
14
|
+
|
15
|
+
# A flag (when false) enables automatic construction
|
16
|
+
# of the Plugin and Servlet classes contained.
|
17
|
+
inits_self: false
|
18
|
+
|
19
|
+
# System version requirement.
|
20
|
+
sys_version: '>= 2.0.0'
|
21
|
+
|
@@ -2,7 +2,7 @@
|
|
2
2
|
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml" version="-//W3C//DTD XHTML 1.1//EN" xml:lang="en">
|
4
4
|
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
5
|
-
<!-- This page is served to you by
|
5
|
+
<!-- This page is served to you by RSence - http://rsence.org/ -->
|
6
6
|
<title>__DEFAULT_TITLE__</title>
|
7
7
|
<style type="text/css">body{margin:0;padding:0;background-color:#ddd;font-family:Arial,sans-serif;}</style>
|
8
8
|
__SCRIPT_DEPS__
|
@@ -2,7 +2,7 @@
|
|
2
2
|
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
|
3
3
|
<html xmlns="http://www.w3.org/1999/xhtml" version="-//W3C//DTD XHTML 1.1//EN" xml:lang="en">
|
4
4
|
<head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
|
5
|
-
<!-- This page is served to you by
|
5
|
+
<!-- This page is served to you by RSence - http://riassence.com/ -->
|
6
6
|
<title>__DEFAULT_TITLE__</title>
|
7
7
|
<style type="text/css">body{margin:0;padding:0;background-color:#ddd;font-family:Arial,sans-serif;}</style>
|
8
8
|
__SCRIPT_DEPS__
|
@@ -0,0 +1,21 @@
|
|
1
|
+
|
2
|
+
# The human-readable product name of the package
|
3
|
+
title: Main Plugin
|
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 manages communication between client and server.
|
11
|
+
|
12
|
+
# A flag (when false) prevents the plugin from automatically reload when changed.
|
13
|
+
reloadable: true
|
14
|
+
|
15
|
+
# A flag (when false) enables automatic construction
|
16
|
+
# of the Plugin and Servlet classes contained.
|
17
|
+
inits_self: false
|
18
|
+
|
19
|
+
# System version requirement.
|
20
|
+
sys_version: '>= 2.0.0'
|
21
|
+
|
data/plugins/main/main.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
##
|
2
|
+
## RSence
|
3
3
|
# Copyright 2008 Riassence Inc.
|
4
4
|
# http://riassence.com/
|
5
5
|
#
|
@@ -227,8 +227,4 @@ class Main < Plugin
|
|
227
227
|
|
228
228
|
end
|
229
229
|
|
230
|
-
## Initialize and register the plugin.
|
231
|
-
main = Main.new.register( :main )
|
232
|
-
|
233
|
-
|
234
230
|
|
@@ -1,5 +1,5 @@
|
|
1
1
|
#--
|
2
|
-
##
|
2
|
+
## RSence
|
3
3
|
# Copyright 2008 Riassence Inc.
|
4
4
|
# http://riassence.com/
|
5
5
|
#
|
@@ -11,6 +11,96 @@
|
|
11
11
|
module TicketService
|
12
12
|
module Common
|
13
13
|
|
14
|
+
def initialize
|
15
|
+
# storage for tickets to be expired by expiry time
|
16
|
+
# as the key and an array of ids in array as the value
|
17
|
+
@expires = {}
|
18
|
+
@expire_files = {}
|
19
|
+
@expire_blobobj = {}
|
20
|
+
|
21
|
+
# storage for disposable images
|
22
|
+
@imgs = {
|
23
|
+
|
24
|
+
# id is used as the uri
|
25
|
+
:by_id => {},
|
26
|
+
|
27
|
+
# list of image ids by session id
|
28
|
+
:ses_ids => {}
|
29
|
+
}
|
30
|
+
|
31
|
+
# storage for other disposable data
|
32
|
+
@files = {
|
33
|
+
|
34
|
+
# id is used as the uri
|
35
|
+
:by_id => {},
|
36
|
+
|
37
|
+
# list of image ids by session id
|
38
|
+
:ses_ids => {}
|
39
|
+
}
|
40
|
+
|
41
|
+
# an randgen instance used for generating ids (84B long)
|
42
|
+
@randgen = RandGen.new( 84 )
|
43
|
+
|
44
|
+
# supported image content types
|
45
|
+
@content_types = {
|
46
|
+
'GIF' => 'image/gif',
|
47
|
+
'PNG' => 'image/png',
|
48
|
+
'JPG' => 'image/jpeg'
|
49
|
+
}
|
50
|
+
|
51
|
+
# static data, initially for invalid/not found error-gif
|
52
|
+
# also all serve_rsrc items
|
53
|
+
@raw_uris = {
|
54
|
+
'invalid.gif' => ['image/gif','53',['749464839316700090000800000000004e7ebe129f400000000000c200000000700090000020c0c8f70a9c810e0229ea2da1a000b3'].pack('h*')],
|
55
|
+
'favicon.ico' => ['image/gif','371',['749464839316010001005d00005e5e3dd1d1a1ca7dbf983cfeb9dc5ff8f848db1effbd1fff27279609a600cacae9e0e0d0dcaeff8e8fff030303010101848424afffff0000007be7008c8c9bffffff878b9e0eba712fcfffb2b282e9c6000d5900020202bd3a70ababbaf8f834f9f9f9f8f8f887fafafafa49060606fefefe0707700707074e3bc2939353ce6cd50404007d7d6cfafafa8edb34dcfcfc0f0d97fbfbfb000000000000000000000000000000000000000000000000000000000000000000000000000000000000129f401000000000c20000000001000100006009040801058c8420e91a258ca41744380506934656846910140e04051092ca650688d282bc2072bb5303e0728c2330d6fbb15a78249291bbf0d0811102353410124677285190b2e524e110e0f208b890a13176a480b0725211c889b16227a44101f0027931b1d171a745a010b2caea82f15845c9627182e2a2e050f5007af0f1a203329bf52be032d2213ca4501021501400b3'].pack('h*')]
|
56
|
+
}
|
57
|
+
|
58
|
+
@upload_slots = {
|
59
|
+
# upload slots
|
60
|
+
:by_id => {
|
61
|
+
# random key mime max_size session_id
|
62
|
+
# 'test123' => [ '*/*', 15000, 12 ]
|
63
|
+
},
|
64
|
+
# processed uploads
|
65
|
+
:uploaded => {
|
66
|
+
# same key as :by_id rsence_uploads:id
|
67
|
+
# 'test123' => [37483,37546,38759]
|
68
|
+
},
|
69
|
+
# upload ids by session id
|
70
|
+
:ses_ids => {
|
71
|
+
# 12 => ['test123']
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
@blob_objs = {
|
76
|
+
:by_id => {},
|
77
|
+
:ses_ids => {}
|
78
|
+
}
|
79
|
+
|
80
|
+
begin
|
81
|
+
db_uri = ::RSence.config[:database][:ses_db]
|
82
|
+
if db_uri.start_with?('sqlite://')
|
83
|
+
@db = Sequel.sqlite( db_uri.split('sqlite://')[1] )
|
84
|
+
else
|
85
|
+
@db = Sequel.connect( db_uri )
|
86
|
+
end
|
87
|
+
rescue => e
|
88
|
+
if RSence.args[:debug]
|
89
|
+
err_msg = [
|
90
|
+
"ERROR: TicketServices couldn't open database",
|
91
|
+
"#{e.class.to_s}, #{e.message}",
|
92
|
+
"Backtrace:",
|
93
|
+
"\t"+e.backtrace.join("\n\t")
|
94
|
+
].join("\n")+"\n"
|
95
|
+
$stderr.write( err_msg )
|
96
|
+
elsif RSence.args[:verbose]
|
97
|
+
puts "Failed to open database '#{@db_uri}'."
|
98
|
+
puts "Run RSence in debug mode for full error output."
|
99
|
+
end
|
100
|
+
@upload_id = 0
|
101
|
+
@db = false
|
102
|
+
end
|
103
|
+
end
|
14
104
|
|
15
105
|
attr_accessor :raw_uris # :nodoc:
|
16
106
|
attr_accessor :imgs # :nodoc:
|
@@ -23,7 +113,7 @@ module Common
|
|
23
113
|
|
24
114
|
# Disconnects connection to the database.
|
25
115
|
def shutdown # :nodoc:
|
26
|
-
@db.disconnect
|
116
|
+
@db.disconnect if @db
|
27
117
|
end
|
28
118
|
|
29
119
|
# Serves files and images by returning an URI. Content is given as second
|