rsence 2.0.0.0.pre

Sign up to get free protection for your applications and to get access to all the features.
Files changed (311) hide show
  1. data/INSTALL.rdoc +295 -0
  2. data/LICENSE +622 -0
  3. data/README.rdoc +24 -0
  4. data/VERSION +1 -0
  5. data/bin/build_client.rb +254 -0
  6. data/bin/help +6 -0
  7. data/bin/launch.rb +120 -0
  8. data/bin/rdoc.sh +2 -0
  9. data/bin/restart +6 -0
  10. data/bin/rsence +120 -0
  11. data/bin/run +6 -0
  12. data/bin/run.rb +6 -0
  13. data/bin/save +6 -0
  14. data/bin/start +6 -0
  15. data/bin/status +6 -0
  16. data/bin/stop +6 -0
  17. data/conf/config.ru +5 -0
  18. data/conf/default_conf.yaml +337 -0
  19. data/conf/default_strings.yaml +77 -0
  20. data/conf/local_conf.yaml +14 -0
  21. data/conf/unicorn.conf +78 -0
  22. data/js/comm/comm/autosync/autosync.js +18 -0
  23. data/js/comm/comm/autosync/js.inc +0 -0
  24. data/js/comm/comm/comm.js +195 -0
  25. data/js/comm/comm/js.inc +0 -0
  26. data/js/comm/comm/queue/js.inc +0 -0
  27. data/js/comm/comm/queue/queue.js +183 -0
  28. data/js/comm/comm/session/js.inc +0 -0
  29. data/js/comm/comm/session/session.js +51 -0
  30. data/js/comm/comm/sessionwatcher/js.inc +0 -0
  31. data/js/comm/comm/sessionwatcher/sessionwatcher.js +43 -0
  32. data/js/comm/comm/transporter/js.inc +0 -0
  33. data/js/comm/comm/transporter/transporter.js +257 -0
  34. data/js/comm/comm/urlresponder/js.inc +0 -0
  35. data/js/comm/comm/urlresponder/urlresponder.js +148 -0
  36. data/js/comm/comm/values/js.inc +0 -0
  37. data/js/comm/comm/values/values.js +432 -0
  38. data/js/comm/jsloader/js.inc +0 -0
  39. data/js/comm/jsloader/jsloader.js +114 -0
  40. data/js/comm/reloadapp/js.inc +0 -0
  41. data/js/comm/reloadapp/reloadapp.js +150 -0
  42. data/js/comm/reloadapp/themes/default/reloadapp_warning-ie6.gif +0 -0
  43. data/js/comm/reloadapp/themes/default/reloadapp_warning.png +0 -0
  44. data/js/comm/sha/js.inc +0 -0
  45. data/js/comm/sha/sha.js +432 -0
  46. data/js/comm/values/value/js.inc +0 -0
  47. data/js/comm/values/value/value.js +182 -0
  48. data/js/comm/values/valuematrix/js.inc +0 -0
  49. data/js/comm/values/valuematrix/valuematrix.js +138 -0
  50. data/js/controls/button/button.js +57 -0
  51. data/js/controls/button/js.inc +0 -0
  52. data/js/controls/button/themes/bright/button.css +89 -0
  53. data/js/controls/button/themes/bright/button.html +7 -0
  54. data/js/controls/button/themes/bright/button_parts1-ie6.gif +0 -0
  55. data/js/controls/button/themes/bright/button_parts1.png +0 -0
  56. data/js/controls/button/themes/default/button.css +89 -0
  57. data/js/controls/button/themes/default/button.html +7 -0
  58. data/js/controls/button/themes/default/button_parts1-ie6.gif +0 -0
  59. data/js/controls/button/themes/default/button_parts1.png +0 -0
  60. data/js/controls/checkbox/checkbox.js +47 -0
  61. data/js/controls/checkbox/js.inc +0 -0
  62. data/js/controls/checkbox/themes/default/checkbox.css +69 -0
  63. data/js/controls/checkbox/themes/default/checkbox.html +5 -0
  64. data/js/controls/checkbox/themes/default/checkbox_parts1-ie6.gif +0 -0
  65. data/js/controls/checkbox/themes/default/checkbox_parts1.png +0 -0
  66. data/js/controls/datetime/calendar/calendar.js +197 -0
  67. data/js/controls/datetime/calendar/js.inc +0 -0
  68. data/js/controls/datetime/calendar/themes/default/calendar.css +108 -0
  69. data/js/controls/datetime/calendar/themes/default/calendar.html +9 -0
  70. data/js/controls/datetime/calendar/themes/default/calendar_arrows-ie6.gif +0 -0
  71. data/js/controls/datetime/calendar/themes/default/calendar_arrows.png +0 -0
  72. data/js/controls/datetime/datetimevalue/datetimevalue.js +246 -0
  73. data/js/controls/datetime/datetimevalue/js.inc +0 -0
  74. data/js/controls/datetime/timesheet/js.inc +0 -0
  75. data/js/controls/datetime/timesheet/themes/default/timesheet.css +30 -0
  76. data/js/controls/datetime/timesheet/themes/default/timesheet.html +2 -0
  77. data/js/controls/datetime/timesheet/timesheet.js +182 -0
  78. data/js/controls/datetime/timesheet_item/js.inc +0 -0
  79. data/js/controls/datetime/timesheet_item/themes/default/timesheet_item.css +42 -0
  80. data/js/controls/datetime/timesheet_item/themes/default/timesheet_item.html +8 -0
  81. data/js/controls/datetime/timesheet_item/timesheet_item.js +247 -0
  82. data/js/controls/datetime/timesheet_item_edit/js.inc +0 -0
  83. data/js/controls/datetime/timesheet_item_edit/timesheet_item_edit.js +274 -0
  84. data/js/controls/dialogs/alert_sheet/alert_sheet.js +62 -0
  85. data/js/controls/dialogs/alert_sheet/js.inc +0 -0
  86. data/js/controls/dialogs/confirm_sheet/confirm_sheet.js +36 -0
  87. data/js/controls/dialogs/confirm_sheet/js.inc +0 -0
  88. data/js/controls/dialogs/sheet/js.inc +0 -0
  89. data/js/controls/dialogs/sheet/sheet.js +83 -0
  90. data/js/controls/dialogs/sheet/themes/default/sheet.css +64 -0
  91. data/js/controls/dialogs/sheet/themes/default/sheet.html +14 -0
  92. data/js/controls/dialogs/sheet/themes/default/sheet_bg-ie6.gif +0 -0
  93. data/js/controls/dialogs/sheet/themes/default/sheet_bg.png +0 -0
  94. data/js/controls/dialogs/sheet/themes/default/sheet_dim-ie6.gif +0 -0
  95. data/js/controls/dialogs/sheet/themes/default/sheet_dim.png +0 -0
  96. data/js/controls/dialogs/sheet/themes/default/sheet_parts1-ie6.gif +0 -0
  97. data/js/controls/dialogs/sheet/themes/default/sheet_parts1.png +0 -0
  98. data/js/controls/dialogs/sheet/themes/default/sheet_parts2-ie6.gif +0 -0
  99. data/js/controls/dialogs/sheet/themes/default/sheet_parts2.png +0 -0
  100. data/js/controls/dialogs/sheet/themes/default/sheet_warning-ie6.gif +0 -0
  101. data/js/controls/dialogs/sheet/themes/default/sheet_warning.png +0 -0
  102. data/js/controls/imageview/imageview.js +108 -0
  103. data/js/controls/imageview/js.inc +0 -0
  104. data/js/controls/imageview/themes/default/blank.gif +0 -0
  105. data/js/controls/lists/checkboxlist/checkboxlist.js +170 -0
  106. data/js/controls/lists/checkboxlist/js.inc +0 -0
  107. data/js/controls/lists/listitems/js.inc +0 -0
  108. data/js/controls/lists/listitems/listitems.js +65 -0
  109. data/js/controls/lists/radiobuttonlist/js.inc +0 -0
  110. data/js/controls/lists/radiobuttonlist/radiobuttonlist.js +126 -0
  111. data/js/controls/passwordcontrol/js.inc +0 -0
  112. data/js/controls/passwordcontrol/passwordcontrol.js +22 -0
  113. data/js/controls/passwordcontrol/themes/default/passwordcontrol.css +0 -0
  114. data/js/controls/passwordcontrol/themes/default/passwordcontrol.html +18 -0
  115. data/js/controls/progress/progressbar/js.inc +0 -0
  116. data/js/controls/progress/progressbar/progressbar.js +36 -0
  117. data/js/controls/progress/progressbar/themes/default/progressbar.css +16 -0
  118. data/js/controls/progress/progressbar/themes/default/progressbar.html +2 -0
  119. data/js/controls/progress/progressindicator/js.inc +0 -0
  120. data/js/controls/progress/progressindicator/progressindicator.js +43 -0
  121. data/js/controls/radiobutton/js.inc +0 -0
  122. data/js/controls/radiobutton/radiobutton.js +41 -0
  123. data/js/controls/radiobutton/themes/default/radiobutton.css +69 -0
  124. data/js/controls/radiobutton/themes/default/radiobutton.html +5 -0
  125. data/js/controls/radiobutton/themes/default/radiobutton_parts1-ie6.gif +0 -0
  126. data/js/controls/radiobutton/themes/default/radiobutton_parts1.png +0 -0
  127. data/js/controls/sliders/slider/js.inc +0 -0
  128. data/js/controls/sliders/slider/slider.js +356 -0
  129. data/js/controls/sliders/slider/themes/default/hslider_tracks-ie6.gif +0 -0
  130. data/js/controls/sliders/slider/themes/default/hslider_tracks.png +0 -0
  131. data/js/controls/sliders/slider/themes/default/slider.css +108 -0
  132. data/js/controls/sliders/slider/themes/default/slider.html +5 -0
  133. data/js/controls/sliders/slider/themes/default/slider_thumbs-ie6.gif +0 -0
  134. data/js/controls/sliders/slider/themes/default/slider_thumbs.png +0 -0
  135. data/js/controls/sliders/vslider/js.inc +0 -0
  136. data/js/controls/sliders/vslider/themes/default/vslider.css +52 -0
  137. data/js/controls/sliders/vslider/themes/default/vslider.html +5 -0
  138. data/js/controls/sliders/vslider/themes/default/vslider_tracks-ie6.gif +0 -0
  139. data/js/controls/sliders/vslider/themes/default/vslider_tracks.png +0 -0
  140. data/js/controls/sliders/vslider/vslider.js +40 -0
  141. data/js/controls/stepper/js.inc +0 -0
  142. data/js/controls/stepper/stepper.js +212 -0
  143. data/js/controls/stepper/themes/default/stepper-ie6.gif +0 -0
  144. data/js/controls/stepper/themes/default/stepper.css +14 -0
  145. data/js/controls/stepper/themes/default/stepper.html +2 -0
  146. data/js/controls/stepper/themes/default/stepper.png +0 -0
  147. data/js/controls/stringview/js.inc +0 -0
  148. data/js/controls/stringview/stringview.js +49 -0
  149. data/js/controls/stringview/themes/default/stringview.css +8 -0
  150. data/js/controls/stringview/themes/default/stringview.html +1 -0
  151. data/js/controls/tab/js.inc +0 -0
  152. data/js/controls/tab/tab.js +276 -0
  153. data/js/controls/tab/themes/bright/tab.css +76 -0
  154. data/js/controls/tab/themes/bright/tab.html +6 -0
  155. data/js/controls/tab/themes/bright/tab_bg_color-ie6.gif +0 -0
  156. data/js/controls/tab/themes/bright/tab_bg_color.png +0 -0
  157. data/js/controls/tab/themes/bright/tab_border_pattern-ie6.gif +0 -0
  158. data/js/controls/tab/themes/bright/tab_border_pattern.png +0 -0
  159. data/js/controls/tab/themes/bright/tab_parts1-ie6.gif +0 -0
  160. data/js/controls/tab/themes/bright/tab_parts1.png +0 -0
  161. data/js/controls/tab/themes/default/tab.css +77 -0
  162. data/js/controls/tab/themes/default/tab.html +6 -0
  163. data/js/controls/tab/themes/default/tab_bg_color-ie6.gif +0 -0
  164. data/js/controls/tab/themes/default/tab_bg_color.png +0 -0
  165. data/js/controls/tab/themes/default/tab_border_pattern-ie6.gif +0 -0
  166. data/js/controls/tab/themes/default/tab_border_pattern.png +0 -0
  167. data/js/controls/tab/themes/default/tab_parts1-ie6.gif +0 -0
  168. data/js/controls/tab/themes/default/tab_parts1.png +0 -0
  169. data/js/controls/textarea/js.inc +0 -0
  170. data/js/controls/textarea/textarea.js +23 -0
  171. data/js/controls/textarea/themes/default/textarea.css +21 -0
  172. data/js/controls/textarea/themes/default/textarea.html +18 -0
  173. data/js/controls/textcontrol/js.inc +0 -0
  174. data/js/controls/textcontrol/textcontrol.js +372 -0
  175. data/js/controls/textcontrol/themes/default/textcontrol.css +107 -0
  176. data/js/controls/textcontrol/themes/default/textcontrol.html +18 -0
  177. data/js/controls/textcontrol/themes/default/textcontrol_parts1-ie6.gif +0 -0
  178. data/js/controls/textcontrol/themes/default/textcontrol_parts1.png +0 -0
  179. data/js/controls/textcontrol/themes/default/textcontrol_parts2-ie6.gif +0 -0
  180. data/js/controls/textcontrol/themes/default/textcontrol_parts2.png +0 -0
  181. data/js/controls/textcontrol/themes/default/textcontrol_parts3-ie6.gif +0 -0
  182. data/js/controls/textcontrol/themes/default/textcontrol_parts3.png +0 -0
  183. data/js/controls/uploader/js.inc +0 -0
  184. data/js/controls/uploader/themes/default/upload_progress.gif +0 -0
  185. data/js/controls/uploader/themes/default/uploader.css +108 -0
  186. data/js/controls/uploader/themes/default/uploader.html +27 -0
  187. data/js/controls/uploader/uploader.js +153 -0
  188. data/js/controls/validatorview/js.inc +0 -0
  189. data/js/controls/validatorview/themes/default/validator-ie6.gif +0 -0
  190. data/js/controls/validatorview/themes/default/validator.png +0 -0
  191. data/js/controls/validatorview/themes/default/validatorview.css +0 -0
  192. data/js/controls/validatorview/themes/default/validatorview.html +0 -0
  193. data/js/controls/validatorview/validatorview.js +55 -0
  194. data/js/controls/window/js.inc +0 -0
  195. data/js/controls/window/themes/default/window.css +219 -0
  196. data/js/controls/window/themes/default/window.html +17 -0
  197. data/js/controls/window/themes/default/window_bg_active-ie6.gif +0 -0
  198. data/js/controls/window/themes/default/window_bg_active.png +0 -0
  199. data/js/controls/window/themes/default/window_bg_inactive-ie6.gif +0 -0
  200. data/js/controls/window/themes/default/window_bg_inactive.png +0 -0
  201. data/js/controls/window/themes/default/window_buttons-ie6.gif +0 -0
  202. data/js/controls/window/themes/default/window_buttons.png +0 -0
  203. data/js/controls/window/themes/default/window_parts1-ie6.gif +0 -0
  204. data/js/controls/window/themes/default/window_parts1.png +0 -0
  205. data/js/controls/window/themes/default/window_parts2-ie6.gif +0 -0
  206. data/js/controls/window/themes/default/window_parts2.png +0 -0
  207. data/js/controls/window/window.js +284 -0
  208. data/js/core/class/class.js +317 -0
  209. data/js/core/class/js.inc +0 -0
  210. data/js/core/elem/elem.js +1376 -0
  211. data/js/core/elem/js.inc +0 -0
  212. data/js/core/event/event.js +1021 -0
  213. data/js/core/event/js.inc +0 -0
  214. data/js/core/iefix/ie_css_element.htc +5 -0
  215. data/js/core/iefix/ie_css_style.htc +5 -0
  216. data/js/core/iefix/iefix.js +359 -0
  217. data/js/core/iefix/js.inc +0 -0
  218. data/js/debugg/debugg.js +43 -0
  219. data/js/debugg/js.inc +0 -0
  220. data/js/foundation/application/application.js +209 -0
  221. data/js/foundation/application/js.inc +0 -0
  222. data/js/foundation/control/control.js +342 -0
  223. data/js/foundation/control/controldefaults/controldefaults.js +59 -0
  224. data/js/foundation/control/controldefaults/js.inc +0 -0
  225. data/js/foundation/control/dummyvalue/dummyvalue.js +50 -0
  226. data/js/foundation/control/dummyvalue/js.inc +0 -0
  227. data/js/foundation/control/dyncontrol/dyncontrol.js +494 -0
  228. data/js/foundation/control/dyncontrol/js.inc +0 -0
  229. data/js/foundation/control/dyncontrol/themes/default/dyncontrol.css +0 -0
  230. data/js/foundation/control/dyncontrol/themes/default/dyncontrol.html +0 -0
  231. data/js/foundation/control/eventresponder/eventresponder.js +713 -0
  232. data/js/foundation/control/eventresponder/js.inc +0 -0
  233. data/js/foundation/control/js.inc +0 -0
  234. data/js/foundation/control/valueresponder/js.inc +0 -0
  235. data/js/foundation/control/valueresponder/valueresponder.js +77 -0
  236. data/js/foundation/geom/point/js.inc +0 -0
  237. data/js/foundation/geom/point/point.js +202 -0
  238. data/js/foundation/geom/rect/js.inc +0 -0
  239. data/js/foundation/geom/rect/rect.js +610 -0
  240. data/js/foundation/json_renderer/js.inc +0 -0
  241. data/js/foundation/json_renderer/json_renderer.js +231 -0
  242. data/js/foundation/system/js.inc +0 -0
  243. data/js/foundation/system/system.js +369 -0
  244. data/js/foundation/thememanager/js.inc +0 -0
  245. data/js/foundation/thememanager/thememanager.js +387 -0
  246. data/js/foundation/view/js.inc +0 -0
  247. data/js/foundation/view/markupview/js.inc +0 -0
  248. data/js/foundation/view/markupview/markupview.js +113 -0
  249. data/js/foundation/view/morphanimation/js.inc +0 -0
  250. data/js/foundation/view/morphanimation/morphanimation.js +236 -0
  251. data/js/foundation/view/view.js +1804 -0
  252. data/js/foundation/view/viewdefaults/js.inc +0 -0
  253. data/js/foundation/view/viewdefaults/viewdefaults.js +25 -0
  254. data/js/views/centerview/centerview.js +45 -0
  255. data/js/views/centerview/js.inc +0 -0
  256. data/js/views/inlineview/inlineview.js +14 -0
  257. data/js/views/inlineview/js.inc +0 -0
  258. data/js/views/scrollview/js.inc +0 -0
  259. data/js/views/scrollview/scrollview.js +39 -0
  260. data/lib/conf/default.rb +220 -0
  261. data/lib/conf/wizard.rb +303 -0
  262. data/lib/daemon/daemon.rb +293 -0
  263. data/lib/http/broker.rb +102 -0
  264. data/lib/http/rackup.rb +88 -0
  265. data/lib/http/request.rb +69 -0
  266. data/lib/http/response.rb +63 -0
  267. data/lib/plugins/gui_plugin.rb +129 -0
  268. data/lib/plugins/guiparser.rb +114 -0
  269. data/lib/plugins/plugin.rb +652 -0
  270. data/lib/plugins/plugin_plugins.rb +47 -0
  271. data/lib/plugins/plugin_sqlite_db.rb +72 -0
  272. data/lib/plugins/plugin_util.rb +96 -0
  273. data/lib/plugins/pluginmanager.rb +517 -0
  274. data/lib/plugins/servlet.rb +69 -0
  275. data/lib/session/msg.rb +291 -0
  276. data/lib/session/sessionmanager.rb +491 -0
  277. data/lib/session/sessionstorage.rb +314 -0
  278. data/lib/transporter/transporter.rb +254 -0
  279. data/lib/util/gzstring.rb +5 -0
  280. data/lib/values/hvalue.rb +323 -0
  281. data/lib/values/valuemanager.rb +152 -0
  282. data/plugins/client_pkg/client_pkg.rb +186 -0
  283. data/plugins/client_pkg/info.yaml +25 -0
  284. data/plugins/client_pkg/lib/client_pkg_build.rb +569 -0
  285. data/plugins/client_pkg/lib/client_pkg_cache.rb +50 -0
  286. data/plugins/client_pkg/lib/client_pkg_serve.rb +210 -0
  287. data/plugins/client_pkg/log/build_log +0 -0
  288. data/plugins/index_html/img/loading.gif +0 -0
  289. data/plugins/index_html/img/riassence.gif +0 -0
  290. data/plugins/index_html/index_html.rb +150 -0
  291. data/plugins/index_html/tmpl/index.html +22 -0
  292. data/plugins/index_html/tmpl/startup_index.html +29 -0
  293. data/plugins/legacy/disabled +0 -0
  294. data/plugins/legacy/disabled- +0 -0
  295. data/plugins/legacy/info.yaml +22 -0
  296. data/plugins/legacy/legacy.rb +15 -0
  297. data/plugins/main/js/riassence_ns.js +87 -0
  298. data/plugins/main/main.rb +234 -0
  299. data/plugins/main/values.yaml +8 -0
  300. data/plugins/ticketservices/lib/common.rb +300 -0
  301. data/plugins/ticketservices/lib/favicon.rb +38 -0
  302. data/plugins/ticketservices/lib/file.rb +58 -0
  303. data/plugins/ticketservices/lib/img.rb +50 -0
  304. data/plugins/ticketservices/lib/objblob.rb +66 -0
  305. data/plugins/ticketservices/lib/rsrc.rb +34 -0
  306. data/plugins/ticketservices/lib/upload.rb +206 -0
  307. data/plugins/ticketservices/ticketservices.rb +268 -0
  308. data/var/db/.git_include +0 -0
  309. data/var/log/.git_include +0 -0
  310. data/var/run/.git_include +0 -0
  311. metadata +390 -0
