riojs 0.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (270) hide show
  1. data/LICENSE +20 -0
  2. data/README.rdoc +24 -0
  3. data/VERSION +1 -0
  4. data/bin/rio +5 -0
  5. data/generators/rio_app/USAGE +19 -0
  6. data/generators/rio_app/rio_app_generator.rb +40 -0
  7. data/generators/rio_app/templates/app.build +10 -0
  8. data/generators/rio_app/templates/app.css +0 -0
  9. data/generators/rio_app/templates/app.js +20 -0
  10. data/generators/rio_app/templates/app_view.html.erb +19 -0
  11. data/generators/rio_app/templates/fixture.js +4 -0
  12. data/generators/rio_app/templates/rio.html.erb +18 -0
  13. data/generators/rio_app/templates/rio_controller.rb +2 -0
  14. data/generators/rio_app/templates/spec.js +7 -0
  15. data/generators/rio_component/USAGE +13 -0
  16. data/generators/rio_component/rio_component_generator.rb +16 -0
  17. data/generators/rio_component/templates/component.css +0 -0
  18. data/generators/rio_component/templates/component.js +11 -0
  19. data/generators/rio_component/templates/fixture.js +3 -0
  20. data/generators/rio_component/templates/spec.js +6 -0
  21. data/generators/rio_model/USAGE +12 -0
  22. data/generators/rio_model/rio_model_generator.rb +21 -0
  23. data/generators/rio_model/templates/fixture.js +3 -0
  24. data/generators/rio_model/templates/model.js +9 -0
  25. data/generators/rio_model/templates/spec.js +6 -0
  26. data/generators/rio_page/USAGE +14 -0
  27. data/generators/rio_page/rio_page_generator.rb +16 -0
  28. data/generators/rio_page/templates/fixture.js +3 -0
  29. data/generators/rio_page/templates/page.css +12 -0
  30. data/generators/rio_page/templates/page.js +12 -0
  31. data/generators/rio_page/templates/page.jst +64 -0
  32. data/generators/rio_page/templates/spec.js +6 -0
  33. data/generators/rio_resource/USAGE +20 -0
  34. data/generators/rio_resource/rio_resource_generator.rb +10 -0
  35. data/generators/rio_resource/templates/controller.rb +3 -0
  36. data/init.rb +4 -0
  37. data/install/config/juggernaut_hosts.yml +18 -0
  38. data/install/lib/tasks/rio.rake +1 -0
  39. data/install/script/rio_server +37 -0
  40. data/lib/rio/autospec.rb +86 -0
  41. data/lib/rio/install.rb +90 -0
  42. data/lib/rio/juggernaut.rb +212 -0
  43. data/lib/rio/path.rb +3 -0
  44. data/lib/rio/rio_compressor.rb +219 -0
  45. data/lib/rio/rio_file_controller.rb +16 -0
  46. data/lib/rio/rio_on_rails.rb +586 -0
  47. data/lib/rio/rio_proxy_controller.rb +60 -0
  48. data/lib/rio/rio_push_controller.rb +48 -0
  49. data/lib/rio/rio_routes.rb +24 -0
  50. data/lib/rio/rio_spec_controller.rb +70 -0
  51. data/lib/riojs.rb +14 -0
  52. data/lib/tasks/rio.rb +63 -0
  53. data/public/images/background-chiffon.png +0 -0
  54. data/public/images/button-gradient-overlay-down.png +0 -0
  55. data/public/images/button-gradient-overlay.png +0 -0
  56. data/public/images/icons/add.png +0 -0
  57. data/public/images/icons/error-big.png +0 -0
  58. data/public/images/icons/warning-big.png +0 -0
  59. data/public/images/rio-logo-big.png +0 -0
  60. data/public/images/rio-logo.png +0 -0
  61. data/public/images/splitter-handle-horizontal.png +0 -0
  62. data/public/images/splitter-handle-vertical.png +0 -0
  63. data/public/images/tab-bar-gradient-overlay.png +0 -0
  64. data/public/images/title-gradient-overlay.png +0 -0
  65. data/public/images/trash.gif +0 -0
  66. data/public/javascripts/components/accordion.js +144 -0
  67. data/public/javascripts/components/alert_box.js +59 -0
  68. data/public/javascripts/components/base.js +47 -0
  69. data/public/javascripts/components/box.js +63 -0
  70. data/public/javascripts/components/button.js +98 -0
  71. data/public/javascripts/components/checkbox.js +44 -0
  72. data/public/javascripts/components/container.js +265 -0
  73. data/public/javascripts/components/grid_view.js +107 -0
  74. data/public/javascripts/components/image.js +19 -0
  75. data/public/javascripts/components/input.js +171 -0
  76. data/public/javascripts/components/label.js +15 -0
  77. data/public/javascripts/components/lightbox.js +160 -0
  78. data/public/javascripts/components/link.js +43 -0
  79. data/public/javascripts/components/list_item.js +44 -0
  80. data/public/javascripts/components/list_view.js +192 -0
  81. data/public/javascripts/components/marquee.js +131 -0
  82. data/public/javascripts/components/menu.js +89 -0
  83. data/public/javascripts/components/notification.js +75 -0
  84. data/public/javascripts/components/overlay.js +134 -0
  85. data/public/javascripts/components/panel.js +146 -0
  86. data/public/javascripts/components/radio.js +46 -0
  87. data/public/javascripts/components/splitter.js +65 -0
  88. data/public/javascripts/components/tab_bar.js +64 -0
  89. data/public/javascripts/components/tab_panel.js +57 -0
  90. data/public/javascripts/components/textarea.js +223 -0
  91. data/public/javascripts/components/toggle_button.js +22 -0
  92. data/public/javascripts/components/tooltip.js +80 -0
  93. data/public/javascripts/lib/application.js +482 -0
  94. data/public/javascripts/lib/attr.js +760 -0
  95. data/public/javascripts/lib/benchmark.js +235 -0
  96. data/public/javascripts/lib/blank.html +39 -0
  97. data/public/javascripts/lib/boot.js +300 -0
  98. data/public/javascripts/lib/clipboard.js +96 -0
  99. data/public/javascripts/lib/collection_entity.js +46 -0
  100. data/public/javascripts/lib/component.js +129 -0
  101. data/public/javascripts/lib/console.js +75 -0
  102. data/public/javascripts/lib/console/apps/console.build +43 -0
  103. data/public/javascripts/lib/console/apps/console.js +28 -0
  104. data/public/javascripts/lib/console/blank.html +39 -0
  105. data/public/javascripts/lib/console/components/benchmark.js +196 -0
  106. data/public/javascripts/lib/console/components/console.js +352 -0
  107. data/public/javascripts/lib/console/components/dependencies_list.js +17 -0
  108. data/public/javascripts/lib/console/components/docs.js +66 -0
  109. data/public/javascripts/lib/console/components/playground.js +30 -0
  110. data/public/javascripts/lib/console/console.html +27 -0
  111. data/public/javascripts/lib/console/console_commands.js +287 -0
  112. data/public/javascripts/lib/console/console_commands.js.rej +21 -0
  113. data/public/javascripts/lib/console/console_mixin.js +22 -0
  114. data/public/javascripts/lib/console/docs/files.html +579 -0
  115. data/public/javascripts/lib/console/docs/index.html +323 -0
  116. data/public/javascripts/lib/console/docs/symbols/Object.html +291 -0
  117. data/public/javascripts/lib/console/docs/symbols/_global_.html +413 -0
  118. data/public/javascripts/lib/console/docs/symbols/rio.AIM.html +490 -0
  119. data/public/javascripts/lib/console/docs/symbols/rio.Application.html +841 -0
  120. data/public/javascripts/lib/console/docs/symbols/rio.Attr.html +1075 -0
  121. data/public/javascripts/lib/console/docs/symbols/rio.Binding.html +272 -0
  122. data/public/javascripts/lib/console/docs/symbols/rio.Component.html +419 -0
  123. data/public/javascripts/lib/console/docs/symbols/rio.Cookie.html +543 -0
  124. data/public/javascripts/lib/console/docs/symbols/rio.DelayedTask#initialize.html +270 -0
  125. data/public/javascripts/lib/console/docs/symbols/rio.DelayedTask.html +391 -0
  126. data/public/javascripts/lib/console/docs/symbols/rio.JsTemplate.html +271 -0
  127. data/public/javascripts/lib/console/docs/symbols/rio.Juggernaut.html +329 -0
  128. data/public/javascripts/lib/console/docs/symbols/rio.Model.html +822 -0
  129. data/public/javascripts/lib/console/docs/symbols/rio.Page.html +383 -0
  130. data/public/javascripts/lib/console/docs/symbols/rio.Template.html +328 -0
  131. data/public/javascripts/lib/console/docs/symbols/rio.Utils.html +617 -0
  132. data/public/javascripts/lib/console/docs/symbols/rio.html +506 -0
  133. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_components_base.js.html +54 -0
  134. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_application.js.html +490 -0
  135. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_attr.js.html +768 -0
  136. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_boot.js.html +308 -0
  137. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_clipboard.js.html +103 -0
  138. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_collection_entity.js.html +53 -0
  139. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_component.js.html +137 -0
  140. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_cookie.js.html +81 -0
  141. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_delayed_task.js.html +68 -0
  142. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_file.js.html +80 -0
  143. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_flash_detect.js.html +129 -0
  144. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_form.js.html +95 -0
  145. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_id.js.html +50 -0
  146. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_inflector.js.html +167 -0
  147. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_js_template.js.html +283 -0
  148. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_juggernaut.js.html +303 -0
  149. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_key_map.js.html +68 -0
  150. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_layout_manager.js.html +175 -0
  151. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_log.js.html +17 -0
  152. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_model.js.html +1074 -0
  153. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_page.js.html +246 -0
  154. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_parameters.js.html +66 -0
  155. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_protohack.js.html +305 -0
  156. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_push.js.html +12 -0
  157. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_rsh.js.html +659 -0
  158. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_swfobject.js.html +12 -0
  159. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_tag.js.html +60 -0
  160. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_template.js.html +64 -0
  161. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_theme.js.html +105 -0
  162. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_undo.js.html +142 -0
  163. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_utils.js.html +87 -0
  164. data/public/javascripts/lib/console/docs/symbols/src/public_javascripts_lib_yaml.js.html +88 -0
  165. data/public/javascripts/lib/console/file-small.png +0 -0
  166. data/public/javascripts/lib/console/green-circle.png +0 -0
  167. data/public/javascripts/lib/console/loading.gif +0 -0
  168. data/public/javascripts/lib/console/pages/console_page.js +149 -0
  169. data/public/javascripts/lib/console/pages/console_page.jst +27 -0
  170. data/public/javascripts/lib/console/red-circle.png +0 -0
  171. data/public/javascripts/lib/cookie.js +74 -0
  172. data/public/javascripts/lib/delayed_task.js +61 -0
  173. data/public/javascripts/lib/dependencies.js +76 -0
  174. data/public/javascripts/lib/environment.js +30 -0
  175. data/public/javascripts/lib/event.simulate.js +137 -0
  176. data/public/javascripts/lib/expressinstall.swf +0 -0
  177. data/public/javascripts/lib/file.js +72 -0
  178. data/public/javascripts/lib/flash_detect.js +122 -0
  179. data/public/javascripts/lib/flashembed.min.js +16 -0
  180. data/public/javascripts/lib/form.js +88 -0
  181. data/public/javascripts/lib/id.js +43 -0
  182. data/public/javascripts/lib/inflector.js +160 -0
  183. data/public/javascripts/lib/instrumenter.js +106 -0
  184. data/public/javascripts/lib/js_template.js +275 -0
  185. data/public/javascripts/lib/jslint.js +4950 -0
  186. data/public/javascripts/lib/juggernaut.js +295 -0
  187. data/public/javascripts/lib/juggernaut.swf +0 -0
  188. data/public/javascripts/lib/key_map.js +60 -0
  189. data/public/javascripts/lib/layout_manager.js +167 -0
  190. data/public/javascripts/lib/model.js +1067 -0
  191. data/public/javascripts/lib/page.js +238 -0
  192. data/public/javascripts/lib/parameters.js +59 -0
  193. data/public/javascripts/lib/png_fix.js +75 -0
  194. data/public/javascripts/lib/protohack.js +297 -0
  195. data/public/javascripts/lib/push.js +5 -0
  196. data/public/javascripts/lib/rio.build +28 -0
  197. data/public/javascripts/lib/rio_development.build +5 -0
  198. data/public/javascripts/lib/rio_lint.js +66 -0
  199. data/public/javascripts/lib/rsh.js +651 -0
  200. data/public/javascripts/lib/spec.js +545 -0
  201. data/public/javascripts/lib/spec_runner.js +242 -0
  202. data/public/javascripts/lib/swfobject.js +5 -0
  203. data/public/javascripts/lib/tag.js +52 -0
  204. data/public/javascripts/lib/undo.js +134 -0
  205. data/public/javascripts/lib/utils.js +80 -0
  206. data/public/javascripts/lib/yaml.js +80 -0
  207. data/public/javascripts/pages/playground_page.js +15 -0
  208. data/public/javascripts/prototype/builder.js +146 -0
  209. data/public/javascripts/prototype/controls.js +1004 -0
  210. data/public/javascripts/prototype/dragdrop.js +1030 -0
  211. data/public/javascripts/prototype/effects.js +1137 -0
  212. data/public/javascripts/prototype/prototype.js +4320 -0
  213. data/public/javascripts/prototype/slider.js +283 -0
  214. data/public/javascripts/prototype/sound.js +67 -0
  215. data/public/javascripts/specs/components/box_spec.js +6 -0
  216. data/public/javascripts/specs/components/checkbox_spec.js +26 -0
  217. data/public/javascripts/specs/components/container_spec.js +6 -0
  218. data/public/javascripts/specs/components/input_spec.js +71 -0
  219. data/public/javascripts/specs/components/panel_spec.js +6 -0
  220. data/public/javascripts/specs/components/radio_spec.js +40 -0
  221. data/public/javascripts/specs/fixtures/components/box.js +3 -0
  222. data/public/javascripts/specs/fixtures/components/checkbox.js +9 -0
  223. data/public/javascripts/specs/fixtures/components/container.js +3 -0
  224. data/public/javascripts/specs/fixtures/components/input.js +12 -0
  225. data/public/javascripts/specs/fixtures/components/menu.js +19 -0
  226. data/public/javascripts/specs/fixtures/components/menu_item.js +18 -0
  227. data/public/javascripts/specs/fixtures/components/radio.js +11 -0
  228. data/public/javascripts/specs/lib/application_spec.js +281 -0
  229. data/public/javascripts/specs/lib/attr_spec.js +1514 -0
  230. data/public/javascripts/specs/lib/benchmark_spec.js +361 -0
  231. data/public/javascripts/specs/lib/collection_entity_spec.js +131 -0
  232. data/public/javascripts/specs/lib/component_spec.js +86 -0
  233. data/public/javascripts/specs/lib/form_spec.js +171 -0
  234. data/public/javascripts/specs/lib/id_spec.js +21 -0
  235. data/public/javascripts/specs/lib/instrumenter_spec.js +5 -0
  236. data/public/javascripts/specs/lib/js_template_spec.js +131 -0
  237. data/public/javascripts/specs/lib/key_map_spec.js +227 -0
  238. data/public/javascripts/specs/lib/model_spec.js +2268 -0
  239. data/public/javascripts/specs/lib/parameters_spec.js +94 -0
  240. data/public/javascripts/specs/lib/spec_spec.js +943 -0
  241. data/public/javascripts/specs/lib/undo_spec.js +105 -0
  242. data/public/javascripts/specs/lib/yaml_spec.js +127 -0
  243. data/public/sounds/basso.wav +0 -0
  244. data/public/sounds/purr.wav +0 -0
  245. data/public/stylesheets/components/accordion.css +24 -0
  246. data/public/stylesheets/components/alert_box.css +35 -0
  247. data/public/stylesheets/components/box.css +0 -0
  248. data/public/stylesheets/components/button.css +39 -0
  249. data/public/stylesheets/components/checkbox.css +9 -0
  250. data/public/stylesheets/components/container.css +3 -0
  251. data/public/stylesheets/components/grid_view.css +52 -0
  252. data/public/stylesheets/components/input.css +10 -0
  253. data/public/stylesheets/components/label.css +3 -0
  254. data/public/stylesheets/components/lightbox.css +31 -0
  255. data/public/stylesheets/components/link.css +4 -0
  256. data/public/stylesheets/components/list_view.css +23 -0
  257. data/public/stylesheets/components/marquee.css +29 -0
  258. data/public/stylesheets/components/menu.css +34 -0
  259. data/public/stylesheets/components/notification.css +52 -0
  260. data/public/stylesheets/components/overlay.css +8 -0
  261. data/public/stylesheets/components/panel.css +36 -0
  262. data/public/stylesheets/components/radio.css +9 -0
  263. data/public/stylesheets/components/splitter.css +35 -0
  264. data/public/stylesheets/components/tab_bar.css +59 -0
  265. data/public/stylesheets/components/tab_panel.css +15 -0
  266. data/public/stylesheets/components/textarea.css +11 -0
  267. data/public/stylesheets/components/tooltip.css +10 -0
  268. data/public/stylesheets/console.css +151 -0
  269. data/public/stylesheets/css_reset.css +55 -0
  270. metadata +343 -0
