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,238 @@
1
+ /**
2
+ @class
3
+ @extends rio.Attr
4
+
5
+ Page is used to create page classes in a rio application. It handles css dependencies, rendering, templating,
6
+ layout management, and popup management.
7
+
8
+ @author Jason Tillery
9
+ @copyright 2008-2009 Thinklink LLC
10
+ */
11
+ rio.Page = {
12
+ create: function() {
13
+ var args = $A(arguments);
14
+ if (args.length > 0 && args.last() != undefined && !args.last().ATTR) {
15
+ args[args.size() - 1] = Object.extend({ noExtend: true }, args.last());
16
+ }
17
+ var page = rio.Attr.create.apply(this, args);
18
+
19
+ Object.extend(page, {
20
+ requireCss: function(name) {
21
+ rio.Application.includeCss("pages/" + name);
22
+ },
23
+ template: function(name) {
24
+ rio.boot.loadedTemplates.push(rio.boot.appRoot + "pages/" + name);
25
+
26
+ this._templateName = name;
27
+ },
28
+ applyTemplate: function() {
29
+ if (this._templateName && !this._templateApplied) {
30
+ var template = rio.JsTemplate.build("pages/" + this._templateName);
31
+ page.addMethods(template.mixinMethods());
32
+
33
+ this._templateApplied = true;
34
+ }
35
+ },
36
+ manageLayout: function() {
37
+ this.__manageLayout = true;
38
+ },
39
+ manageUndo: function() {
40
+ this.__manageUndo = true;
41
+ }
42
+ });
43
+
44
+ page.addMethods({
45
+ html: function() {
46
+ if (!this._html) { this._html = this.buildHtml(); }
47
+ return this._html;
48
+ },
49
+
50
+ popup: function() {
51
+ if (!this.__popupLightbox) {
52
+ this.__popupLightbox = new rio.components.Lightbox({
53
+ content: this.html()
54
+ });
55
+ }
56
+ this.__popupLightbox.activate();
57
+ this.render();
58
+ },
59
+
60
+ resizePopup: function() {
61
+ this.__popupLightbox.resize();
62
+ },
63
+
64
+ closePopup: function(skipFade) {
65
+ this.__popupLightbox.deactivate(skipFade);
66
+ },
67
+
68
+ isManagingLayout: function() {
69
+ return page.__manageLayout;
70
+ },
71
+
72
+ _manageLayout: function() {
73
+ if (page.__manageLayout) {
74
+ this.__lm = new rio.LayoutManager(this.html());
75
+ }
76
+ },
77
+
78
+ layoutManager: function() {
79
+ return this.__lm;
80
+ },
81
+
82
+ _afterRender: function() {
83
+ if (this.isManagingLayout()) {
84
+ (function() { this.__lm.resize(); }.bind(this)).defer();
85
+ (function() { this.__lm.resize(); }.bind(this)).delay(2);
86
+ (function() { this.__lm.resize(); }.bind(this)).delay(5);
87
+ }
88
+ },
89
+
90
+ render: function() {
91
+ this._manageLayout();
92
+ this._afterRender();
93
+ },
94
+
95
+ show: function() {
96
+ this.html().show();
97
+ this.resizePopup();
98
+ },
99
+
100
+ hide: function() {
101
+ this.html().hide();
102
+ },
103
+
104
+ addHistoryEntry: function(location, isTransient) {
105
+ rio.app.addHistoryEntry(location, isTransient);
106
+ },
107
+
108
+ applyHistoryEntry: function() {
109
+ // Meant to be overriden
110
+ },
111
+
112
+ keyPress: function(e) {
113
+ // Meant to be overriden
114
+ },
115
+
116
+ keyDown: function(e) {
117
+ // Meant to be overriden
118
+ },
119
+
120
+ resize: function() {
121
+ // Meant to be overriden
122
+ },
123
+
124
+ getKeyMap: function() {
125
+ if (!this._keyMap) {
126
+ var maps = this.keyMap ? this.keyMap() : [];
127
+
128
+ if (page.__manageUndo) {
129
+ maps.push({
130
+ mac: { meta: true, shift: false, alt: false, key: "z" },
131
+ win: { ctrl: true, alt: false, key: "z" },
132
+ handler: function(e) {
133
+ if (e.target.value == undefined && this.undoShortcutsEnabled()) {
134
+ rio.Undo.undo();
135
+ }
136
+ }.bind(this)
137
+ });
138
+ maps.push({
139
+ mac: { meta: true, shift: true, alt: false, key: "z" },
140
+ win: { ctrl: true, alt: false, key: "y" },
141
+ handler: function(e) {
142
+ if (e.target.value == undefined && this.undoShortcutsEnabled()) {
143
+ rio.Undo.redo();
144
+ e.stop();
145
+ }
146
+ }.bind(this)
147
+ });
148
+ }
149
+ this._keyMap = rio.KeyMap.build(maps);
150
+ }
151
+ return this._keyMap;
152
+ },
153
+
154
+ enableUndoKeyboardShortcuts: function() {
155
+ this._undoShortuctsEnabled = true;
156
+ },
157
+
158
+ disableUndoKeyboardShortcuts: function() {
159
+ this._undoShortuctsEnabled = false;
160
+ },
161
+
162
+ undoShortcutsEnabled: function() {
163
+ if (this._undoShortuctsEnabled == undefined) { this._undoShortuctsEnabled = true; }
164
+ return this._undoShortuctsEnabled;
165
+ },
166
+
167
+ _keyDown: function(e) {
168
+ this.getKeyMap().handle(e);
169
+ this.keyDown(e);
170
+ },
171
+
172
+ navigateTo: function(path) {
173
+ rio.app.navigateTo(path);
174
+ },
175
+
176
+ refresh: function() {
177
+ rio.app.refresh();
178
+ },
179
+
180
+ rootUrl: function() {
181
+ return rio.app.rootUrl();
182
+ },
183
+
184
+ getCurrentLocation: function() {
185
+ return rio.app.getCurrentLocation();
186
+ },
187
+
188
+ toString: function() {
189
+ return "[rio.pages.*]";
190
+ }
191
+ });
192
+
193
+ // if (last arg is a concise syntax initializer)
194
+ if (args.length > 0 && args.last() != undefined && !args.last().ATTR) {
195
+ var initializers = args.last();
196
+ if (Object.isString(initializers.requireCss)) {
197
+ page.requireCss(initializers.requireCss);
198
+ }
199
+
200
+ if (Object.isString(initializers.template)) {
201
+ page.template(initializers.template);
202
+ }
203
+ if (Object.isString(initializers.jstemplate)) {
204
+ page.template(initializers.jstemplate);
205
+ }
206
+
207
+ if (initializers.manageLayout) {
208
+ page.manageLayout();
209
+ }
210
+
211
+ if (initializers.manageUndo) {
212
+ page.manageUndo();
213
+ }
214
+
215
+ rio.Page.extend(page, initializers.methods || {});
216
+ }
217
+
218
+ return page;
219
+ },
220
+
221
+ extend: function(page, extension) {
222
+ extension._render = extension.render || Prototype.emptyFunction;
223
+ extension.render = function() {
224
+ this._manageLayout();
225
+ this._render();
226
+ this._afterRender();
227
+ };
228
+
229
+ extension.__initialize = extension.initialize || Prototype.emptyFunction;
230
+ extension.initialize = function(options) {
231
+ page.applyTemplate();
232
+
233
+ (this.__initialize.bind(this))(options);
234
+ };
235
+
236
+ rio.Attr.extend(page, extension);
237
+ }
238
+ };
@@ -0,0 +1,59 @@
1
+ rio.Parameters = Class.create({
2
+ initialize: function(parameters, nonAjaxParameters) {
3
+ this.parameters = parameters;
4
+ this.nonAjaxParameters = nonAjaxParameters || {};
5
+ },
6
+
7
+ ajaxParameters: function() {
8
+ var ajaxParameters = {};
9
+ Object.keys(this.parameters).each(function(parameter) {
10
+ var val = this.parameters[parameter];
11
+ if (val && val.not) {
12
+ // Do nothing. Allow Object.toJSON to stringify it.
13
+ } else if (val && val !== true && val.toString) {
14
+ val = val.toString();
15
+ }
16
+ ajaxParameters[parameter.underscore()] = val;
17
+ }.bind(this));
18
+ return ajaxParameters;
19
+ },
20
+
21
+ // ======================================================
22
+ // = THIS FUNCTION IS CALLED A MASSIVE AMOUNT OF TIMES. =
23
+ // ======================================================
24
+ /*
25
+ BE CAREFUL about what you add to this function. It has been heavily
26
+ performance optimized.
27
+ */
28
+ conditionFunction: function() {
29
+ return (function(obj) {
30
+ var evaluate = function(parameters) {
31
+ for (var parameter in parameters) {
32
+ var val = parameters[parameter];
33
+ var objVal = obj["_" + parameter];
34
+
35
+ if (val && val.not) {
36
+ if (objVal == val.not) { return false; }
37
+ } else {
38
+ var paramIsAnId = val && val.cacheKey;
39
+ var fieldIsAnId = objVal && objVal.cacheKey;
40
+ if (fieldIsAnId || paramIsAnId) {
41
+ if (fieldIsAnId && paramIsAnId) {
42
+ if (objVal.cacheKey() != val.cacheKey()) { return false; }
43
+ } else if (paramIsAnId) {
44
+ if (objVal != val.value()) { return false; }
45
+ } else {
46
+ if (objVal.value() != val) { return false; }
47
+ }
48
+ } else {
49
+ if (objVal != val) { return false; }
50
+ }
51
+ }
52
+ }
53
+ return true;
54
+ };
55
+ return evaluate(this.parameters) && evaluate(this.nonAjaxParameters);
56
+ }.bind(this));
57
+ }
58
+ });
59
+ rio.Parameters.toString = function() { return "Parameters"; };
@@ -0,0 +1,75 @@
1
+ // Copyright 2008, Thinklink
2
+ // Adapted from:
3
+ // - sleight.js by Aaron Boodman
4
+ // - bgsleight.js by nater@naterkane.com
5
+ //
6
+ // dependencies - [builder, utils]
7
+
8
+ rio.PngFix = Class.create();
9
+ rio.PngFix.prototype = {
10
+ initialize: function() {
11
+ var platformIE = navigator.platform == "Win32" && navigator.appName == "Microsoft Internet Explorer" && window.attachEvent;
12
+ var browserIE = navigator.appVersion.match(/MSIE (\d+\.\d+)/, '');
13
+ var browserIEGT5 = (browserIE != null && Number(browserIE[1]) < 5.5);
14
+ var browserIELT7 = (browserIE != null && Number(browserIE[1]) < 7);
15
+
16
+ this._applicable = platformIE && browserIEGT5 && browserIELT7;
17
+ },
18
+
19
+ loadPngs: function() {
20
+ if (this.isApplicable()) {
21
+ this.loadForegroundPngs();
22
+ this.loadBackgroundPngs();
23
+ }
24
+ },
25
+
26
+ loadBackgroundPngs: function() {
27
+ for (var i = document.all.length - 1, obj = null; (obj = document.all[i]); i--) {
28
+ if (obj.currentStyle.backgroundImage.match(/\.png/i) != null) {
29
+ this.fixPng(obj);
30
+ obj.attachEvent("onpropertychange", this.propertyChanged);
31
+ }
32
+ }
33
+ },
34
+
35
+ loadForegroundPngs: function() {
36
+ for (var i = document.images.length - 1, img = null; (img = document.images[i]); i--) {
37
+ if (img.src.match(/\.png$/i) != null) {
38
+ var imgHtml = rio.Tag.div('');
39
+ $(imgHtml).setStyle({
40
+ filter: "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + img.src + "', sizing='scale')",
41
+ width: img.width + "px",
42
+ height: img.height + "px"
43
+ });
44
+ Element.body().insert(imgHtml);
45
+ $(img).replace(imgHtml);
46
+ }
47
+ }
48
+ },
49
+
50
+ propertyChanged: function() {
51
+ if (window.event.propertyName == "style.backgroundImage") {
52
+ var el = window.event.srcElement;
53
+ if (!el.currentStyle.backgroundImage.match(/transparent\.gif/i)) {
54
+ var bg = el.currentStyle.backgroundImage;
55
+ var src = bg.substring(5,bg.length-2);
56
+ el.filters.item(0).src = src;
57
+ el.style.backgroundImage = "url(/images/blank.gif)";
58
+ }
59
+ }
60
+ },
61
+
62
+ fixPng: function(obj) {
63
+ var bg = obj.currentStyle.backgroundImage;
64
+ var src = bg.substring(5,bg.length-2);
65
+ var sizingMethod = (obj.currentStyle.backgroundRepeat == "no-repeat") ? "crop" : "scale";
66
+ obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + src + "', sizingMethod='" + sizingMethod + "')";
67
+ obj.style.backgroundImage = "url(/images/blank.gif)";
68
+ },
69
+
70
+ isApplicable: function() {
71
+ return this._applicable;
72
+ }
73
+ };
74
+
75
+ Event.observe(window, "load", function() { new rio.PngFix().loadPngs(); });
@@ -0,0 +1,297 @@
1
+ if (Prototype.Browser.WebKit) {
2
+ Object.extend(Event, {
3
+ // This does not appear to be the case now
4
+ // KEY_LEFT: 63234,
5
+ // KEY_UP: 63232,
6
+ // KEY_RIGHT: 63235,
7
+ // KEY_DOWN: 63233,
8
+ // KEY_DELETE: 63272,
9
+ KEY_HOME: 63273,
10
+ KEY_END: 63275,
11
+ KEY_PAGEUP: 63276,
12
+ KEY_PAGEDOWN: 63277
13
+ });
14
+ }
15
+
16
+ Object.extend(Element, {
17
+ body: function() {
18
+ return $$('body')[0];
19
+ },
20
+
21
+ head: function() {
22
+ return $$('head')[0];
23
+ },
24
+
25
+ html: function() {
26
+ return $$('html')[0];
27
+ },
28
+
29
+ isRendered: function(elt) {
30
+ return elt.descendantOf(Element.body());
31
+ },
32
+
33
+ toPixels: function(val) {
34
+ if (!val) { return val; }
35
+
36
+ if (Object.isNumber(val)) { return val + "px"; }
37
+ if (Object.isString(val) && val.match(/^-?\d*$/)) { return val + "px"; }
38
+
39
+ return val;
40
+ },
41
+
42
+ pixeledAttributes: [
43
+ "width", "height",
44
+ "padding", "paddingTop", "paddingRight", "paddingBottom", "paddingLeft",
45
+ "margin", "marginTop", "marginRight", "marginBottom", "marginLeft",
46
+ "top", "bottom", "left", "right",
47
+ "fontSize"
48
+ ]
49
+ });
50
+
51
+ Element.addMethods({
52
+ totalHeight: function(elt) {
53
+ return ["height", "margin-top", "margin-bottom", "padding-top", "padding-bottom", "border-top-width", "border-bottom-width"].inject(0, function(acc, prop) {
54
+ return acc + (parseInt(elt.getStyle(prop), 0) || 0);
55
+ });
56
+ },
57
+
58
+ addHoverClass: function(elt, hoverClass, focusClass) {
59
+ elt = $(elt);
60
+ elt.observe('mouseover', function() {
61
+ elt.addClassName(hoverClass);
62
+ });
63
+ elt.observe('mouseout', function() {
64
+ elt.removeClassName(hoverClass);
65
+ });
66
+ if (focusClass) {
67
+ elt.observe('focus', function() {
68
+ elt.addClassName(focusClass);
69
+ elt.removeClassName(hoverClass);
70
+ });
71
+ elt.observe('blur', function() {
72
+ elt.removeClassName(focusClass);
73
+ });
74
+ }
75
+ },
76
+
77
+ insert: Element.insert.wrap(function(proceed, elt, insertions) {
78
+ var newInsertions;
79
+ if (insertions.html) {
80
+ newInsertions = insertions.html();
81
+ } else if (insertions.top || insertions.bottom || insertions.before || insertions.after) {
82
+ newInsertions = {};
83
+ Object.keys(insertions).each(function(position) {
84
+ newInsertions[position] = insertions[position].html ? insertions[position].html() : insertions[position];
85
+ });
86
+ } else {
87
+ newInsertions = insertions;
88
+ }
89
+
90
+ proceed(elt, newInsertions);
91
+ }),
92
+
93
+ applyStyle: function(elt, styles) {
94
+ var toApply = {};
95
+ var styleBinding = function(val) {
96
+ var style = {};
97
+ style[styleName] = Element.pixeledAttributes.include(styleName) ? Element.toPixels(val) : val;
98
+ elt.setStyle(style);
99
+ };
100
+ for (styleName in styles) {
101
+ var val = styles[styleName]; //.THEME ? styles[styleName]() : styles[styleName];
102
+ if (val == undefined) {
103
+ // Do nothing
104
+ } else if (val.BINDING) {
105
+ val.bind(styleBinding, true);
106
+ var newValue = Element.pixeledAttributes.include(styleName) ? Element.toPixels(val.value()) : val.value();
107
+ if (newValue !== undefined) {
108
+ toApply[styleName] = newValue;
109
+ }
110
+ } else {
111
+ toApply[styleName] = Element.pixeledAttributes.include(styleName) ? Element.toPixels(val) : val;
112
+ }
113
+ }
114
+ elt.setStyle(toApply);
115
+ },
116
+
117
+ horizontalMBP: function(elt) {
118
+ return elt.totalPixelsForStyles(["marginLeft", "marginRight", "borderLeftWidth", "borderRightWidth", "paddingLeft", "paddingRight"]);
119
+ },
120
+
121
+ verticalMBP: function(elt) {
122
+ return elt.totalPixelsForStyles(["marginTop", "marginBottom", "borderTopWidth", "borderBottomWidth", "paddingTop", "paddingBottom"]);
123
+ },
124
+
125
+ totalPixelsForStyles: function(elt, styles) {
126
+ return styles.inject(0, function(acc, s) {
127
+ var val = parseInt(elt.getStyle(s).stripPx() || 0, 10);
128
+ if (isNaN(val)) { // Test for IE!!
129
+ val = 0;
130
+ }
131
+ return acc + val;
132
+ });
133
+ }
134
+
135
+ });
136
+
137
+ if (rio.environment.logEventErrors) {
138
+ Event.observe = Event.observe.wrap(function(proceed, element, eventName, handler) {
139
+ var newHandler = handler.wrap(function(proceed) {
140
+ try {
141
+ proceed.apply(proceed, $A(arguments).slice(1));
142
+ } catch(e) {
143
+ rio.error(e, "Error processing event: " + element + "#" + eventName);
144
+ throw(e);
145
+ }
146
+ });
147
+ proceed(element, eventName, newHandler);
148
+ });
149
+
150
+ Element.addMethods({
151
+ observe: Event.observe
152
+ });
153
+
154
+ Object.extend(document, {
155
+ observe: Element.Methods.observe.methodize()
156
+ });
157
+
158
+ Ajax.Request.prototype.dispatchException = Ajax.Request.prototype.dispatchException.wrap(function(proceed, exception) {
159
+ rio.error(exception, "Error processing Ajax callback: ");
160
+ proceed(exception);
161
+ });
162
+ }
163
+
164
+ Object.extend(Date.prototype, {
165
+ strftime: function(format) {
166
+ var day = this.getUTCDay(), month = this.getUTCMonth();
167
+ var hours = this.getUTCHours(), minutes = this.getUTCMinutes();
168
+ function pad(num) { return num.toPaddedString(2); }
169
+
170
+ return format.gsub(/\%([aAbBcdDHiImMpSwyY])/, function(part) {
171
+ switch(part[1]) {
172
+ case 'a': return $w("Sun Mon Tue Wed Thu Fri Sat")[day];
173
+ case 'A': return $w("Sunday Monday Tuesday Wednesday Thursday Friday Saturday")[day];
174
+ case 'b': return $w("Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec")[month];
175
+ case 'B': return $w("January February March April May June July August September October November December")[month];
176
+ case 'c': return this.toString();
177
+ case 'd': return pad(this.getUTCDate());
178
+ case 'D': return pad(this.getUTCDate());
179
+ case 'H': return pad(hours);
180
+ case 'i': return (hours === 12 || hours === 0) ? 12 : (hours + 12) % 12;
181
+ case 'I': return pad((hours === 12 || hours === 0) ? 12 : (hours + 12) % 12);
182
+ case 'm': return pad(month + 1);
183
+ case 'M': return pad(minutes);
184
+ case 'p': return hours > 11 ? 'PM' : 'AM';
185
+ case 'S': return pad(this.getUTCSeconds());
186
+ case 'w': return day;
187
+ case 'y': return pad(this.getUTCFullYear() % 100);
188
+ case 'Y': return this.getUTCFullYear().toString();
189
+ }
190
+ }.bind(this));
191
+ },
192
+
193
+ prettyTime: function() {
194
+ return this.getHours() + ":" +
195
+ this.getMinutes().toPaddedString(2) + ":" +
196
+ this.getSeconds().toPaddedString(2);
197
+ }
198
+ });
199
+
200
+ Object.extend(Date, {
201
+ /*
202
+ Adapted from (http://delete.me.uk/2005/03/iso8601.html)
203
+ */
204
+ parseISO: function(string) {
205
+ var regexp = "([0-9]{4})(-([0-9]{2})(-([0-9]{2})(T([0-9]{2}):([0-9]{2})(:([0-9]{2})(/.([0-9]+))?)?(Z|(([-+])([0-9]{2}):([0-9]{2})))?)?)?)?";
206
+ var d = string.match(new RegExp(regexp));
207
+
208
+ var offset = 0;
209
+ var date = new Date(d[1], 0, 1);
210
+
211
+ if (d[3]) { date.setMonth(d[3] - 1); }
212
+ if (d[5]) { date.setDate(d[5]); }
213
+ if (d[7]) { date.setHours(d[7]); }
214
+ if (d[8]) { date.setMinutes(d[8]); }
215
+ if (d[10]) { date.setSeconds(d[10]); }
216
+ if (d[12]) { date.setMilliseconds(Number("0." + d[12]) * 1000); }
217
+ if (d[14]) {
218
+ offset = (Number(d[16]) * 60) + Number(d[17]);
219
+ offset *= ((d[15] == '-') ? 1 : -1);
220
+ }
221
+
222
+ // I had to add the * 2 to get it to work
223
+ offset -= date.getTimezoneOffset() * 2;
224
+ time = (Number(date) + (offset * 60 * 1000));
225
+
226
+ return new Date(Number(time));
227
+ }
228
+ });
229
+
230
+ Object.extend(String.prototype, {
231
+ camelize: function() {
232
+ var parts = this.split(/_|-/), len = parts.length;
233
+ if (len == 1) { return parts[0]; }
234
+
235
+ var camelized = this.charAt(0) == '-' || this.charAt(0) == '_' ?
236
+ parts[0].charAt(0).toUpperCase() + parts[0].substring(1) : parts[0];
237
+
238
+ for (var i = 1; i < len; i++) {
239
+ camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1);
240
+ }
241
+
242
+ return camelized;
243
+ },
244
+
245
+ stripPx: function() {
246
+ return Number(this.endsWith("px") ? this.match(/(.*)px/)[1] : this);
247
+ },
248
+
249
+ classize: function() {
250
+ if (this.length == 0) { return ""; }
251
+ if (this.length == 1) { return this.capitalize(); }
252
+
253
+ return this.capitalize().slice(0,1) + this.camelize().slice(1);
254
+ },
255
+
256
+ isNumeric: function() {
257
+ return parseFloat(this) + '' == parseFloat(this);
258
+ },
259
+
260
+ toBoolean: function() {
261
+ return this.toLowerCase() == "true";
262
+ },
263
+
264
+ validEmail: function() {
265
+ return this.match(/^([^@\s]+)@((?:[\-a-z0-9]+\.)+[a-z]{2,})$/i);
266
+ }
267
+ });
268
+
269
+ Object.extend(Number.prototype, {
270
+ stripPx: function() {
271
+ return this;
272
+ }
273
+ });
274
+
275
+ Object.extend(Array.prototype, {
276
+ destroy: function(item) {
277
+ this.splice(this.indexOf(item), 1);
278
+ item.destroy();
279
+ },
280
+
281
+ empty: function() {
282
+ return this.size() == 0;
283
+ }
284
+ });
285
+
286
+ // This is a superior implementation, developed by Douglas Crockford
287
+ // this function unfortunately treats the HTMLSelectElement as an array :(
288
+ Object.isArray = function(testObject) {
289
+ return testObject && !(testObject.propertyIsEnumerable != undefined && testObject.propertyIsEnumerable('length')) && typeof testObject === 'object' && typeof testObject.length === 'number' && !(testObject.tagName == "SELECT");
290
+ };
291
+
292
+ Prototype.Browser.IE6 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5), 10)==6;
293
+ Prototype.Browser.IE7 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5), 10)==7;
294
+ Prototype.Browser.IE8 = Prototype.Browser.IE && parseInt(navigator.userAgent.substring(navigator.userAgent.indexOf("MSIE")+5), 10)==8;
295
+
296
+
297
+