File without changes
@@ -0,0 +1,231 @@
1
+ /* Riassence Framework
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
+ /*** Constructs nodes from JSON structures as GUI
11
+ ** tree structures. Lowers the learning curve of GUI
12
+ ** development, because Javascript knowledge is not
13
+ ** required to define user interfaces.
14
+ ** The main purpose is to ease the development of
15
+ ** user interfaces by defining them as data on the
16
+ ** server, converting the data to JSON GUI trees and
17
+ ** letting the client handle the rest. The end result
18
+ ** is the same as defining the structures in
19
+ ** JavaScript code.
20
+ **
21
+ ** This class is still in development, so expect more
22
+ ** features and documentation as it matures.
23
+ ***/
24
+ COMM.JSONRenderer = HClass.extend({
25
+
26
+ version: 0.5,
27
+
28
+ /** = Description
29
+ * Renders JSON structured data, see some of the demos for usage examples.
30
+ *
31
+ * = Parameters:
32
+ * +_data+: The data structure used for building.
33
+ * +_parent+: The parent view (or app) (Optional)
34
+ **/
35
+ constructor: function(_data, _parent){
36
+ if((_data['type'] === 'GUITree') && (this.version >= _data['version'])){
37
+ this.data = _data;
38
+ this.parent = _parent;
39
+ this.render();
40
+ }
41
+ else{
42
+ throw("JSONRenderer: Only GUITree version "+this.version+" or older data can be handled.");
43
+ }
44
+ },
45
+ render: function(){
46
+ this.scopes = [window];
47
+ this.scopeDepth = 0;
48
+ this.view = this.renderNode( this.data, this.parent );
49
+ },
50
+ defineInScope: function( _definition ){
51
+ var _isArr = (_definition instanceof Array),
52
+ _isObj = (_definition instanceof Object);
53
+ if( _isArr || !_isObj ){
54
+ console.log("JSONRenderer; definition must be an Object, got: '"+(typeof _definition)+"'. Definition: ",_definition);
55
+ return;
56
+ }
57
+ var _extension = {},
58
+ _reserved = ['class','extend','implement'],
59
+ _className = _definition[_reserved[0]],
60
+ _extendName = _definition[_reserved[1]],
61
+ _implementName = _definition[_reserved[2]],
62
+ _extend = _extendName?this.findInScope(_extendName):false,
63
+ _implement = _implementName?this.findInScope(_implementName):false,
64
+ _scope = this.scopes[ this.scopeDepth ],
65
+ _key, _value;
66
+ if( _className === undefined ) {
67
+ console.log("JSONRenderer; class name missing in definition scope.");
68
+ return;
69
+ }
70
+ if( !_extend ){
71
+ _extend = HClass;
72
+ }
73
+ for( _key in _definition ){
74
+ if( _reserved.indexOf( _key ) === -1 ){
75
+ _value = _definition[_key];
76
+ _extension[_key] = this.extEval( _value );
77
+ }
78
+ }
79
+ _scope[ _className ] = _extend.extend( _extension );
80
+ if( _implement ){
81
+ _scope[ _className ].implement( _implement );
82
+ }
83
+ },
84
+ undefineInScope: function( ){
85
+
86
+ },
87
+ findInScope: function( _className ){
88
+ if(_className === undefined){
89
+ return false;
90
+ }
91
+ if(_className.indexOf('.') !== -1){
92
+ var _splitClass = _className.split('.'),
93
+ j = 1,
94
+ _classPart = _splitClass[0],
95
+ _classFull = this.findInScope( _classPart );
96
+ if( !_classFull ){
97
+ return false;
98
+ }
99
+ for( ; j < _splitClass.length ; j++ ){
100
+ _classPart = _splitClass[j];
101
+ _classFull = _classFull[ _classPart ];
102
+ if( !_classFull ){
103
+ return false;
104
+ }
105
+ }
106
+ return _classFull;
107
+ }
108
+ var _class = false,
109
+ _scopes = this.scopes,
110
+ i = _scopes.length-1,
111
+ _scope;
112
+ for( ; i > -1 ; i-- ){
113
+ _scope = _scopes[i];
114
+ if( _scope[ _className ] !== undefined ){
115
+ return _scope[ _className ];
116
+ }
117
+ }
118
+ return _class;
119
+ },
120
+ extEval: function(_block){
121
+ if( _block.indexOf("function(") === 0 ){
122
+ eval( '_block = '+_block );
123
+ }
124
+ return _block;
125
+ },
126
+ renderNode: function( _dataNode, _parent ){
127
+ var // Currently only window-level classes are supported
128
+ _className = _dataNode['class'],
129
+ _class = this.findInScope( _className ),
130
+
131
+ // Currently only HView -derived classes are supported, so
132
+ // the rect is mandatory.
133
+ _rect = _dataNode['rect'],
134
+ _hasRect = (_rect !== undefined) && (_rect instanceof Array || typeof _rect === 'string'),
135
+
136
+ // Checks, if any sub-views are defined.
137
+ _hasSubviews = _dataNode['subviews'] !== undefined,
138
+ _subViews = _hasSubviews?_dataNode['subviews']:null,
139
+
140
+ // Checks, if any options are defined.
141
+ _hasOptions = _dataNode['options'] !== undefined,
142
+ _options = _hasOptions?_dataNode['options']:null,
143
+
144
+ // JS Extension block
145
+ _hasExtension = _dataNode['extend'] !== undefined,
146
+ _extension = _hasExtension?_dataNode['extend']:null,
147
+
148
+ // JS Definition block
149
+ _hasDefinition = _dataNode['define'] !== undefined,
150
+ _definitions = _hasDefinition?_dataNode['define']:null,
151
+
152
+ // The HView-derived class instance, instance is by default the parent
153
+ _instance = _parent,
154
+
155
+ i,
156
+
157
+ _subView;
158
+ // console.log('className:',_className,' class:',_class);
159
+ this.scopeDepth ++;
160
+ this.scopes.push({});
161
+ try{
162
+ if(_hasDefinition){
163
+ if(_definitions instanceof Array){
164
+ for( i = 0; i < _definitions.length; i++ ){
165
+ this.defineInScope( _definitions[i] );
166
+ }
167
+ }
168
+ else {
169
+ console.log('renderNode definitions not Array, definitions:',_definitions);
170
+ }
171
+ }
172
+ if(_class){
173
+ if(_hasExtension){
174
+ var _extBlock = {},
175
+ _name,
176
+ _block;
177
+ for(_name in _extension){
178
+ _block = _extension[_name];
179
+ if( typeof _block === 'string' ){
180
+ try {
181
+ _block = this.extEval( _block );
182
+ }
183
+ catch(e){
184
+ console.log('renderNode ext eval error:',e,', name:',_name,', block:',_block);
185
+ }
186
+ }
187
+ _extBlock[_name] = _block;
188
+ }
189
+ _class = _class.extend( _extBlock );
190
+ }
191
+ if(_hasOptions){
192
+ if(_options['valueObjId'] !== undefined){
193
+ var _valueObjId = _options['valueObjId'];
194
+ _options['valueObj'] = COMM.Values.values[_options['valueObjId']];
195
+ }
196
+ }
197
+ // For HApplication -derived classes
198
+ if(!_hasRect && _hasOptions){
199
+ _instance = _class.nu(_options);
200
+ }
201
+ // For HView and HControl -derived classes
202
+ else if(_hasRect){
203
+ _instance = _class.nu(_rect,_parent,_options);
204
+ }
205
+ }
206
+ else if(!(!_class && _hasSubviews)) {
207
+ console.log('renderNode warning; No such class: '+_className+', node: ',_dataNode);
208
+ }
209
+ }
210
+ catch(e){
211
+ console.log('renderNode error:',e,', rect:',_rect,', class:',_dataNode['class'],', options:', _options);
212
+ }
213
+ // Iterates recursively through all subviews, if specified.
214
+ if(_hasSubviews){
215
+ for( i = 0; i < _subViews.length; i++ ){
216
+ _subView = this.renderNode( _subViews[i], _instance );
217
+ }
218
+ }
219
+
220
+ this.scopes.pop();
221
+ this.scopeDepth --;
222
+
223
+ // Returns the main view (or subview when recursively called).
224
+ return _instance;
225
+ }
226
+ });
227
+
228
+ /** -- Global reference ++ **/
229
+ JSONRenderer = COMM.JSONRenderer;
230
+
231
+
File without changes
@@ -0,0 +1,369 @@
1
+ /* Riassence Framework
2
+ * Copyright 2006 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
+ ** Main container of global operations on +HView+ and
12
+ ** +HApplication+ -derived classes.
13
+ **
14
+ ** HSystem is used to keep +HApplication+ and +HView+ instances
15
+ ** globally managed. The managed classes themself calls +HSystem+ methods,
16
+ ** so there is no real need to access +HSystem+ directly from user-level code.
17
+ **
18
+ ***/
19
+ HSystem = {
20
+
21
+ /** When the focus behaviour is 1, clicking on any subview brings
22
+ * the window to front, if attached to a HWindow instance.
23
+ * If the behaviour is 0, only direct clicks on the HWindow controls
24
+ * brings the window to front.
25
+ *
26
+ **/
27
+ windowFocusBehaviour: 1,
28
+
29
+ /** Singleton class; has no constructor **/
30
+ // constructor: null,
31
+
32
+ /** An array of HApplication instances, index is the appId **/
33
+ apps: [],
34
+
35
+ /** An array (in the same order as apps): holds priority values **/
36
+ appPriorities: [],
37
+
38
+ /** An array (in the same order as apps): holds busy status **/
39
+ busyApps: [],
40
+
41
+ /** This array holds free app id:s **/
42
+ freeAppIds: [],
43
+
44
+ /** The default HSystem ticker interval. Unit is milliseconds. **/
45
+ defaultInterval: 10,
46
+
47
+ /** The default HApplication priority. Unit is "On the n:th tick: poll". **/
48
+ defaultPriority: 20,
49
+
50
+ /** The z-index of root-level +HView+ instances. All the array operations
51
+ * are done by the inner logic of +HApplication+ and +HView+ instances.
52
+ **/
53
+ viewsZOrder: [],
54
+
55
+ /** This is the internal "clock" counter. Gets updated on every tick. **/
56
+ ticks: 0,
57
+
58
+ /** Time in milliseconds for the timeout of a poll to finish before
59
+ * being classified as stuck and thus forcibly terminated.
60
+ **/
61
+ maxAppRunTime: 5000,
62
+
63
+ /** Calls applications, uses the prority as a prioritizer.
64
+ **/
65
+ scheduler: function(){
66
+
67
+ // Loop through all applications:
68
+ for( var _appId=0; _appId<this.apps.length; _appId++ ){
69
+ // Check, if the application exists:
70
+ if( this.apps[ _appId ] ){
71
+ // Check, if the application is busy:
72
+ if( !this.busyApps[ _appId ] ){
73
+ // Check, if the tick count matches the priority of the app:
74
+ if( (this.ticks % this.appPriorities[ _appId ]) === 0 ){
75
+ // Set the app busy, the app itself should "unbusy" itself, when the idle call is done.
76
+ // That happens in <HApplication._startIdle>
77
+
78
+ // If the app is not busy, then make a idle call:
79
+ if(HSystem.apps[_appId]){
80
+ HSystem.apps[_appId]._startIdle();
81
+ }
82
+ }
83
+ }
84
+ }
85
+ }
86
+
87
+ if(this._updateZIndexOfChildrenBuffer.length!==0){
88
+ this._flushUpdateZIndexOfChilden();
89
+ }
90
+
91
+ },
92
+
93
+
94
+ /** Calls the scheduler and then calls itself after a timeout to keep
95
+ * the loop going on.
96
+ **/
97
+ ticker: function(){
98
+ // Increment the tick counter:
99
+ this.ticks++;
100
+ this.scheduler();
101
+ this._tickTimeout = setTimeout( function(){HSystem.ticker();},this.defaultInterval);
102
+ },
103
+
104
+
105
+ /** = Description
106
+ * Adds the structures needed for a new +HApplication+ instance.
107
+ *
108
+ * Called from inside the +HApplication+ constructor.
109
+ * Binds an app and gives it a unique id.
110
+ *
111
+ * = Parameters
112
+ * +_app+:: The reference to the +HApplication+ instance object.
113
+ * +_priority+:: The app priority.
114
+ *
115
+ * = Returns
116
+ * The app id.
117
+ *
118
+ **/
119
+ addApp: function(_app, _priority){
120
+ var _appId;
121
+ if(this.freeAppIds.length !== 0){
122
+ _appId = this.freeAppIds.unshift();
123
+ this.apps[_appId] = _app;
124
+ } else {
125
+ this.apps.push(_app);
126
+ _appId = this.apps.length-1;
127
+ }
128
+
129
+ // sets self as parent
130
+ _app.parent = this;
131
+ _app.parents = [this];
132
+
133
+ _app.appId = _appId;
134
+
135
+ this.startApp(_appId, _priority);
136
+
137
+ return _appId;
138
+ },
139
+
140
+ /** = Description
141
+ * Starts polling an app instance (and its components).
142
+ *
143
+ * = Parameters
144
+ * +_appId+:: The unique id of the app.
145
+ * +_priority+:: The app priority.
146
+ *
147
+ **/
148
+ startApp: function(_appId,_priority){
149
+ if(_priority===undefined){
150
+ _priority = this.defaultInterval;
151
+ }
152
+ this.appPriorities[ _appId ] = _priority;
153
+ this.busyApps[_appId] = false;
154
+ },
155
+
156
+ /** = Description
157
+ * Stops polling an app instance (and its components).
158
+ *
159
+ * = Parameters
160
+ * +_appId+:: The id of the app.
161
+ *
162
+ **/
163
+ stopApp: function(_appId){
164
+ this.busyApps[_appId] = true;
165
+ },
166
+
167
+ /** = Description
168
+ * Changes the priority of the app. Calls +stopApp+ and +startApp+.
169
+ *
170
+ * = Parameters
171
+ * +_appId+:: The id of the app.
172
+ * +_priority+:: The app priority.
173
+ *
174
+ **/
175
+ reniceApp: function(_appId,_priority){
176
+ this.appPriorities[ _appId ] = _priority;
177
+ },
178
+
179
+ /** = Description
180
+ * Stops polling and deletes an app instance (and its components).
181
+ *
182
+ * = Parameters
183
+ * +_appId+:: The unique id of the app.
184
+ * +_forced+:: (Optional) The doesn't wait for the last poll to finish.
185
+ *
186
+ **/
187
+ killApp: function(_appId, _forced){
188
+ if( !_forced ){
189
+ var _startedWaiting = new Date().getTime();
190
+ while( this.busyApps[ _appId ] === true ) {
191
+ /* Waiting for the app to finish its idle loop... */
192
+ if (new Date().getTime() > _startedWaiting + this.maxAppRunTime) {
193
+ break;
194
+ }
195
+ }
196
+ }
197
+ this.busyApps[_appId] = true;
198
+
199
+ this.apps[ _appId ].destroyAllViews();
200
+ this.apps[ _appId ] = null;
201
+
202
+ this.freeAppIds.push( _appId );
203
+ },
204
+
205
+ /** All +HView+ instances that are defined **/
206
+ views: [],
207
+
208
+ /** List of free +viwes+ indexes **/
209
+ _freeViewIds: [],
210
+
211
+ /** = Description
212
+ * Adds a view and assigns it an id.
213
+ *
214
+ * = Parameters
215
+ * +_view+:: The +HView+ instance.
216
+ *
217
+ * = Returns
218
+ * The new view id.
219
+ *
220
+ **/
221
+ addView: function(_view){
222
+ var _newId;
223
+ if(this._freeViewIds.length===0){
224
+ _newId = this.views.length;
225
+ this.views.push(_view);
226
+ }
227
+ else {
228
+ _newId = this._freeViewIds.pop();
229
+ this.views[_newId] = _view;
230
+ }
231
+ return _newId;
232
+ },
233
+
234
+ /** = Description
235
+ * Removes a view and recycles its id.
236
+ *
237
+ * = Parameters
238
+ * +_viewId+:: The view id to delete.
239
+ *
240
+ **/
241
+ delView: function(_viewId){
242
+ this.views[_viewId] = null;
243
+ this._freeViewIds.push(_viewId);
244
+ },
245
+
246
+ /** The view id of the active window. 0 means none. **/
247
+ activeWindowId: 0,
248
+
249
+ /** = Description
250
+ * Focuses the window given and blurs the previous one.
251
+ *
252
+ * = Parameters
253
+ * +_view+:: The +HView+ instance, this is almost always a
254
+ * +HWindow+ instance.
255
+ *
256
+ **/
257
+ windowFocus: function(_view){
258
+ if(!_view){
259
+ this.activeWindowId=0;
260
+ return;
261
+ }
262
+ var _activeWindowId = this.activeWindowId,
263
+ _views = this.views,
264
+ _viewId = _view.viewId;
265
+ if(_views[_activeWindowId]){
266
+ if (_views[_activeWindowId]["windowBlur"]) {
267
+ _views[_activeWindowId].windowBlur();
268
+ }
269
+ }
270
+ this.activeWindowId=_viewId;
271
+ _view.bringToFront();
272
+ _view.windowFocus();
273
+ },
274
+
275
+ /** optimization of zindex buffer, see +HView+ **/
276
+ _updateZIndexOfChildrenBuffer: [],
277
+
278
+ /** Updates the z-indexes of the children of the given +_viewId+. **/
279
+ updateZIndexOfChildren: function(_viewId) {
280
+ if(this._updateZIndexOfChildrenBuffer.indexOf(_viewId)===-1){
281
+ this._updateZIndexOfChildrenBuffer.push(_viewId);
282
+ }
283
+ },
284
+
285
+ /** Flushes the z-indexes. This is a fairly expensive operation,
286
+ * thas's why the info is buffered.
287
+ **/
288
+ _flushUpdateZIndexOfChilden: function() {
289
+
290
+ var j=0, // buffer index
291
+
292
+ // reference to the HSystem namespace
293
+ _this = HSystem,
294
+
295
+ // reference to the buffer
296
+ _buffer = this._updateZIndexOfChildrenBuffer,
297
+
298
+ // the length of the buffer
299
+ _bufLen = _buffer.length;
300
+
301
+ // loop buffer length times to get the items
302
+ for ( ; j < _bufLen; j++ ) {
303
+
304
+
305
+ // get and remove view the view id from the z-index flush status buffer:
306
+ var _viewId = _buffer.shift(),
307
+
308
+ // reference to the view's z-index array or the system root-level views if _viewId is 0
309
+ _views = ((_viewId === null)?(_this.viewsZOrder):(_this.views[ _viewId ].viewsZOrder)),
310
+
311
+ // the length of the view's z-index array
312
+ _viewLen = _views.length,
313
+
314
+ // reference to the setStyle method of the element manager
315
+ _setStyl = ELEM.setStyle,
316
+
317
+ // reference to HSystem.views (collection of all views, by index)
318
+ _sysViews = _this.views,
319
+
320
+
321
+ // assign variables for use inside the inner loop:
322
+
323
+ // the viewId of the view to be updated
324
+ _subViewId,
325
+
326
+ // the view itself with the viewId above
327
+ _view,
328
+
329
+ // the elemId property, used as a [] -lookup in the loop
330
+ _elemIdStr = 'elemId',
331
+
332
+ // the css property name
333
+ _zIdxStr = 'z-index',
334
+
335
+ // the loop index
336
+ i=0,
337
+
338
+ // the element id of the view
339
+ _elemId;
340
+
341
+ // end of var declarations
342
+
343
+ // loop through all subviews and update the indexes:
344
+ for ( ; i < _viewLen; i++ ) {
345
+
346
+ // get the viewId to be updated based on the z-index array
347
+ _subViewId = _views[ i ];
348
+
349
+ // reference to the view itself
350
+ _view = _sysViews[ _subViewId ];
351
+
352
+ // the element id of the view
353
+ _elemId = _view[ _elemIdStr ];
354
+
355
+ // do the element manager call itself to update the dom property
356
+ _setStyl( _elemId, _zIdxStr, i );
357
+ }
358
+ }
359
+ }
360
+ };
361
+
362
+ // });
363
+
364
+ // Starts the ticking, when the document is loaded:
365
+ LOAD(
366
+ function(){
367
+ HSystem.ticker();
368
+ }
369
+ );