@@ -0,0 +1,30 @@
1
+ Object.extend(rio.environment, {
2
+ push: true,
3
+ pushServer: "Juggernaut",
4
+ pushPort: 5001,
5
+ pushUrl: "127.0.0.1",
6
+ pushOptions: {},
7
+ pushDebug: false,
8
+
9
+ logEventErrors: false,
10
+ failOnBootError: false,
11
+ autoConcatCss: false,
12
+ giveWarnings: true,
13
+ boot: {
14
+ // bootCompressed: true
15
+ }
16
+ });
17
+
18
+ rio.environments = {
19
+ development: {
20
+ console: true,
21
+ autospec: true,
22
+ autocss: true,
23
+ logEventErrors: true,
24
+ failOnBootError: true
25
+ },
26
+
27
+ production: {
28
+ giveWarnings: false
29
+ }
30
+ };
@@ -0,0 +1,137 @@
1
+ // Taken from Protolicious (http://github.com/kangax/protolicious/tree/master) and JSMVC
2
+
3
+ /**
4
+ * Event.simulate(@element, eventName[, options]) -> Element
5
+ *
6
+ * - @element: element to fire event on
7
+ * - eventName: name of event to fire (only MouseEvents and HTMLEvents interfaces are supported)
8
+ * - options: optional object to fine-tune event properties - pointerX, pointerY, ctrlKey, etc.
9
+ *
10
+ * $('foo').simulate('click'); // => fires "click" event on an element with id=foo
11
+ *
12
+ **/
13
+ (function(){
14
+
15
+ var createKeypress = function(element, eventName, initialOptions) {
16
+ var character = initialOptions.character;
17
+
18
+ var options = Object.extend(initialOptions, {
19
+ charCode: (character ? character.charCodeAt(0) : 0)
20
+ });
21
+
22
+ if(character && character.match(/\n/)) {
23
+ options.keyCode = 13;
24
+ character = 0;
25
+ }
26
+ if(character && character.match(/[\b]/)) {
27
+ options.keyCode = 8;
28
+ character = 0;
29
+ }
30
+
31
+ var event = null;
32
+ try {
33
+ event = document.createEvent("KeyEvents");
34
+ event.initKeyEvent(eventName, true, true, window,
35
+ options.ctrlKey, options.altKey, options.shiftKey, options.metaKey,
36
+ options.keyCode, options.charCode );
37
+ } catch(e) {
38
+ try {
39
+ event = document.createEvent("Events");
40
+ } catch(e2) {
41
+ event = document.createEvent("UIEvents");
42
+ } finally {
43
+ event.initEvent(eventName, true, true);
44
+ Object.extend(event, options);
45
+ }
46
+ }
47
+
48
+ var success = false;
49
+ if(element.dispatchEvent) {
50
+ success = element.dispatchEvent(event);
51
+ } else if(element.fireEvent) {
52
+ success = element.fireEvent('on' + eventName, event);
53
+ } else {
54
+ throw "Your browser doesn't support dispatching events";
55
+ }
56
+
57
+ if(success && eventName == 'keypress' && !Prototype.Browser.Gecko && (element.nodeName.toLowerCase() == 'input' || element.nodeName.toLowerCase() == 'textarea')) {
58
+ if(character) {
59
+ element.value += character;
60
+ } else if(options.keyCode && options.keyCode == 8) {
61
+ element.value = element.value.substring(0, element.value.length - 1);
62
+ }
63
+ }
64
+ }
65
+
66
+ var eventMatchers = {
67
+ 'HTMLEvents': /^(?:load|unload|abort|error|select|change|submit|reset|focus|blur|resize|scroll)$/,
68
+ 'MouseEvents': /^(?:click|mouse(?:down|up|over|move|out))$/,
69
+ 'KeyEvents': /^(?:key(?:press|up|down))$/
70
+ };
71
+
72
+ Event.simulate = function(element, eventName) {
73
+ var options = {
74
+ pointerX: 0,
75
+ pointerY: 0,
76
+ button: 0,
77
+ ctrlKey: false,
78
+ altKey: false,
79
+ shiftKey: false,
80
+ metaKey: false,
81
+ bubbles: true,
82
+ cancelable: true,
83
+ keyCode: 0,
84
+ charCode: 0
85
+ };
86
+ Object.extend(options, arguments[2] || { });
87
+ var oEvent, eventType = null;
88
+
89
+ element = $(element);
90
+
91
+ for (var name in eventMatchers) {
92
+ if (eventMatchers[name].test(eventName)) { eventType = name; break; }
93
+ }
94
+
95
+ if (!eventType) {
96
+ throw new SyntaxError('Only HTMLEvents, MouseEvents, and KeyEvents interfaces are supported');
97
+ }
98
+
99
+ if (eventType == 'KeyEvents') {
100
+ createKeypress(element, eventName, options);
101
+ } else {
102
+ if (document.createEvent) {
103
+ oEvent = document.createEvent(eventType);
104
+ if (eventType == 'HTMLEvents') {
105
+ oEvent.initEvent(eventName, options.bubbles, options.cancelable);
106
+ } else {
107
+ oEvent.initMouseEvent(eventName, options.bubbles, options.cancelable, document.defaultView,
108
+ options.button, options.pointerX, options.pointerY, options.pointerX, options.pointerY,
109
+ options.ctrlKey, options.altKey, options.shiftKey, options.metaKey, options.button, element);
110
+ }
111
+ element.dispatchEvent(oEvent);
112
+ } else {
113
+ options.clientX = options.pointerX;
114
+ options.clientY = options.pointerY;
115
+ oEvent = Object.extend(document.createEventObject(), options);
116
+ element.fireEvent('on' + eventName, oEvent);
117
+ }
118
+ }
119
+ return element;
120
+ }
121
+
122
+ Element.addMethods({ simulate: Event.simulate });
123
+ })();
124
+
125
+
126
+ // Adding combination events
127
+
128
+ (function() {
129
+ Element.enterText = function(element, text) {
130
+ element.simulate("focus");
131
+ element.value = text;
132
+ element.simulate("blur");
133
+ element.simulate("change");
134
+ }
135
+
136
+ Element.addMethods({ enterText: Element.enterText });
137
+ })();
@@ -0,0 +1,72 @@
1
+ rio.File = {
2
+ open: function(path, options) {
3
+ var file;
4
+ var asynchronous = (options.asynchronous != undefined ? options.asynchronous : true);
5
+ new Ajax.Request(rio.url(path), {
6
+ asynchronous: asynchronous,
7
+ method: "get",
8
+ evalJSON: false,
9
+ evalJS: false,
10
+ onSuccess: function(response) {
11
+ file = response.responseText;
12
+ (options.onSuccess || Prototype.emptyFunction)(file);
13
+ },
14
+ onFailure: function() {
15
+ if(options.onFailure) {
16
+ options.onFailure();
17
+ } else {
18
+ rio.Application.fail("Failed loading file: " + path);
19
+ }
20
+ }
21
+ });
22
+ if (!asynchronous) { return file; }
23
+ },
24
+
25
+ json: function(path, options) {
26
+ new Ajax.Request(rio.url(path), {
27
+ asynchronous: true,
28
+ method: "get",
29
+ evalJSON: true,
30
+ evalJS: false,
31
+ onSuccess: function(response) {
32
+ options.onSuccess(response.responseJSON);
33
+ },
34
+ onFailure: function() {
35
+ rio.Application.fail("Failed loading file: " + path);
36
+ }
37
+ });
38
+ },
39
+
40
+ execute: function(path, options) {
41
+ new Ajax.Request(rio.url(path), {
42
+ asynchronous: (options.asynchronous != undefined ? options.asynchronous : true),
43
+ method: "get",
44
+ evalJSON: false,
45
+ evalJS: true,
46
+ onSuccess: function(response) {
47
+ },
48
+ onFailure: function() {
49
+ rio.Application.fail("Failed loading file: " + path);
50
+ }
51
+ });
52
+ },
53
+
54
+ write: function(path, content, options) {
55
+ new Ajax.Request("/rio/file", {
56
+ asynchronous: (options.asynchronous != undefined ? options.asynchronous : true),
57
+ method: "post",
58
+ evalJSON: false,
59
+ evalJS: false,
60
+ parameters: {
61
+ path: path,
62
+ content: content
63
+ },
64
+ onSuccess: function(response) {
65
+ options.onSuccess(response);
66
+ },
67
+ onFailure: function() {
68
+ rio.Application.fail("Failed writing file: " + path);
69
+ }
70
+ });
71
+ }
72
+ };
@@ -0,0 +1,122 @@
1
+ // Adopted from the Adobe version
2
+
3
+ // Flash Player Version Detection - Rev 1.6
4
+ // Detect Client Browser type
5
+ // Copyright(c) 2005-2006 Adobe Macromedia Software, LLC. All rights reserved.
6
+ (function() {
7
+ var isIE = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
8
+ var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
9
+ var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;
10
+
11
+ function ControlVersion() {
12
+ var version;
13
+ var axo;
14
+
15
+ // NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry
16
+
17
+ try {
18
+ // version will be set for 7.X or greater players
19
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
20
+ version = axo.GetVariable("$version");
21
+ } catch (e) {
22
+ }
23
+
24
+ if (!version)
25
+ {
26
+ try {
27
+ // version will be set for 6.X players only
28
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
29
+
30
+ // installed player is some revision of 6.0
31
+ // GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
32
+ // so we have to be careful.
33
+
34
+ // default to the first public version
35
+ version = "WIN 6,0,21,0";
36
+
37
+ // throws if AllowScripAccess does not exist (introduced in 6.0r47)
38
+ axo.AllowScriptAccess = "always";
39
+
40
+ // safe to call for 6.0r47 or greater
41
+ version = axo.GetVariable("$version");
42
+
43
+ } catch (e2) {
44
+ }
45
+ }
46
+
47
+ if (!version)
48
+ {
49
+ try {
50
+ // version will be set for 4.X or 5.X player
51
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
52
+ version = axo.GetVariable("$version");
53
+ } catch (e3) {
54
+ }
55
+ }
56
+
57
+ if (!version)
58
+ {
59
+ try {
60
+ // version will be set for 3.X player
61
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
62
+ version = "WIN 3,0,18,0";
63
+ } catch (e4) {
64
+ }
65
+ }
66
+
67
+ if (!version)
68
+ {
69
+ try {
70
+ // version will be set for 2.X player
71
+ axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
72
+ version = "WIN 2,0,0,11";
73
+ } catch (e5) {
74
+ version = -1;
75
+ }
76
+ }
77
+
78
+ return version;
79
+ }
80
+
81
+ // JavaScript helper required to detect Flash Player PlugIn version information
82
+ function GetSwfVer(){
83
+ // NS/Opera version >= 3 check for Flash plugin in plugin array
84
+ var flashVer = -1;
85
+
86
+ if (navigator.plugins != null && navigator.plugins.length > 0) {
87
+ if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
88
+ var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
89
+ var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
90
+ var descArray = flashDescription.split(" ");
91
+ var tempArrayMajor = descArray[2].split(".");
92
+ var versionMajor = tempArrayMajor[0];
93
+ var versionMinor = tempArrayMajor[1];
94
+ var versionRevision = descArray[3];
95
+ if (versionRevision == "") {
96
+ versionRevision = descArray[4];
97
+ }
98
+ if (versionRevision[0] == "d") {
99
+ versionRevision = versionRevision.substring(1);
100
+ } else if (versionRevision[0] == "r") {
101
+ versionRevision = versionRevision.substring(1);
102
+ if (versionRevision.indexOf("d") > 0) {
103
+ versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
104
+ }
105
+ }
106
+ flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
107
+ }
108
+ }
109
+ // MSN/WebTV 2.6 supports Flash 4
110
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) { flashVer = 4; }
111
+ // WebTV 2.5 supports Flash 3
112
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) { flashVer = 3; }
113
+ // older WebTV supports Flash 2
114
+ else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) { flashVer = 2; }
115
+ else if ( isIE && isWin && !isOpera ) {
116
+ flashVer = ControlVersion();
117
+ }
118
+ return flashVer;
119
+ }
120
+
121
+ rio.boot.flashVersion = GetSwfVer();
122
+ })();
@@ -0,0 +1,16 @@
1
+ /**
2
+ * flashembed 0.31. Adobe Flash embedding script
3
+ *
4
+ * http://flowplayer.org/tools/flash-embed.html
5
+ *
6
+ * Copyright (c) 2008 Tero Piirainen (tipiirai@gmail.com)
7
+ *
8
+ * Released under the MIT License:
9
+ * http://www.opensource.org/licenses/mit-license.php
10
+ *
11
+ * >> Basically you can do anything you want but leave this header as is <<
12
+ *
13
+ * version 0.01 - 03/11/2008
14
+ * version 0.31 - Tue Jul 22 2008 06:30:31 GMT+0200 (GMT+02:00)
15
+ */
16
+ function flashembed(root,userParams,flashvars){function getHTML(){var html="";if(typeof flashvars=='function'){flashvars=flashvars();}if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){html='<embed type="application/x-shockwave-flash" ';if(params.id){extend(params,{name:params.id});}for(var key in params){if(params[key]!==null){html+=[key]+'="'+params[key]+'"\n\t';}}if(flashvars){html+='flashvars=\''+concatVars(flashvars)+'\'';}html+='/>';}else{html='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';html+='width="'+params.width+'" height="'+params.height+'"';if(!params.id&&document.all){params.id="_"+(""+Math.random()).substring(5);}if(params.id){html+=' id="'+params.id+'"';}html+='>';html+='\n\t<param name="movie" value="'+params.src+'" />';params.id=params.src=params.width=params.height=null;for(var k in params){if(params[k]!==null){html+='\n\t<param name="'+k+'" value="'+params[k]+'" />';}}if(flashvars){html+='\n\t<param name="flashvars" value=\''+concatVars(flashvars)+'\' />';}html+="</object>";if(debug){alert(html);}}return html;}function init(name){var timer=setInterval(function(){var doc=document;var el=doc.getElementById(name);if(el){flashembed(el,userParams,flashvars);clearInterval(timer);}else if(doc&&doc.getElementsByTagName&&doc.getElementById&&doc.body){clearInterval(timer);}},13);return true;}function extend(to,from){if(from){for(key in from){if(from.hasOwnProperty(key)){to[key]=from[key];}}}}var params={src:'#',width:'100%',height:'100%',version:null,onFail:null,expressInstall:null,debug:false,bgcolor:'#ffffff',allowfullscreen:true,allowscriptaccess:'always',quality:'high',type:'application/x-shockwave-flash',pluginspage:'http://www.adobe.com/go/getflashplayer'};if(typeof userParams=='string'){userParams={src:userParams};}extend(params,userParams);var version=flashembed.getVersion();var required=params.version;var express=params.expressInstall;var debug=params.debug;if(typeof root=='string'){var el=document.getElementById(root);if(el){root=el;}else{return init(root);}}if(!root){return;}if(!required||flashembed.isSupported(required)){params.onFail=params.version=params.expressInstall=params.debug=null;root.innerHTML=getHTML();return root.firstChild;}else if(params.onFail){var ret=params.onFail.call(params,flashembed.getVersion(),flashvars);if(ret){root.innerHTML=ret;}}else if(required&&express&&flashembed.isSupported([6,65])){extend(params,{src:express});flashvars={MMredirectURL:location.href,MMplayerType:'PlugIn',MMdoctitle:document.title};root.innerHTML=getHTML();}else{if(root.innerHTML.replace(/\s/g,'')!==''){}else{root.innerHTML="<h2>Flash version "+required+" or greater is required</h2>"+"<h3>"+(version[0]>0?"Your version is "+version:"You have no flash plugin installed")+"</h3>"+"<p>Download latest version from <a href='"+params.pluginspage+"'>here</a></p>";}}function concatVars(vars){var out="";for(var key in vars){if(vars[key]){out+=[key]+'='+asString(vars[key])+'&';}}return out.substring(0,out.length-1);}function asString(obj){switch(typeOf(obj)){case'string':return'"'+obj.replace(new RegExp('(["\\\\])','g'),'\\$1')+'"';case'array':return'['+map(obj,function(el){return asString(el);}).join(',')+']';case'function':return'"function()"';case'object':var str=[];for(var prop in obj){if(obj.hasOwnProperty(prop)){str.push('"'+prop+'":'+asString(obj[prop]));}}return'{'+str.join(',')+'}';}return String(obj).replace(/\s/g," ").replace(/\'/g,"\"");}function typeOf(obj){if(obj===null||obj===undefined){return false;}var type=typeof obj;return(type=='object'&&obj.push)?'array':type;}if(window.attachEvent){window.attachEvent("onbeforeunload",function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};});}function map(arr,func){var newArr=[];for(var i in arr){if(arr.hasOwnProperty(i)){newArr[i]=func(arr[i]);}}return newArr;}return root;}if(typeof jQuery=='function'){(function($){$.fn.extend({flashembed:function(params,flashvars){return this.each(function(){flashembed(this,params,flashvars);});}});})(jQuery);}flashembed=flashembed||{};flashembed.getVersion=function(){var version=[0,0];if(navigator.plugins&&typeof navigator.plugins["Shockwave Flash"]=="object"){var _d=navigator.plugins["Shockwave Flash"].description;if(typeof _d!="undefined"){_d=_d.replace(/^.*\s+(\S+\s+\S+$)/,"$1");var _m=parseInt(_d.replace(/^(.*)\..*$/,"$1"),10);var _r=/r/.test(_d)?parseInt(_d.replace(/^.*r(.*)$/,"$1"),10):0;version=[_m,_r];}}else if(window.ActiveXObject){try{var _a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");version=[6,0];_a.AllowScriptAccess="always";}catch(ee){if(version[0]==6){return;}}try{_a=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(eee){}}if(typeof _a=="object"){_d=_a.GetVariable("$version");if(typeof _d!="undefined"){_d=_d.replace(/^\S+\s+(.*)$/,"$1").split(",");version=[parseInt(_d[0],10),parseInt(_d[2],10)];}}}return version;};flashembed.isSupported=function(version){var now=flashembed.getVersion();var ret=(now[0]>version[0])||(now[0]==version[0]&&now[1]>=version[1]);return ret;};
@@ -0,0 +1,88 @@
1
+ rio.Form = {
2
+
3
+ build: function(options) {
4
+ var attributes = options.attributes || {};
5
+ var attr = rio.Attr.create({
6
+ attrAccessors: Object.keys(attributes),
7
+ methods: {
8
+ reset: function() {
9
+ Object.keys(attributes).each(function(attribute) {
10
+ var initialValue = attributes[attribute].initialValue || "";
11
+ initialValue = initialValue.constructor == rio.Binding ? initialValue.value() : initialValue;
12
+ this[attribute].update(initialValue || "");
13
+ this.errors[attribute].update("");
14
+ }.bind(this));
15
+ },
16
+
17
+ values: function() {
18
+ var values = {};
19
+ Object.keys(attributes).each(function(attribute) {
20
+ values[attribute] = this[attribute].value();
21
+ }.bind(this));
22
+ return values;
23
+ },
24
+
25
+ commit: function() {
26
+ if (this.valid()) {
27
+ (options.onCommit || Prototype.emptyFunction)(this.values());
28
+ }
29
+ },
30
+
31
+ errorsFor: function(field) {
32
+ return this.errors[field];
33
+ },
34
+
35
+ valid: function() {
36
+ return this.validate();
37
+ },
38
+
39
+ validate: function() {
40
+ var valid = true;
41
+ Object.keys(attributes).each(function(attribute) {
42
+ (attributes[attribute].validates || []).uniq().each(function(validate) {
43
+ var errorMessage = Object.isString(validate) ?
44
+ rio.Validators[validate](this[attribute].value()) :
45
+ validate(this.values());
46
+ errorMessage = errorMessage || "";
47
+ if (!errorMessage.blank()) {
48
+ valid = false;
49
+ }
50
+ this.errors[attribute].update(errorMessage);
51
+ }.bind(this));
52
+ }.bind(this));
53
+ return valid;
54
+ }
55
+ }
56
+ });
57
+ var form = new attr();
58
+
59
+
60
+ var errorAttr = rio.Attr.create({
61
+ attrAccessors: Object.keys(attributes).map(function(attribute) { return [attribute, ""]; })
62
+ });
63
+ form.errors = new errorAttr();
64
+ form.reset();
65
+
66
+ Object.keys(attributes).each(function(attribute) {
67
+ form[attribute].bind(form.validate.bind(form), true);
68
+ });
69
+
70
+
71
+ return form;
72
+ }
73
+
74
+
75
+ };
76
+ rio.Form.toString = function() { return "Form"; };
77
+
78
+ rio.Validators = {
79
+ email: function(value) {
80
+ return value.validEmail() ? "" : "not a valid email address";
81
+ },
82
+
83
+ presence: function(value) {
84
+ return value && !value.blank() ? "" : "cannot be blank";
85
+ },
86
+
87
+ toString: function() { return "Validators"; }
88
+ };