rsence-pre 2.1.0.1.pre

Sign up to get free protection for your applications and to get access to all the features.
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,112 @@
1
+ /* RSence
2
+ * Copyright 2007 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
+ /*** = Description
10
+ ** A class for asynchronously fetching Javascript libraries from the server.
11
+ **
12
+ ** Loads and evalueates the code returned as a string from the server.
13
+ ** Use the jsLoader instance to get packaged Javascript libraries from the
14
+ ** standard package url.
15
+ ***/
16
+
17
+ //var//RSence.Foundation
18
+ COMM.JSLoader = HClass.extend({
19
+
20
+ /** = Description
21
+ * Construct with the base url.
22
+ *
23
+ * The this is the base url used by the +load+ method.
24
+ *
25
+ **/
26
+ constructor: function(_uri){
27
+ var _this = this;
28
+ _this._loadedJS = [];
29
+ _this.uri = _uri;
30
+ _this._okayed = false;
31
+ },
32
+
33
+ // Error catcher for failed requests.
34
+ _fail: function(_this,_resp){
35
+ console.log("failed to load js: "+_resp.url);
36
+ },
37
+
38
+ /** = Description
39
+ * Loads a js package using the name.
40
+ *
41
+ * The base url given in the constructor is used as the prefix.
42
+ * Omit the '.js' suffix, because it's appended automatically.
43
+ *
44
+ * = Parameters
45
+ * +_jsName+:: The name of the js file to load (without the .js suffix)
46
+ *
47
+ * = Usage:
48
+ * Uses the main instance set to the base path of the server's
49
+ * js package url. Loads a package containing list components.
50
+ * jsLoader.load('lists');
51
+ *
52
+ **/
53
+ load: function(_jsName){
54
+ var _this = this,
55
+ _isFullUrl = _jsName.slice(0,7) === 'http://' || _jsName.slice(0,8) === 'https://',
56
+ _url = _isFullUrl?_jsName:_this.uri+_jsName+'.js';
57
+ if((_this._loadedJS.indexOf(_url)!==-1)) {
58
+ return;
59
+ }
60
+ COMM.Queue.pause();
61
+ _this._loadedJS.push(_url);
62
+ if(BROWSER_TYPE.symbian && _isFullUrl){
63
+ alert('Sorry, this browser does not support loading external scripts!');
64
+ return;
65
+ }
66
+ else if(BROWSER_TYPE.symbian){
67
+ _this._req = COMM.request(
68
+ _url, {
69
+ onSuccess: function(_resp){
70
+ _this._req = null;
71
+ COMM.Queue.unshiftEval(_resp.X.responseText);
72
+ COMM.Queue.resume();
73
+ },
74
+ onFailure: _this._fail,
75
+ method: 'GET',
76
+ async: true
77
+ }
78
+ );
79
+ return;
80
+ }
81
+ var _script = document.createElement('script');
82
+ if(BROWSER_TYPE.ie){
83
+ _script.onreadystatechange = function(){
84
+ if(this.readyState === 'loaded' || this.readyState === 'complete'){
85
+ COMM.Queue.resume();
86
+ _script.onload = _script.readystatechange = null;
87
+ }
88
+ };
89
+ }
90
+ else {
91
+ _script.onload = function(){
92
+ COMM.Queue.resume();
93
+ };
94
+ }
95
+ _script.src = _url;
96
+ _script.type = 'text/javascript';
97
+ document.getElementsByTagName('head')[0].appendChild(_script);
98
+ }
99
+ });
100
+
101
+ // Makes the standard jsLoader instance based on the client base url
102
+ // of the server when the page is loaded.
103
+ LOAD(
104
+ function(){
105
+ COMM.jsLoader = COMM.JSLoader.nu( COMM.ClientPrefix + '/js/' );
106
+ // backwards compatibility aliases:
107
+ jsLoader = COMM.jsLoader;
108
+ }
109
+ );
110
+
111
+
112
+
File without changes
@@ -0,0 +1,184 @@
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
+ /*** = Description
10
+ ** COMM.Queue executes javascript blocks in a managed queue.
11
+ **
12
+ ** COMM.Queue is used by COMM.Transporter and JSLoader to continue
13
+ ** javascript command execution after a XMLHttpRequest finishes.
14
+ **
15
+ ** COMM.Queue runs as a single instance, dan't try to reconstruct it.
16
+ ***/
17
+ //var//RSence.COMM
18
+ COMM.Queue = HApplication.extend({
19
+
20
+ /** The constructor takes no arguments and starts queue flushing automatically.
21
+ **/
22
+ constructor: function(){
23
+
24
+ // The queue itself, is packed with anonymous functions
25
+ this.commandQueue = [];
26
+
27
+ // Flag to signal the pause and resume status.
28
+ this.paused = false;
29
+
30
+ // Run with priority 10; not too demanding but not too sluggish either
31
+ this.base(10);
32
+ },
33
+
34
+ /** Checks periodically, if the queue needs flushing.
35
+ **/
36
+ onIdle: function(){
37
+ // Runs the flush operation, if the queue is not
38
+ // empty and the state is not resumed:
39
+ !this.paused && this.commandQueue.length !== 0 && this.flush();
40
+ },
41
+
42
+ /** = Description
43
+ * Pauses the queue.
44
+ *
45
+ * Use to stop execution, if some data or code needs to be loaded that the
46
+ * rest of the queue depends on.
47
+ * Typically called before an +XMLHttpRequest+ with the +onSuccess+
48
+ * event defined to call +resume+ when the request is done.
49
+ *
50
+ **/
51
+ pause: function(){
52
+ this.paused = true;
53
+ },
54
+
55
+ /** = Description
56
+ * Resumes queue flushing.
57
+ *
58
+ * Use to resume execuption, when some depending code for the rest
59
+ * of the queue has been loaded.
60
+ * Typically on an +XMLHttpRequest+ +onSuccess+ event.
61
+ *
62
+ **/
63
+ resume: function(){
64
+ this.paused = false;
65
+ this.flush();
66
+ },
67
+
68
+ /** A Group of localizable strings; errors and warnings.
69
+ **/
70
+ STRINGS: {
71
+ ERR: 'COMM.Queue Error: ',
72
+ JS_EXEC_FAIL: 'Failed to execute the Javascript function: ',
73
+ REASON: ' Reason:'
74
+ },
75
+
76
+ /** = Description
77
+ * Flushes the queue until stopped.
78
+ *
79
+ * Iterates through the +commandQueue+ and calls each function.
80
+ * Removes items from the queue after execution.
81
+ *
82
+ **/
83
+ flush: function(){
84
+ var i = 0, // current index in the for-loop.
85
+ _item, // the current item to execute
86
+ _function, // the function to run
87
+ _arguments, // the arguments of the function
88
+ _len = this.commandQueue.length; // the length of the queue
89
+
90
+ // Iterates through the items.
91
+ for(;i<_len;i++){
92
+
93
+ // Checks that the queue hasn't been paused.
94
+ if(this.paused){
95
+ break; // stops flushing, if paused.
96
+ }
97
+
98
+ // The first item in the queue is removed from the queue.
99
+ _item = this.commandQueue.shift();
100
+
101
+ // Execute the item, with arugments if the item
102
+ try{
103
+ if(typeof _item === 'function'){
104
+ _item.call();
105
+ }
106
+ else {
107
+ _function = _item[0];
108
+ _arguments = _item[1];
109
+ _function.apply(this,_arguments);
110
+ }
111
+ }
112
+
113
+ // Displays an error message in the Javascript console, if failure.
114
+ catch(e){
115
+ var _strs = this.STRINGS;
116
+ console.log([
117
+ _strs.ERR_PREFIX,
118
+ _strs.JS_EXEC_FAIL,
119
+ _item,
120
+ _strs.REASON,
121
+ e.description
122
+ ].join(''));
123
+ }
124
+ }
125
+ },
126
+
127
+ /** = Description
128
+ * Adds an item to the beginning of the queue.
129
+ *
130
+ * Use to make the given +_function+ with its
131
+ * optional +_arguments+ the next item to flush.
132
+ *
133
+ * = Parameters:
134
+ * +_function+:: An anonymous function. Contains the code to execute.
135
+ *
136
+ * +_arguments+:: _Optional_ arguments to pass on to the +_function+
137
+ **/
138
+ unshift: function(_function,_arguments){
139
+ if(_arguments!==undefined){
140
+ this.commandQueue.unshift([_function,_arguments]);
141
+ }
142
+ else {
143
+ this.commandQueue.unshift(_function);
144
+ }
145
+ },
146
+
147
+ /** = Description
148
+ * Adds an item to the end of the queue.
149
+ *
150
+ * Use to make the given +_function+ with its
151
+ * optional +_arguments+ the last item to flush.
152
+ *
153
+ * = Parameters:
154
+ * +_function+:: An anonymous function. Contains the code to execute.
155
+ *
156
+ * +_arguments+:: _Optional_ arguments to pass on to the +_function+
157
+ **/
158
+ push: function(_function,_arguments){
159
+ if(_arguments!==undefined){
160
+ this.commandQueue.push([_function,_arguments]);
161
+ }
162
+ else {
163
+ this.commandQueue.push(_function);
164
+ }
165
+ },
166
+
167
+ /** Like +unshift+, but uses the code block as a string to be
168
+ * passed on as an evaluated anonymous function.
169
+ **/
170
+ unshiftEval: function(_evalStr,_arguments){
171
+ var _function;
172
+ eval('_function = function(){'+_evalStr+'}');
173
+ this.unshift(_function);
174
+ },
175
+
176
+ /** Like +push+, but uses the code block as a string to be
177
+ * passed on as an evaluated anonymous function.
178
+ **/
179
+ pushEval: function(_evalStr){
180
+ var _function;
181
+ eval('_function = function(){'+_evalStr+'}');
182
+ this.push(_function);
183
+ }
184
+ }).nu();
File without changes
@@ -0,0 +1,52 @@
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
+ /*** = Description
10
+ ** COMM.Session is the session key manager.
11
+ **
12
+ ** COMM.Session is used by COMM.Transporter to generate key hashes for
13
+ ** the session management of COMM.Transporter's keys.
14
+ **
15
+ ** The server expects this exact algorithm and refuses to serve unless
16
+ ** the SHA1 hash sum of the keys matches.
17
+ **
18
+ ** Uses a +SHA+ instance for generation.
19
+ **
20
+ ** +COMM.Queue+ runs as a single instance, don't try to reconstruct it.
21
+ ***/
22
+ //var//RSence.COMM
23
+ COMM.Session = HClass.extend({
24
+
25
+ /** The constructor takes no arguments.
26
+ **/
27
+ constructor: function(){
28
+ var _this = this;
29
+ _this.sha = SHA.nu(8);
30
+ _this.sha_key = _this.sha.hexSHA1(((new Date().getTime())*Math.random()*1000).toString());
31
+ _this.ses_key = '0:.o.:'+_this.sha_key;
32
+ _this.req_num = 0;
33
+ },
34
+
35
+ /** = Description
36
+ * Generates a new SHA1 sum using a combination of
37
+ * the previous sum and the +_newKey+ given.
38
+ *
39
+ * Sets +self.ses_key+ and +self.sha_key+
40
+ *
41
+ * = Parameters:
42
+ * +_newKey+:: A key set by the server.
43
+ *
44
+ **/
45
+ newKey: function(_sesKey){
46
+ var _this = this,
47
+ _shaKey = _this.sha.hexSHA1(_sesKey+_this.sha_key);
48
+ _this.req_num++;
49
+ _this.ses_key = _this.req_num+':.o.:'+_shaKey;
50
+ _this.sha_key = _shaKey;
51
+ }
52
+ }).nu();
File without changes
@@ -0,0 +1,44 @@
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
+ /*** = Description
11
+ ** The single instance of this class is constructed after the first
12
+ ** handshake request with the server by the 'main' plugin.
13
+ **
14
+ ** It has dual functionality:
15
+ ** - It tells the the client time.
16
+ ** It's available as the server HValue instance
17
+ ** +msg.session[:main][:client_time]+ from
18
+ ** any Plugin instance.
19
+ ** - It polls the server on regular intervals.
20
+ ** The polling interval is defined by the server
21
+ ** as the _timeoutSecs constructor parameter.
22
+ **
23
+ ***/
24
+ //var//RSence.COMM
25
+ COMM.SessionWatcher = HApplication.extend({
26
+ constructor: function( _timeoutSecs, _sesTimeoutValueId ){
27
+
28
+ // onIdle is called when HSystem's ticker count % 100 == 0
29
+ // this means it's 5 seconds with HSystemTickerInterval 50
30
+ this.base(10, 'SesWatcher');
31
+
32
+ // gets the HValue represented by
33
+ // sesTimeoutValueId (:client_time in server)
34
+ this.sesTimeoutValue = COMM.Values.values[_sesTimeoutValueId];
35
+ this.timeoutSecs = _timeoutSecs;
36
+ },
37
+
38
+ // Tells the server the client's current time
39
+ onIdle: function(){
40
+ if((new Date().getTime() - this.sesTimeoutValue.value) > this.timeoutSecs ){
41
+ this.sesTimeoutValue.set( new Date().getTime() );
42
+ }
43
+ }
44
+ });
File without changes
@@ -0,0 +1,261 @@
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
+ /*** = Description
10
+ ** Implements the client-server interface.
11
+ **
12
+ ** COMM.Transporter manages the client side of the server-client-server
13
+ ** data synchronization and the server-client command channel.
14
+ **
15
+ ** It uses COMM.Session for session key handling, COMM.Queue for command
16
+ ** queuing and COMM.Values for data value management.
17
+ **
18
+ ** COMM.Transporter operates in a fully automatic mode and starts when
19
+ ** the document has been loaded.
20
+ **
21
+ ** Don't call any of its methods from your code.
22
+ ***/
23
+ //var//RSence.COMM
24
+ COMM.Transporter = HApplication.extend({
25
+
26
+ /** Sets up the default settings upon construction.
27
+ **/
28
+ constructor: function(){
29
+ var _this = this;
30
+ this.serverLostMessage = 'Server Connection Lost: Reconnecting...';
31
+ _this.label = 'Transporter';
32
+ _this.url = false;
33
+ _this.busy = false;
34
+ _this.stop = true;
35
+ _this._serverInterruptView = false;
36
+ _this._clientEvalError = false;
37
+ _this._busyFlushTimeout = false;
38
+ _this.base(1);
39
+ },
40
+
41
+ /** Tries to (re)connect to the server as often as possible,
42
+ * mandated essentially by the priority of its
43
+ * HApplication instance.
44
+ **/
45
+ onIdle: function(){
46
+ this.sync();
47
+ },
48
+
49
+ /** (Re)sets the priority of itself, effects how
50
+ * frequently +onIdle+ is called.
51
+ * Usually set by the server.
52
+ **/
53
+ poll: function(_pri){
54
+ HSystem.reniceApp(this.appId,_pri);
55
+ },
56
+
57
+ /** Returns the last transaction error of itself. Used by +sync+
58
+ * to report js errors to the server.
59
+ * If no error, returns an empty string.
60
+ **/
61
+ getClientEvalError: function(){
62
+ var _this = COMM.Transporter;
63
+ return _this._clientEvalError?'&err_msg=' +
64
+ COMM.Values._encodeString(_this._clientEvalError):'';
65
+ },
66
+
67
+ /** = Description
68
+ * Handles synchronization responses.
69
+ *
70
+ * Upon a successful request, this method is called by
71
+ * the onSuccess event of the XMLHttpRequest.
72
+ *
73
+ * It splits up the response string and passes the response
74
+ * messages to COMM.Queue for execution.
75
+ *
76
+ * Parameters:
77
+ * +resp+:: The response object.
78
+ *
79
+ **/
80
+ success: function(resp){
81
+ var _this = COMM.Transporter;
82
+ if(!resp.X.responseText){
83
+ _this.failure(resp);
84
+ return;
85
+ }
86
+ var _responseArray = eval(resp.X.responseText),
87
+ i = 1,
88
+ _responseArrayLen = _responseArray.length,
89
+ _sesKey = _responseArray[0],
90
+ _session = COMM.Session,
91
+ _queue = COMM.Queue;
92
+ if(_sesKey === ''){
93
+ console.log('Invalid session, error message should follow...');
94
+ }
95
+ else {
96
+ _session.newKey(_sesKey);
97
+ }
98
+ for(;i<_responseArrayLen;i++){
99
+ try {
100
+ _queue.pushEval( _responseArray[i] );
101
+ }
102
+ catch(e) {
103
+ console.log( 'clientError:'+e+" - "+e.description+' - '+_responseArray[i]);
104
+ _this._clientEvalError = e+" - "+e.description+' - '+_responseArray[i];
105
+ }
106
+ }
107
+ if(_this._serverInterruptView){
108
+ _this._serverInterruptView.die();
109
+ _this._serverInterruptView = false;
110
+ }
111
+ _queue.push( function(){COMM.Transporter.flushBusy();} );
112
+ _queue.flush();
113
+ },
114
+
115
+ /** Sets the +busy+ flag to false and resynchronizes immediately,
116
+ * if COMM.Values contain any unsynchronized values.
117
+ **/
118
+ flushBusy: function(){
119
+ var _this = COMM.Transporter;
120
+ _this.busy = false;
121
+ COMM.Values.tosync.length !== 0 && _this.sync();
122
+ },
123
+ failMessage: function(_title,_message){
124
+ var _this = COMM.Transporter,
125
+ _queue = COMM.Queue;
126
+ console.log('failMessage?');
127
+ _this.stop = true;
128
+ _queue.push(function(){jsLoader.load('default_theme');});
129
+ _queue.push(function(){jsLoader.load('controls');});
130
+ _queue.push(function(){jsLoader.load('servermessage');});
131
+ _queue.push(function(){ReloadApp.nu(_title,_message);});
132
+ },
133
+
134
+ /** Called by the XMLHttpRequest, when there was a failure in communication.
135
+ **/
136
+ failure: function(_resp){
137
+ var _this = COMM.Transporter;
138
+ // server didn't respond, likely network issue.. retry.
139
+ if(_resp.X.status===0){
140
+ console.log(_this.serverLostMessage);
141
+ if(!_this._serverInterruptView){
142
+ _this._serverInterruptView = HView.extend({
143
+ _setFailedResp: function(_resp){
144
+ if(_resp!==undefined){
145
+ this._failedResp = _resp;
146
+ }
147
+ this._errorIndex++;
148
+ return this;
149
+ },
150
+ _retry: function(){
151
+ this._retryIndex++;
152
+ var _resp = this._failedResp;
153
+ COMM.request(
154
+ _resp.url,
155
+ _resp.options
156
+ );
157
+ },
158
+ onIdle: function(){
159
+ var _currentDate = new Date().getTime();
160
+ this.bringToFront();
161
+ if( this._errorIndex > 0 &&
162
+ (this._retryIndex !== this._errorIndex) &&
163
+ (this._lastError + 2000 < _currentDate) &&
164
+ this._failedResp ){
165
+ this._lastError = _currentDate;
166
+ this._retry();
167
+ }
168
+ this.base();
169
+ },
170
+ _errorIndex: 0,
171
+ _retryIndex: 0,
172
+ _lastError: new Date().getTime(),
173
+ die: function(){
174
+ var _app = this.app;
175
+ HSystem.reniceApp(_app.appId,this._origPriority);
176
+ this.base();
177
+ _app.sync();
178
+ },
179
+ drawSubviews: function(){
180
+ var _style = [
181
+ ['padding-left', '8px'],
182
+ ['background-color', '#600'],
183
+ ['text-align','center'],
184
+ ['color', '#fff'],
185
+ ['font-size', '16px'],
186
+ ['opacity', 0.85]
187
+ ], i = 0;
188
+ for( ; i<_style.length; i++ ){
189
+ this.setStyle( _style[i][0], _style[i][1] );
190
+ }
191
+ this.setHTML(this.app.serverLostMessage);
192
+ this._origPriority = HSystem.appPriorities[this.appId];
193
+ if(HSystem.appPriorities[this.appId]<10){
194
+ HSystem.reniceApp(this.appId,10);
195
+ }
196
+ this._anim = HView.extend({
197
+ _animIndex: 0,
198
+ _anim: function(){
199
+ var _targetRect,
200
+ _width = ELEM.getSize(this.parent.elemId)[0];
201
+ this._animIndex++;
202
+ if(this._animIndex%2===0){
203
+ _targetRect = HRect.nu(0,0,80,20);
204
+ }
205
+ else {
206
+ _targetRect = HRect.nu(_width-80,0,_width,20);
207
+ }
208
+ this.animateTo(_targetRect,2000);
209
+ },
210
+ onAnimationEnd: function(){
211
+ if(this.drawn){
212
+ this._anim();
213
+ }
214
+ }
215
+ }
216
+ ).nu( [0,0,80,20], this ).setStyle('background-color','#fff').setStyle('opacity',0.8)._anim();
217
+ }
218
+ }).nu([0,0,200,20,0,null],_this)._setFailedResp(_resp);
219
+ }
220
+ else {
221
+ _this._serverInterruptView._setFailedResp();
222
+ }
223
+ }
224
+ else {
225
+ _this.failMessage('Transporter Error','Transporter was unable to complete the synchronization request.');
226
+ }
227
+ },
228
+
229
+ /** Starts requests.
230
+ **/
231
+ sync: function(){
232
+ if(this.stop){
233
+ // console.log('sync stop');
234
+ return;
235
+ }
236
+ if(this.busy){
237
+ // console.log('sync busy');
238
+ return;
239
+ }
240
+ // console.log('sync.');
241
+ this.busy = true;
242
+ if(window['sesWatcher']){
243
+ sesWatcher.sesTimeoutValue.set( new Date().getTime() );
244
+ }
245
+ var _this = this,
246
+ _values = COMM.Values.sync(),
247
+ _sesKey = 'ses_key='+COMM.Session.ses_key,
248
+ _errorMessage = _this.getClientEvalError(),
249
+ _body = [_sesKey,_errorMessage,_values?'&values='+_values:''].join('');
250
+ COMM.request(
251
+ _this.url, {
252
+ _this: _this,
253
+ onSuccess: COMM.Transporter.success,
254
+ onFailure: COMM.Transporter.failure,
255
+ method: 'POST',
256
+ async: true,
257
+ body: _body
258
+ }
259
+ );
260
+ }
261
+ }).nu();
File without changes