rsence-pre 2.1.0.1.pre

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 (313) hide show
  1. data/.yardopts +10 -0
  2. data/INSTALL.rdoc +330 -0
  3. data/LICENSE.txt +622 -0
  4. data/README.rdoc +98 -0
  5. data/VERSION +1 -0
  6. data/bin/rsence +25 -0
  7. data/bin/rsence-pre +25 -0
  8. data/conf/default_conf.yaml +346 -0
  9. data/conf/default_strings.yaml +76 -0
  10. data/conf/rsence_command_strings.yaml +444 -0
  11. data/docs/ExampleGuiPlugin.rdoc +193 -0
  12. data/docs/JavascriptBundles.rdoc +0 -0
  13. data/docs/PluginBundleInfo.rdoc +173 -0
  14. data/docs/PluginBundles.rdoc +96 -0
  15. data/docs/Values.rdoc +163 -0
  16. data/js/comm/autosync/autosync.js +17 -0
  17. data/js/comm/autosync/js.inc +0 -0
  18. data/js/comm/comm.js +203 -0
  19. data/js/comm/js.inc +0 -0
  20. data/js/comm/jsloader/js.inc +0 -0
  21. data/js/comm/jsloader/jsloader.js +112 -0
  22. data/js/comm/queue/js.inc +0 -0
  23. data/js/comm/queue/queue.js +184 -0
  24. data/js/comm/session/js.inc +0 -0
  25. data/js/comm/session/session.js +52 -0
  26. data/js/comm/sessionwatcher/js.inc +0 -0
  27. data/js/comm/sessionwatcher/sessionwatcher.js +44 -0
  28. data/js/comm/transporter/js.inc +0 -0
  29. data/js/comm/transporter/transporter.js +261 -0
  30. data/js/comm/urlresponder/js.inc +0 -0
  31. data/js/comm/urlresponder/urlresponder.js +149 -0
  32. data/js/comm/values/js.inc +0 -0
  33. data/js/comm/values/values.js +433 -0
  34. data/js/controls/button/button.js +72 -0
  35. data/js/controls/button/js.inc +0 -0
  36. data/js/controls/button/themes/bright/button.css +89 -0
  37. data/js/controls/button/themes/bright/button.html +7 -0
  38. data/js/controls/button/themes/bright/button_parts1-ie6.gif +0 -0
  39. data/js/controls/button/themes/bright/button_parts1.png +0 -0
  40. data/js/controls/button/themes/default/button.css +89 -0
  41. data/js/controls/button/themes/default/button.html +7 -0
  42. data/js/controls/button/themes/default/button_parts1-ie6.gif +0 -0
  43. data/js/controls/button/themes/default/button_parts1.png +0 -0
  44. data/js/controls/checkbox/checkbox.js +49 -0
  45. data/js/controls/checkbox/js.inc +0 -0
  46. data/js/controls/checkbox/themes/default/checkbox.css +69 -0
  47. data/js/controls/checkbox/themes/default/checkbox.html +5 -0
  48. data/js/controls/checkbox/themes/default/checkbox_parts1-ie6.gif +0 -0
  49. data/js/controls/checkbox/themes/default/checkbox_parts1.png +0 -0
  50. data/js/controls/dialogs/alert_sheet/alert_sheet.js +63 -0
  51. data/js/controls/dialogs/alert_sheet/js.inc +0 -0
  52. data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +37 -0
  53. data/js/controls/dialogs/confirm_sheet/js.inc +0 -0
  54. data/js/controls/dialogs/sheet/js.inc +0 -0
  55. data/js/controls/dialogs/sheet/sheet.js +84 -0
  56. data/js/controls/dialogs/sheet/themes/default/sheet.css +64 -0
  57. data/js/controls/dialogs/sheet/themes/default/sheet.html +14 -0
  58. data/js/controls/dialogs/sheet/themes/default/sheet_bg-ie6.gif +0 -0
  59. data/js/controls/dialogs/sheet/themes/default/sheet_bg.png +0 -0
  60. data/js/controls/dialogs/sheet/themes/default/sheet_dim-ie6.gif +0 -0
  61. data/js/controls/dialogs/sheet/themes/default/sheet_dim.png +0 -0
  62. data/js/controls/dialogs/sheet/themes/default/sheet_parts1-ie6.gif +0 -0
  63. data/js/controls/dialogs/sheet/themes/default/sheet_parts1.png +0 -0
  64. data/js/controls/dialogs/sheet/themes/default/sheet_parts2-ie6.gif +0 -0
  65. data/js/controls/dialogs/sheet/themes/default/sheet_parts2.png +0 -0
  66. data/js/controls/dialogs/sheet/themes/default/sheet_warning-ie6.gif +0 -0
  67. data/js/controls/dialogs/sheet/themes/default/sheet_warning.png +0 -0
  68. data/js/controls/imageview/imageview.js +109 -0
  69. data/js/controls/imageview/js.inc +0 -0
  70. data/js/controls/imageview/themes/default/blank.gif +0 -0
  71. data/js/controls/passwordcontrol/js.inc +0 -0
  72. data/js/controls/passwordcontrol/passwordcontrol.js +23 -0
  73. data/js/controls/passwordcontrol/themes/default/passwordcontrol.css +0 -0
  74. data/js/controls/passwordcontrol/themes/default/passwordcontrol.html +18 -0
  75. data/js/controls/progress/progressbar/js.inc +0 -0
  76. data/js/controls/progress/progressbar/progressbar.js +40 -0
  77. data/js/controls/progress/progressbar/themes/default/progressbar.css +16 -0
  78. data/js/controls/progress/progressbar/themes/default/progressbar.html +2 -0
  79. data/js/controls/progress/progressindicator/js.inc +0 -0
  80. data/js/controls/progress/progressindicator/progressindicator.js +44 -0
  81. data/js/controls/radiobutton/js.inc +0 -0
  82. data/js/controls/radiobutton/radiobutton.js +43 -0
  83. data/js/controls/radiobutton/themes/default/radiobutton.css +69 -0
  84. data/js/controls/radiobutton/themes/default/radiobutton.html +5 -0
  85. data/js/controls/radiobutton/themes/default/radiobutton_parts1-ie6.gif +0 -0
  86. data/js/controls/radiobutton/themes/default/radiobutton_parts1.png +0 -0
  87. data/js/controls/sliders/slider/js.inc +0 -0
  88. data/js/controls/sliders/slider/slider.js +357 -0
  89. data/js/controls/sliders/slider/themes/default/hslider_tracks-ie6.gif +0 -0
  90. data/js/controls/sliders/slider/themes/default/hslider_tracks.png +0 -0
  91. data/js/controls/sliders/slider/themes/default/slider.css +108 -0
  92. data/js/controls/sliders/slider/themes/default/slider.html +5 -0
  93. data/js/controls/sliders/slider/themes/default/slider_thumbs-ie6.gif +0 -0
  94. data/js/controls/sliders/slider/themes/default/slider_thumbs.png +0 -0
  95. data/js/controls/sliders/vslider/js.inc +0 -0
  96. data/js/controls/sliders/vslider/themes/default/vslider.css +52 -0
  97. data/js/controls/sliders/vslider/themes/default/vslider.html +5 -0
  98. data/js/controls/sliders/vslider/themes/default/vslider_tracks-ie6.gif +0 -0
  99. data/js/controls/sliders/vslider/themes/default/vslider_tracks.png +0 -0
  100. data/js/controls/sliders/vslider/vslider.js +41 -0
  101. data/js/controls/stepper/js.inc +0 -0
  102. data/js/controls/stepper/stepper.js +213 -0
  103. data/js/controls/stepper/themes/default/stepper-ie6.gif +0 -0
  104. data/js/controls/stepper/themes/default/stepper.css +14 -0
  105. data/js/controls/stepper/themes/default/stepper.html +2 -0
  106. data/js/controls/stepper/themes/default/stepper.png +0 -0
  107. data/js/controls/stringview/js.inc +0 -0
  108. data/js/controls/stringview/stringview.js +49 -0
  109. data/js/controls/stringview/themes/default/stringview.css +8 -0
  110. data/js/controls/stringview/themes/default/stringview.html +1 -0
  111. data/js/controls/tab/js.inc +0 -0
  112. data/js/controls/tab/tab.js +280 -0
  113. data/js/controls/tab/themes/bright/tab.css +76 -0
  114. data/js/controls/tab/themes/bright/tab.html +6 -0
  115. data/js/controls/tab/themes/bright/tab_bg_color-ie6.gif +0 -0
  116. data/js/controls/tab/themes/bright/tab_bg_color.png +0 -0
  117. data/js/controls/tab/themes/bright/tab_border_pattern-ie6.gif +0 -0
  118. data/js/controls/tab/themes/bright/tab_border_pattern.png +0 -0
  119. data/js/controls/tab/themes/bright/tab_parts1-ie6.gif +0 -0
  120. data/js/controls/tab/themes/bright/tab_parts1.png +0 -0
  121. data/js/controls/tab/themes/default/tab.css +77 -0
  122. data/js/controls/tab/themes/default/tab.html +6 -0
  123. data/js/controls/tab/themes/default/tab_bg_color-ie6.gif +0 -0
  124. data/js/controls/tab/themes/default/tab_bg_color.png +0 -0
  125. data/js/controls/tab/themes/default/tab_border_pattern-ie6.gif +0 -0
  126. data/js/controls/tab/themes/default/tab_border_pattern.png +0 -0
  127. data/js/controls/tab/themes/default/tab_parts1-ie6.gif +0 -0
  128. data/js/controls/tab/themes/default/tab_parts1.png +0 -0
  129. data/js/controls/textarea/js.inc +0 -0
  130. data/js/controls/textarea/textarea.js +24 -0
  131. data/js/controls/textarea/themes/default/textarea.css +21 -0
  132. data/js/controls/textarea/themes/default/textarea.html +18 -0
  133. data/js/controls/textcontrol/js.inc +0 -0
  134. data/js/controls/textcontrol/textcontrol.js +374 -0
  135. data/js/controls/textcontrol/themes/default/textcontrol.css +107 -0
  136. data/js/controls/textcontrol/themes/default/textcontrol.html +18 -0
  137. data/js/controls/textcontrol/themes/default/textcontrol_parts1-ie6.gif +0 -0
  138. data/js/controls/textcontrol/themes/default/textcontrol_parts1.png +0 -0
  139. data/js/controls/textcontrol/themes/default/textcontrol_parts2-ie6.gif +0 -0
  140. data/js/controls/textcontrol/themes/default/textcontrol_parts2.png +0 -0
  141. data/js/controls/textcontrol/themes/default/textcontrol_parts3-ie6.gif +0 -0
  142. data/js/controls/textcontrol/themes/default/textcontrol_parts3.png +0 -0
  143. data/js/controls/uploader/js.inc +0 -0
  144. data/js/controls/uploader/themes/default/upload_progress.gif +0 -0
  145. data/js/controls/uploader/themes/default/uploader.css +108 -0
  146. data/js/controls/uploader/themes/default/uploader.html +27 -0
  147. data/js/controls/uploader/uploader.js +154 -0
  148. data/js/controls/validatorview/js.inc +0 -0
  149. data/js/controls/validatorview/themes/default/validator-ie6.gif +0 -0
  150. data/js/controls/validatorview/themes/default/validator.png +0 -0
  151. data/js/controls/validatorview/themes/default/validatorview.css +0 -0
  152. data/js/controls/validatorview/themes/default/validatorview.html +0 -0
  153. data/js/controls/validatorview/validatorview.js +62 -0
  154. data/js/controls/window/js.inc +0 -0
  155. data/js/controls/window/themes/default/window.css +219 -0
  156. data/js/controls/window/themes/default/window.html +17 -0
  157. data/js/controls/window/themes/default/window_bg_active-ie6.gif +0 -0
  158. data/js/controls/window/themes/default/window_bg_active.png +0 -0
  159. data/js/controls/window/themes/default/window_bg_inactive-ie6.gif +0 -0
  160. data/js/controls/window/themes/default/window_bg_inactive.png +0 -0
  161. data/js/controls/window/themes/default/window_buttons-ie6.gif +0 -0
  162. data/js/controls/window/themes/default/window_buttons.png +0 -0
  163. data/js/controls/window/themes/default/window_parts1-ie6.gif +0 -0
  164. data/js/controls/window/themes/default/window_parts1.png +0 -0
  165. data/js/controls/window/themes/default/window_parts2-ie6.gif +0 -0
  166. data/js/controls/window/themes/default/window_parts2.png +0 -0
  167. data/js/controls/window/window.js +286 -0
  168. data/js/core/class/class.js +318 -0
  169. data/js/core/class/js.inc +0 -0
  170. data/js/core/elem/elem.js +1383 -0
  171. data/js/core/elem/js.inc +0 -0
  172. data/js/core/event/event.js +153 -0
  173. data/js/core/event/js.inc +0 -0
  174. data/js/core/iefix/ie_css_element.htc +5 -0
  175. data/js/core/iefix/ie_css_style.htc +5 -0
  176. data/js/core/iefix/iefix.js +359 -0
  177. data/js/core/iefix/js.inc +0 -0
  178. data/js/core/rsence_ns/js.inc +0 -0
  179. data/js/core/rsence_ns/rsence_ns.js +21 -0
  180. data/js/datetime/calendar/calendar.js +198 -0
  181. data/js/datetime/calendar/js.inc +0 -0
  182. data/js/datetime/calendar/themes/default/calendar.css +108 -0
  183. data/js/datetime/calendar/themes/default/calendar.html +9 -0
  184. data/js/datetime/calendar/themes/default/calendar_arrows-ie6.gif +0 -0
  185. data/js/datetime/calendar/themes/default/calendar_arrows.png +0 -0
  186. data/js/datetime/datetimevalue/datetimevalue.js +247 -0
  187. data/js/datetime/datetimevalue/js.inc +0 -0
  188. data/js/datetime/timesheet/js.inc +0 -0
  189. data/js/datetime/timesheet/themes/default/timesheet.css +30 -0
  190. data/js/datetime/timesheet/themes/default/timesheet.html +2 -0
  191. data/js/datetime/timesheet/timesheet.js +183 -0
  192. data/js/datetime/timesheet_item/js.inc +0 -0
  193. data/js/datetime/timesheet_item/themes/default/timesheet_item.css +42 -0
  194. data/js/datetime/timesheet_item/themes/default/timesheet_item.html +8 -0
  195. data/js/datetime/timesheet_item/timesheet_item.js +248 -0
  196. data/js/datetime/timesheet_item_edit/js.inc +0 -0
  197. data/js/datetime/timesheet_item_edit/timesheet_item_edit.js +274 -0
  198. data/js/foundation/application/application.js +208 -0
  199. data/js/foundation/application/js.inc +0 -0
  200. data/js/foundation/control/control.js +339 -0
  201. data/js/foundation/control/controldefaults/controldefaults.js +56 -0
  202. data/js/foundation/control/controldefaults/js.inc +0 -0
  203. data/js/foundation/control/dummyvalue/dummyvalue.js +51 -0
  204. data/js/foundation/control/dummyvalue/js.inc +0 -0
  205. data/js/foundation/control/dyncontrol/dyncontrol.js +500 -0
  206. data/js/foundation/control/dyncontrol/js.inc +0 -0
  207. data/js/foundation/control/dyncontrol/themes/default/dyncontrol.css +0 -0
  208. data/js/foundation/control/dyncontrol/themes/default/dyncontrol.html +0 -0
  209. data/js/foundation/control/eventresponder/eventresponder.js +750 -0
  210. data/js/foundation/control/eventresponder/js.inc +0 -0
  211. data/js/foundation/control/js.inc +0 -0
  212. data/js/foundation/control/valuematrix/js.inc +0 -0
  213. data/js/foundation/control/valuematrix/valuematrix.js +135 -0
  214. data/js/foundation/control/valueresponder/js.inc +0 -0
  215. data/js/foundation/control/valueresponder/valueresponder.js +79 -0
  216. data/js/foundation/eventmanager/eventmanager.js +991 -0
  217. data/js/foundation/eventmanager/js.inc +0 -0
  218. data/js/foundation/geom/point/js.inc +0 -0
  219. data/js/foundation/geom/point/point.js +202 -0
  220. data/js/foundation/geom/rect/js.inc +0 -0
  221. data/js/foundation/geom/rect/rect.js +651 -0
  222. data/js/foundation/json_renderer/js.inc +0 -0
  223. data/js/foundation/json_renderer/json_renderer.js +246 -0
  224. data/js/foundation/system/js.inc +0 -0
  225. data/js/foundation/system/system.js +381 -0
  226. data/js/foundation/thememanager/js.inc +0 -0
  227. data/js/foundation/thememanager/thememanager.js +393 -0
  228. data/js/foundation/value/js.inc +0 -0
  229. data/js/foundation/value/value.js +183 -0
  230. data/js/foundation/view/js.inc +0 -0
  231. data/js/foundation/view/markupview/js.inc +0 -0
  232. data/js/foundation/view/markupview/markupview.js +114 -0
  233. data/js/foundation/view/morphanimation/js.inc +0 -0
  234. data/js/foundation/view/morphanimation/morphanimation.js +237 -0
  235. data/js/foundation/view/view.js +1812 -0
  236. data/js/foundation/view/viewdefaults/js.inc +0 -0
  237. data/js/foundation/view/viewdefaults/viewdefaults.js +26 -0
  238. data/js/lists/checkboxlist/checkboxlist.js +171 -0
  239. data/js/lists/checkboxlist/js.inc +0 -0
  240. data/js/lists/listitems/js.inc +0 -0
  241. data/js/lists/listitems/listitems.js +88 -0
  242. data/js/lists/propertylist/js.inc +0 -0
  243. data/js/lists/propertylist/propertylist.js +326 -0
  244. data/js/lists/radiobuttonlist/js.inc +0 -0
  245. data/js/lists/radiobuttonlist/radiobuttonlist.js +116 -0
  246. data/js/util/reloadapp/js.inc +0 -0
  247. data/js/util/reloadapp/reloadapp.js +152 -0
  248. data/js/util/reloadapp/themes/default/reloadapp_warning-ie6.gif +0 -0
  249. data/js/util/reloadapp/themes/default/reloadapp_warning.png +0 -0
  250. data/js/util/sha/js.inc +0 -0
  251. data/js/util/sha/sha.js +426 -0
  252. data/js/views/centerview/centerview.js +75 -0
  253. data/js/views/centerview/js.inc +0 -0
  254. data/js/views/inlineview/inlineview.js +15 -0
  255. data/js/views/inlineview/js.inc +0 -0
  256. data/js/views/scrollview/js.inc +0 -0
  257. data/js/views/scrollview/scrollview.js +40 -0
  258. data/lib/conf/argv.rb +850 -0
  259. data/lib/conf/default.rb +219 -0
  260. data/lib/daemon/daemon.rb +387 -0
  261. data/lib/daemon/sigcomm.rb +64 -0
  262. data/lib/http/broker.rb +150 -0
  263. data/lib/http/rackup.rb +91 -0
  264. data/lib/http/request.rb +66 -0
  265. data/lib/http/response.rb +65 -0
  266. data/lib/plugins/dependencies.rb +285 -0
  267. data/lib/plugins/gui_plugin.rb +160 -0
  268. data/lib/plugins/guiparser.rb +123 -0
  269. data/lib/plugins/plugin.rb +438 -0
  270. data/lib/plugins/plugin_base.rb +162 -0
  271. data/lib/plugins/plugin_plugins.rb +81 -0
  272. data/lib/plugins/plugin_sqlite_db.rb +98 -0
  273. data/lib/plugins/pluginmanager.rb +635 -0
  274. data/lib/plugins/plugins.rb +169 -0
  275. data/lib/plugins/servlet.rb +108 -0
  276. data/lib/rsence.rb +32 -0
  277. data/lib/session/msg.rb +327 -0
  278. data/lib/session/sessionmanager.rb +522 -0
  279. data/lib/session/sessionstorage.rb +340 -0
  280. data/lib/transporter/transporter.rb +263 -0
  281. data/lib/util/gzstring.rb +9 -0
  282. data/lib/util/ruby19_fixes.rb +18 -0
  283. data/lib/values/hvalue.rb +378 -0
  284. data/lib/values/valuemanager.rb +172 -0
  285. data/plugins/client_pkg/client_pkg.rb +157 -0
  286. data/plugins/client_pkg/info.yaml +25 -0
  287. data/plugins/client_pkg/lib/client_pkg_build.rb +561 -0
  288. data/plugins/client_pkg/lib/client_pkg_cache.rb +50 -0
  289. data/plugins/client_pkg/lib/client_pkg_serve.rb +218 -0
  290. data/plugins/index_html/img/loading.gif +0 -0
  291. data/plugins/index_html/img/riassence.gif +0 -0
  292. data/plugins/index_html/index_html.rb +120 -0
  293. data/plugins/index_html/info.yaml +18 -0
  294. data/plugins/index_html/tmpl/index.html +15 -0
  295. data/plugins/main/info.yaml +18 -0
  296. data/plugins/main/js/main.js +84 -0
  297. data/plugins/main/main.rb +255 -0
  298. data/plugins/main/values.yaml +8 -0
  299. data/plugins/ticket/info.yaml +21 -0
  300. data/plugins/ticket/lib/common.rb +392 -0
  301. data/plugins/ticket/lib/favicon.rb +39 -0
  302. data/plugins/ticket/lib/file.rb +58 -0
  303. data/plugins/ticket/lib/img.rb +50 -0
  304. data/plugins/ticket/lib/objblob.rb +66 -0
  305. data/plugins/ticket/lib/rsrc.rb +34 -0
  306. data/plugins/ticket/lib/upload.rb +236 -0
  307. data/plugins/ticket/ticket.rb +333 -0
  308. data/setup/welcome/gui/welcome.yaml +92 -0
  309. data/setup/welcome/info.yaml +13 -0
  310. data/setup/welcome/text/welcome.html +9 -0
  311. data/setup/welcome/values.yaml +9 -0
  312. data/setup/welcome/welcome.rb +54 -0
  313. metadata +407 -0
@@ -0,0 +1,333 @@
1
+ ## RSence
2
+ # Copyright 2008 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
+ require 'rubygems'
12
+ begin
13
+ require 'RMagick'
14
+ rescue LoadError
15
+ warn "Warning: RMagick not installed, ticketserve images will not be supported." if RSence.args[:verbose]
16
+ end
17
+
18
+ require 'randgen'
19
+
20
+ # the library path of this plugin
21
+ lib_path = File.join( bundle_path, 'lib' )
22
+
23
+ # common functionality
24
+ require File.join(lib_path,'common')
25
+
26
+ # rsrc-related functionality
27
+ require File.join(lib_path,'rsrc')
28
+
29
+ # file-related functionality
30
+ require File.join(lib_path,'file')
31
+
32
+ # upload-related functionality
33
+ require File.join(lib_path,'upload')
34
+
35
+ # img-related functionality
36
+ require File.join(lib_path,'img')
37
+
38
+ # favicon-related functionality
39
+ require File.join(lib_path,'favicon')
40
+
41
+ # smart object wrapper
42
+ require File.join(lib_path,'objblob')
43
+
44
+ # TicketPlugin serves static and disposable data and images. It accepts Magick::Image objects too to render them only when really needed. Each serve-call returns an unique uri to pass to the client.
45
+ # It performs clean-ups based on session and request time-outs.
46
+ #
47
+ # It's available to other plugins as +@plugins.ticket+
48
+ class TicketPlugin < Plugin
49
+
50
+ # @private No user-addressable code inside
51
+ class TicketServe
52
+ include TicketService::Common
53
+ include TicketService::Rsrc
54
+ include TicketService::TicketFile
55
+ include TicketService::Upload
56
+ include TicketService::Img
57
+ include TicketService::Favicon
58
+ include TicketService::ObjBlob
59
+ end
60
+
61
+ # @private Returns the broker's url's. Used in {#match}
62
+ def broker_urls
63
+ ::RSence.config[:broker_urls]
64
+ end
65
+
66
+ # @private Implements this part of the {RSence::Plugins::Servlet__ Servlet} API on a plugin to match the {#broker_urls}
67
+ def match( uri, request_type )
68
+ if request_type == :post
69
+ return true if uri[0..2] == broker_urls[:u]
70
+ elsif request_type == :get
71
+ if uri.match( /^#{broker_urls[:i]}/ )
72
+ return true
73
+ elsif uri.match( /^#{broker_urls[:d]}/ )
74
+ return true
75
+ elsif uri.match( /^#{broker_urls[:f]}/ )
76
+ return true
77
+ elsif uri.match( /^#{broker_urls[:b]}/ )
78
+ return true
79
+ elsif uri == broker_urls[:favicon]
80
+ return true
81
+ elsif uri == broker_urls[:uploader_iframe]
82
+ return true
83
+ end
84
+ end
85
+ return false
86
+ end
87
+
88
+ # @private Override with a lower score, if you want to match some parts in alternative ways.
89
+ def score; 200; end
90
+
91
+ # @private Implements this part of the {RSence::Plugins::Servlet__ Servlet} API on a plugin to respond to get requests matched by the {#match}
92
+ def get( req, res, ses )
93
+ uri = req.fullpath
94
+ if uri.match( /^#{broker_urls[:i]}/ )
95
+ puts "/i: #{uri.inspect}" if RSence.args[:verbose]
96
+ @ticketserve.get_ticket( req, res, :img )
97
+ elsif uri.match( /^#{broker_urls[:d]}/ )
98
+ puts "/d: #{uri.inspect}" if RSence.args[:verbose]
99
+ @ticketserve.get_ticket( req, res, :rsrc )
100
+ elsif uri.match( /^#{broker_urls[:f]}/ )
101
+ puts "/f: #{uri.inspect}" if RSence.args[:verbose]
102
+ @ticketserve.get_ticket( req, res, :file )
103
+ elsif uri.match( /^#{broker_urls[:b]}/ )
104
+ puts "/b: #{uri.inspect}" if RSence.args[:verbose]
105
+ @ticketserve.get_ticket( req, res, :blobobj )
106
+ elsif uri == broker_urls[:favicon]
107
+ @ticketserve.favicon( req, res )
108
+ elsif uri == broker_urls[:uploader_iframe]
109
+ puts "/U/iframe_html: #{uri.inspect}" if RSence.args[:verbose]
110
+ res.status = 200
111
+ http_body = '<html><head><title>Empty Iframe for Uploading</title></head><body></body></html>'
112
+ res['content-type'] = 'text/html; charset=UTF-8'
113
+ res['content-length'] = http_body.size.to_s
114
+ res.body = http_body
115
+ end
116
+ end
117
+
118
+ # @private Handles the upload request
119
+ def post( req, res, ses )
120
+ uri = req.fullpath
121
+ if uri[0..2] == broker_urls[:u]
122
+ puts "/U: #{uri.inspect}" if RSence.args[:verbose]
123
+ @ticketserve.upload( req, res )
124
+ end
125
+ end
126
+
127
+ # @private Initializes storage.
128
+ def init # :nodoc:
129
+ super
130
+ @ticketserve = TicketServe.new
131
+ end
132
+
133
+ # @private Shuts down TicketServe
134
+ def shutdown
135
+ @ticketserve.shutdown
136
+ end
137
+
138
+ # API for BlobObj's
139
+ class BlobObj
140
+
141
+ # @param [String] data The data to serve
142
+ # @param [String] mime The content-type of the data to serve
143
+ def initialize(data,mime)
144
+ @data = data
145
+ @mime = mime
146
+ end
147
+
148
+ # @return [String] The content-type served
149
+ def mime
150
+ return @mime
151
+ end
152
+
153
+ # @return [String] The data served
154
+ def data
155
+ return @data
156
+ end
157
+
158
+ # @return [Number] The size (in bytes) of the data
159
+ def size
160
+ return @data.size
161
+ end
162
+
163
+ # Implement, if you need to do cleanup before destructing
164
+ def close
165
+ end
166
+
167
+ end
168
+
169
+ # Serves an RMagick::Image object accessible by a disposable ticket URL.
170
+ #
171
+ # @param [Message] msg The message instance.
172
+ # @param [#to_blob] content Image data to serve
173
+ # @param [String] format To pass on as a +{ self.format = format }+ block of +content#to_blob+
174
+ # @param [Symbol] type The type of the object.
175
+ #
176
+ # @return [String] Disposable URL. Destroyed after being requested.
177
+ def serve( msg, content, format='PNG', type=:img )
178
+ @ticketserve.serve( msg, content, format, type )
179
+ end
180
+
181
+ # @private Removes data used by the session
182
+ def expire_ses( msg )
183
+ @ticketserve.expire_ses( msg.ses_id )
184
+ end
185
+
186
+ # Sets a custom favicon for RSence
187
+ #
188
+ # @param [String] ico_data Favicon-compatible image data in binary.
189
+ # @param [String] content_type The content-type of the favicon image data.
190
+ #
191
+ # @return [nil]
192
+ def set_favicon( ico_data, content_type=false )
193
+ @ticketserve.set_favicon( ico_data, content_type )
194
+ end
195
+
196
+ # Removes a downloadable file resource served from memory.
197
+ #
198
+ # Does not delete any files from the file system.
199
+ #
200
+ # @param [Message] msg The message instance.
201
+ # @param [String] file_id The file url returned by {#serve_file}
202
+ #
203
+ # @return [nil]
204
+ def del_file( msg, file_id )
205
+ @ticketserve.del_file( file_id, msg.ses_id )
206
+ end
207
+
208
+ # Serves a downloadable file resource to be served from memory using a generated url.
209
+ #
210
+ # @param [Message] msg The message instance.
211
+ # @param [String] content The file attachment file data in binary.
212
+ # @param [String] content_type The content-type of the file attachment.
213
+ # @param [String] filename The filename of the download (not the url)
214
+ #
215
+ # @return [String] Disposable URL. Destroyed after being requested.
216
+ def serve_file( msg, content='', content_type='text/plain', filename='' )
217
+ @ticketserve.serve_file( msg, content, content_type, filename )
218
+ end
219
+
220
+ # Removes a downloadable file resource served from memory.
221
+ #
222
+ # Does not delete any files from the file system.
223
+ #
224
+ # @param [Message] msg The message instance.
225
+ # @param [String] img_id The image url returned by {#serve_img}
226
+ #
227
+ # @return [nil]
228
+ def del_img( msg, img_id )
229
+ @ticketserve.del_img( img_id, msg.ses_id )
230
+ end
231
+
232
+ # Serves a downloadable file resource to be served from memory using a generated url.
233
+ #
234
+ # @param [Message] msg The message instance.
235
+ # @param [#to_blob] content Image data to serve
236
+ # @param [String] format To pass on as a +{ self.format = format }+ block of +content#to_blob+
237
+ # @param [Symbol] type The type of the object.
238
+ #
239
+ # @return [String] Disposable URL. Destroyed after being requested.
240
+ def serve_img( msg, content, format='PNG', type=:img )
241
+ @ticketserve.serve_img( msg, content, format, type )
242
+ end
243
+
244
+ # @return [BlobObj] to be used for custom objects served by {#serve_obj}
245
+ def proto_obj
246
+ return BlobObj
247
+ end
248
+
249
+ # Serves custom object using the {BlobObj} API (Binary Large Object)
250
+ #
251
+ # @param [Message] msg The message instance.
252
+ # @param [BlobObj] blob_obj The custom object to serve.
253
+ # @param [Boolean] no_expire When true, keeps in memory until {#del_obj} is called manually.
254
+ #
255
+ # @return [String] URL. Destroyed after being requested, unless +no_expire+ is +true+.
256
+ def serve_obj( msg, blob_obj, no_expire=false )
257
+ @ticketserve.serve_blobobj( msg, blob_obj, no_expire )
258
+ end
259
+
260
+ # Deletes a custom object served by {#serve_obj}
261
+ #
262
+ # @param [Message] msg The message instance.
263
+ # @param [String] ticket_id The object url returned by {#serve_img}
264
+ #
265
+ # @return [nil]
266
+ def del_obj( msg, ticket_id )
267
+ @ticketserve.del_blobobj( ticket_id, msg.ses_id )
268
+ end
269
+
270
+ # Removes static resource served by {#serve_rsrc}
271
+ #
272
+ # @param [String] rsrc_id The object url returned by {#serve_rsrc}
273
+ #
274
+ # @return [nil]
275
+ def del_rsrc( rsrc_id )
276
+ @ticketserve.del_rsrc( rsrc_id )
277
+ end
278
+
279
+ # Serves static resource as from raw binary data.
280
+ #
281
+ # @param [String] content Any binary data to serve
282
+ # @param [String] content_type The content-type to serve the +content+ as.
283
+ #
284
+ # @return [String] A static url. Use {#del_rsrc} manually to free the memory occupied by the content.
285
+ def serve_rsrc( content, content_type )
286
+ @ticketserve.serve_rsrc( content, content_type )
287
+ end
288
+
289
+ # Returns a list of uploads matching the ticket id.
290
+ #
291
+ # @param [String] ticket_id The key for the upload, returned by {#upload_key}
292
+ # @param [Boolean] with_data Return data also
293
+ #
294
+ # @return [Array] List of uploaded data matching the ticket_id
295
+ def get_uploads( ticket_id, with_data=false )
296
+ @ticketserve.get_uploads( ticket_id, with_data )
297
+ end
298
+
299
+ # Removes the uploaded data matching both ticket id as well as row id.
300
+ #
301
+ # @param [String] ticket_id The key for the upload, returned by {#upload_key}
302
+ # @param [Number] row_id The row id returned by {#get_uploads}
303
+ #
304
+ # @return [nil]
305
+ def del_upload( ticket_id, row_id )
306
+ @ticketserve.del_upload( ticket_id, row_id )
307
+ end
308
+
309
+ # Removes all uploaded data matching the ticket id
310
+ #
311
+ # @param [Message] msg The message instance.
312
+ # @param [String] ticket_id The key for the upload, returned by {#upload_key}
313
+ #
314
+ # @return [nil]
315
+ def del_uploads( msg, ticket_id )
316
+ @ticketserve.del_uploads( ticket_id, msg.ses_id )
317
+ end
318
+
319
+ # Allocates an upload slot and returns the ticket id to use for {#get_uploads}, {#del_upload} and {#del_uploads}
320
+ #
321
+ # @param [Message] msg The message instance.
322
+ # @param [String] value_key The key for the value associated with the upload. See {RSence::HValue#value_id}
323
+ # @param [Number] max_size The maximum size allowed to upload.
324
+ # @param [RegExp] mime_allow A regular expression to match what types of data are allowed to be uploaded
325
+ # @param [Boolean] allow_multi When false, allows uploading only once per key.
326
+ #
327
+ # @return [String] The ticket id. Use for the {RSence::HValue HValue} used with the client HUploader component. Also use with {#get_uploads}, {#del_upload} and {#del_uploads}
328
+ def upload_key( msg, value_key, max_size=1000000, mime_allow=/(.*?)\/(.*?)/, allow_multi=true )
329
+ @ticketserve.upload_key( msg, value_key, max_size, mime_allow, allow_multi )
330
+ end
331
+ end
332
+
333
+
@@ -0,0 +1,92 @@
1
+ # RSence user interfaces can be defined as YAML files.
2
+ # The structure is converted to JSON for the client and "special" variables are processed by the server.
3
+ # The server tries to find a match in its gui_params for all values that begin with a colon (they are parsed as symbols on ruby).
4
+
5
+ # Read more about YAML on http://yaml.org/
6
+
7
+ # GUITree is used as the type identifier for user interface definition structures.
8
+ type: GUITree
9
+ # The version defines what version of the structure is used. New features are added constantly, each incrementing the version by 0.1
10
+ version: 0.6
11
+
12
+ # List of javascript packages the user interface needs. These are automatically loaded once per session.
13
+ dependencies:
14
+ - default_theme # The default_theme package contains all the theme resources needed when using the default theme.
15
+ - controls # The controls package contains the basic set of widget components.
16
+
17
+ # The root level class for user interfaces must be an instance of HApplication (RSence.GUIApp is extended from the HApplication class).
18
+ class: RSence.GUIApp
19
+ # Each class takes a number of options for its constructor.
20
+ options:
21
+ title: Welcome App
22
+ # The subviews use the class defined above as their parent component.
23
+ subviews:
24
+ # The sheet is used as the main visual container for the gui in this app.
25
+ # HSheet is an component that dims the background and shows a dialog sheet while its value is 0.
26
+ - class: HSheet
27
+ rect: [ 0, 0, 600, 500 ] # For HSheet, the rect defines the inner dialog size (it's always centered).
28
+ bind: :values.close # Values are bound to their component responders using the bind keyword.
29
+ extend: # The extend keyword takes a dictionary of properties to extend the class with.
30
+ # Extending refreshValue with a javascript function that terminates its application,
31
+ # including all the subviews. It's triggered when the value becomes 1, when the Close button is clicked.
32
+ refreshValue: |
33
+ function(){
34
+ this.base();
35
+ if ( this.value==1 ) {
36
+ this.app.die();
37
+ }
38
+ }
39
+ # Subviews of the HSheet, nested visual-logical structure.
40
+ subviews:
41
+ # A button in the lower right corner of the HSheet that triggers destruction of this GUITree (see the extension of HSheet above)
42
+ - class: HClickButton
43
+ rect: [ null, null, 60, 24, 8, 8 ]
44
+ bind: :values.close
45
+ options:
46
+ label: Close
47
+ # A checkbox in the lower right corner of the HSheet that triggers an server action to disable the whole plugin when combined with the close button's value.
48
+ - class: HCheckbox
49
+ rect: [ null, null, 130, 24, 74, 8 ]
50
+ bind: :values.dont_show_again
51
+ options:
52
+ label: Don't show again
53
+ # The HScrollView contains a number of subviews that are inside its scrollbars (if the inner content area is bigger than the outer dimensions of HScrollView itself).
54
+ - class: HScrollView
55
+ rect: [ 0, 0, 550, 300, 0, 42 ] # This rectangle stretches the component to contain all of the parent's space except the bottom-most 42 pixels.
56
+ options:
57
+ scrollX: false # Disables horizontal scroll bars.
58
+ scrollY: auto # Makes vertical scroll bars appear automatically when needed.
59
+ style: # Custom styling using style properties. There are several ways to display nested arrays. This is one:
60
+ - [ 'background-color', 'white' ]
61
+ - [ 'border-bottom', '1px solid black' ]
62
+ # Subviews of the HScrollView; items inside are displayed inside the scrollbars.
63
+ subviews:
64
+ # The RSence logo image:
65
+ - class: HImageView
66
+ rect: [ 18, 10, 559, 110 ]
67
+ options:
68
+ # Images use the value as the URL of the image.
69
+ value: http://rsence.org/rsence_org_logo.gif
70
+ # A plain view containing a hyperlink, positioned in the right bottom corner of the logo image.
71
+ - class: HView
72
+ rect: [ null, 95, 310, 25, 35, null ]
73
+ options:
74
+ html: |
75
+ <i style="font-family:Helvetica,Arial,sans-serif;font-size:16px;">
76
+ <a style="color:#28c;font-weight:bold" href="http://rsence.org/">http://www.rsence.org/</a>
77
+ </i>
78
+ style: # Another way to define nested arrays for the style:
79
+ - - text-align
80
+ - right
81
+ # The HInlineView is a simple HTML container, designed to contain "flowing layout" html.
82
+ - class: HInlineView
83
+ rect: [ 0, 0, null, null, 0, 0 ]
84
+ options:
85
+ html: :text.welcome # See the gui_params method of welcome.rb to understand how the contents of the text/welcome.html files is linked like this.
86
+ style:
87
+ - - font-family
88
+ - 'Helvetica, Arial, sans-serif'
89
+ - - font-size
90
+ - 16px
91
+ - - line-height
92
+ - 20px
@@ -0,0 +1,13 @@
1
+
2
+ # The human-readable product name of the package
3
+ title: Welcome message
4
+
5
+ # The human-readable version of the package
6
+ version: 1.0.1
7
+
8
+ # A brief description of the package (rdoc formatting supported)
9
+ description: |
10
+ This is a simple welcome message plugin. It's installed in new project
11
+ environments, when the rsence initenv in executed.
12
+ You may safely remove this plugin bundle.
13
+
@@ -0,0 +1,9 @@
1
+ <!-- This data is included in the gui/welcome.yaml via the gui_params method in the welcome.rb file. -->
2
+ <div style="margin-left:40px;margin-top:140px;margin-right:20px">
3
+ <h1>Congratulations!</h1>
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>
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
+ <p>You may want to install or write some software to run in your new RSence environment next.</p>
8
+ <p>Go to <a href="http://rsence.org/">rsence.org</a> to learn more about RSence.</p>
9
+ </span>
@@ -0,0 +1,9 @@
1
+ # Value for the checkbox. When true combined with 1 of the close value, disables the plugin. See welcome.rb
2
+ :dont_show_again:
3
+ :value: false
4
+
5
+ # Value for the close button.
6
+ :close:
7
+ :value: 0
8
+ :responders: # See the 'close_button' method of welcome.rb to see what a responder is.
9
+ - :method: close_button
@@ -0,0 +1,54 @@
1
+ ## RSence
2
+ # Copyright 2010 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
+ # RSence 'Welcome' plugin.
11
+ # An instance of a class extended from GUIPlugin includes basic functionality
12
+ # to initialize their user interface from YAML files without extra code.
13
+ class WelcomePlugin < GUIPlugin
14
+
15
+ def gui_params( msg )
16
+ params = super
17
+ params[:text] = {
18
+ :welcome => file_read('text/welcome.html')
19
+ }
20
+ return params
21
+ end
22
+
23
+ # Responder for the value defined as `:close` in values.yaml
24
+ # A responder is called whenever its value is changed on the client.
25
+ def close_button( msg, value )
26
+
27
+ # Gets the value of the checkbox
28
+ dont_show_again = get_ses(msg)[:dont_show_again]
29
+
30
+ # If both the checkbox is checked (true) and the button clicked,
31
+ # calls the disable_self method defined below.
32
+ if (value.data == 1) and (dont_show_again.data == true)
33
+ disable_self
34
+ end
35
+
36
+ # For most uses of HClickButton combined with a value, resetting the data
37
+ # to 0 (to make the button clickable again) is done like this:
38
+ # value.set( msg, 0 )
39
+
40
+ # Responders should always return true, until more specific return
41
+ # values are defined in a future version of RSence.
42
+ # Returning false causes the responder to be called on every request
43
+ # the client makes until the responder returns true.
44
+ return true
45
+ end
46
+
47
+ # Called by close_button, when the checkbox is checked (true) and the Close-button is clicked (1).
48
+ def disable_self
49
+ file_write( 'disabled', 'This plugin is disabled. Remove this file to re-enable.' )
50
+ @plugins.unload_bundle( @name )
51
+ end
52
+
53
+ end
54
+