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,387 @@
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
+ /*** = Description
10
+ ** A single instance class.
11
+ ** The theme manager knows the name of the currently loaded theme and handles
12
+ ** the loading of theme specific markup snippets and style declarations.
13
+ **
14
+ ** = Instance variables
15
+ ** +themePath+:: Relative path to the components' top directory.
16
+ ** +currentTheme+:: The name of the theme currently in use. Initially the
17
+ ** default unnamed theme is used.
18
+ ** +usesComponentDir+:: True when the components are separated in their own
19
+ ** directories, usually when using the
20
+ ** source/development version. False when the components
21
+ ** are all in same directory. This is the case in the
22
+ ** release build.
23
+ **
24
+ ***/
25
+
26
+ HDefaultThemePath = '/H/themes';
27
+ HDefaultThemeName = 'default';
28
+ HNoComponentCSS = [];
29
+ HNoCommonCSS = [];
30
+ HThemeHasIE6GifsInsteadOfPng = [];
31
+
32
+ HThemeManager = HClass.extend({
33
+
34
+ constructor: null,
35
+
36
+ init: function(){
37
+
38
+ // Default root path of the themes path, should contain at least the default theme.
39
+ this.themePath = HDefaultThemePath;
40
+
41
+ // Hash map of loaded template markup (html templates), by theme.
42
+ // componentName is used as the secondary key.
43
+ this._tmplCache = {};
44
+
45
+ // Hash map of loaded css templates, by theme.
46
+ // componentName is used as the secondary key.
47
+ this._cssCache = {};
48
+
49
+ // The currently selected default theme name.
50
+ this.currentTheme = HDefaultThemeName;
51
+ },
52
+
53
+ setThemePath: function( _path ){
54
+ this.themePath = _path;
55
+ },
56
+
57
+ // Error messages, should be refined.
58
+ _errTemplateNotFound: function( _url ) {
59
+ console.log( "ERROR: Template Not Found: '" + _url + "' ");
60
+ },
61
+ _errTemplateFailure: function( _url ) {
62
+ console.log( "ERROR: Template Failure: '" + _url + "' ");
63
+ },
64
+ _errTemplateException: function( _url ) {
65
+ console.log( "ERROR: Template Exception: '" + _url + "' ");
66
+ },
67
+
68
+ /** = Description
69
+ * Loads a template file and returns its contents.
70
+ * If errors occurred, calls the error management functions.
71
+ *
72
+ * = Parameters
73
+ * +_url+:: A valid local file path or http url pointing to the
74
+ * resource to load.
75
+ * +_contentType+:: An optional parameter, specifies the content type wanted,
76
+ * defaults to text/html.
77
+ *
78
+ * = Returns
79
+ * The contents of the path.
80
+ **/
81
+ fetch: function( _url, _contentType, _callBack, _async ) {
82
+ var _callBackFun;
83
+ if( !_contentType ){
84
+ _contentType = 'text/html; charset=UTF-8';
85
+ }
86
+ if(_async){
87
+ _callBackFun = function( resp ){
88
+ _callBack( resp.X.responseText );
89
+ };
90
+ }
91
+ else{
92
+ // console.log('WARNING: Fetching synchronously using HThemeManager is not recommended. Use pre-packaged themes instead.');
93
+ var _respText;
94
+ _callBackFun = function( resp ){
95
+ _respText = resp.X.responseText;
96
+ };
97
+ }
98
+ COMM.request(
99
+ _url, {
100
+ onSuccess: _callBackFun,
101
+ on404: function(resp){ HThemeManager._errTemplateNotFound( resp.url ); },
102
+ onFailure: function(resp){ HThemeManager._errTemplateFailure( resp.url ); },
103
+ onException: function(resp){ HThemeManager._errTemplateException( resp.url ); },
104
+ method: 'GET',
105
+ async: _async
106
+ }
107
+ );
108
+ if(!_async){
109
+ return _respText;
110
+ }
111
+ },
112
+
113
+
114
+ /** Returns the theme/component -specific path, called from inside css
115
+ * themes, a bit kludgy approach to tell the theme graphics file paths.
116
+ **/
117
+ getThemeGfxPath: function() {
118
+ var _themeName = this._cssEvalParams[0],
119
+ _componentName = this._cssEvalParams[1],
120
+ _themePath = this._cssEvalParams[2],
121
+ _urlPrefix = this._urlPrefix( _themeName, _componentName, _themePath );
122
+ return this._joinPath( _urlPrefix, 'gfx' );
123
+ },
124
+
125
+ /** = Description
126
+ * Returns the theme/component -specific graphics file path with proper css wrappers.
127
+ * Used from inside css themes, a bit kludgy approach to tell the file name path.
128
+ *
129
+ * = Parameters
130
+ * +_fileName+:: The File name to load.
131
+ *
132
+ **/
133
+ getCssFilePath: function( _fileName ){
134
+ var _themeName = this._cssEvalParams[0];
135
+ if((HThemeHasIE6GifsInsteadOfPng.indexOf(_themeName)!==-1) && (BROWSER_TYPE.ie6 || BROWSER_TYPE.symbian) ){
136
+ return "url('"+this._joinPath( this.getThemeGfxPath(), _fileName.replace('.png','-ie6.gif') )+"')";
137
+ }
138
+ else {
139
+ return "url('"+this._joinPath( this.getThemeGfxPath(), _fileName )+"')";
140
+ }
141
+ },
142
+
143
+ /** = Description
144
+ * Loads a css file based on the given url (or file path).
145
+ * Evaluates the css data.
146
+ * Makes sure the browser uses the data for component styles.
147
+ *
148
+ * = Parameter
149
+ * +_url+:: A valid url that points to a valid css file.
150
+ *
151
+ * = Returns
152
+ * The source of the url.
153
+ *
154
+ **/
155
+ loadCSS: function( _url ) {
156
+ var _contentType = 'text/css',
157
+ _cssFun = function(_cssText){
158
+ // Don't try to do anything with empty or invalid css data:
159
+ if (!_cssText || _cssText === "") {
160
+ return;
161
+ }
162
+ HThemeManager.useCSS( _cssText );
163
+ };
164
+ this.fetch( _url, _contentType, _cssFun, true );
165
+ },
166
+
167
+ useCSS: function( _cssText ){
168
+ var _contentType = 'text/css';
169
+ // Evaluate the css text
170
+ _cssText = this._bindCSSVariables( _cssText );
171
+
172
+ var _style, _styleSheet, _head;
173
+
174
+ if(BROWSER_TYPE.ie) {
175
+ // Internet Explorer (at least 6.x; check what 7.x does)
176
+ _style = document.createStyleSheet();
177
+ _style.cssText = _cssText;
178
+ }
179
+
180
+ else {
181
+ // Common, standard <style> tag generation in <head>
182
+ _style = document.createElement( "style" );
183
+ _style.type = _contentType;
184
+ _style.media = "all";
185
+
186
+ _head = document.getElementsByTagName('head')[0];
187
+ _head.appendChild(_style);
188
+
189
+ if (BROWSER_TYPE.safari) {
190
+ // Work-around for safari
191
+ var _cssTextElement = document.createTextNode(_cssText);
192
+ _style.appendChild(_cssTextElement);
193
+ }
194
+ else {
195
+ // This works for others (add more checks, if problems with new browsers)
196
+ _style.innerHTML = _cssText;
197
+ }
198
+ }
199
+
200
+ },
201
+
202
+ _addSlash: function( _str ){
203
+ if( _str[ _str.length-1 ] !== '/' ){
204
+ _str += '/';
205
+ }
206
+ return _str;
207
+ },
208
+
209
+ _joinPath: function( _str1, _str2 ){
210
+ return this._addSlash( _str1 ) + _str2;
211
+ },
212
+
213
+ // Makes a common url prefix for template files
214
+ _urlPrefix: function( _themeName, _componentName, _themePath ) {
215
+
216
+ var _path = _themePath;
217
+
218
+ // Usually null
219
+ if( _themePath === null ) {
220
+ _path = this.themePath;
221
+ }
222
+
223
+ _path = this._joinPath( _path, _themeName );
224
+
225
+ return _path;
226
+ },
227
+
228
+ // Makes a valid css template url
229
+ _cssUrl: function( _themeName, _componentName, _themePath ) {
230
+ this._cssEvalParams = [_themeName, _componentName, _themePath];
231
+ var _cssPrefix = this._urlPrefix( _themeName, _componentName, _themePath ),
232
+ _cssSuffix = this._joinPath( 'css', _componentName+'.css' ),
233
+ _cssUrl = this._joinPath( _cssPrefix, _cssSuffix );
234
+ return _cssUrl;
235
+ },
236
+
237
+ // Makes a valid html template url
238
+ _markupUrl: function( _themeName, _componentName, _themePath ) {
239
+ var _htmlPrefix = this._urlPrefix( _themeName, _componentName, _themePath ),
240
+ _htmlSuffix = this._joinPath( 'html', _componentName+'.html' ),
241
+ _htmlUrl = this._joinPath( _htmlPrefix, _htmlSuffix );
242
+ return _htmlUrl;
243
+ },
244
+
245
+ /** = Description
246
+ * Loads HTML templates of components. Handles caching independently and
247
+ * intelligently.
248
+ *
249
+ * = Parameters
250
+ * +_themeName+:: The name of the template to use.
251
+ * +_componentName+:: The name of the component template (css/html) to load.
252
+ * +_themePath+:: Optional, parameter to override the global theme path.
253
+ *
254
+ * = Returns
255
+ * The Pre-Evaluated HTML Template.
256
+ *
257
+ **/
258
+ loadMarkup: function( _themeName, _componentName, _themePath ) {
259
+ if( !this._tmplCache[_themeName] ){
260
+ this._tmplCache[_themeName] = {};
261
+ }
262
+ var _cached = this._tmplCache[_themeName][_componentName];
263
+
264
+ if (null === _cached || undefined === _cached) {
265
+ var _markupUrl = this._markupUrl( _themeName, _componentName, _themePath ),
266
+ _markup = this.fetch( _markupUrl, null, null, false );
267
+ return this.setMarkup( _themeName, _componentName, _markup );
268
+ }
269
+ return _cached;
270
+ },
271
+
272
+ /** = Description
273
+ * Sets the html template for the theme and component name combination.
274
+ *
275
+ * = Parameters
276
+ * +_themeName+:: The name of the template to use..
277
+ * +_componentName+:: The name of the component template.
278
+ * +_markup+:: The content of the html markup.
279
+ **/
280
+ setMarkup: function( _themeName, _componentName, _markup ){
281
+ // Save an empty string to template cache to prevent repeated failing
282
+ // requests.
283
+ if (null === _markup || undefined === _markup) {
284
+ _markup = "";
285
+ }
286
+ this._tmplCache[_themeName][_componentName] = _markup;
287
+ return _markup;
288
+ },
289
+
290
+ /** = Description
291
+ * Loads CSS and HTML templates of components. Called from HView#_loadMarkup.
292
+ * Returns the HTML Template as text.
293
+ * Manages file caches independently and intelligently.
294
+ *
295
+ * = Parameters
296
+ * +_themeName+:: The name of the template to use.
297
+ * +_componentName+:: The name of the component template (css/html) to load.
298
+ * +_themePath+:: Optional, parameter to override the global theme path.
299
+ *
300
+ * = Returns
301
+ * The Pre-Evaluated HTML Template.
302
+ *
303
+ **/
304
+ getMarkup: function( _themeName, _componentName, _themePath ) {
305
+ /* Load Theme-Specific CSS: */
306
+ if(!this._cssCache[_themeName]){
307
+ this._cssCache[_themeName] = {};
308
+ if(HNoCommonCSS.indexOf(_themeName)===-1){
309
+ var _commonCssUrl = this._cssUrl( _themeName, 'common', _themePath, null );
310
+ this.loadCSS( _commonCssUrl );
311
+ }
312
+ }
313
+
314
+ /* Load Component-Specific CSS, unless configured to only load the common css: */
315
+ if(HNoComponentCSS.indexOf(_themeName)===-1){
316
+ if (!this._cssCache[_themeName][_componentName]){
317
+ var _componentCssUrl = this._cssUrl( _themeName, _componentName, _themePath );
318
+ this._cssCache[_themeName][_componentName] = true;
319
+ this.loadCSS( _componentCssUrl );
320
+ }
321
+ }
322
+
323
+ /* Load/Return Component-Specific HTML: */
324
+ return this.loadMarkup( _themeName, _componentName, _themePath );
325
+ },
326
+
327
+
328
+ _componentGfxPath: function( _themeName, _componentName, _themePath ) {
329
+ var _urlPrefix = this._urlPrefix( _themeName, _componentName, _themePath ),
330
+ _url = this._joinPath( _urlPrefix, 'gfx' );
331
+ return _url;
332
+ },
333
+ _componentGfxFile: function( _themeName, _componentName, _themePath, _fileName ){
334
+ if((HThemeHasIE6GifsInsteadOfPng.indexOf(_themeName)!==-1) && BROWSER_TYPE.ie6){
335
+ return this._joinPath( this._componentGfxPath(_themeName, _componentName, _themePath), _fileName.replace('.png','-ie6.gif') );
336
+ }
337
+ return this._joinPath( this._componentGfxPath(_themeName, _componentName, _themePath), _fileName );
338
+ },
339
+
340
+
341
+ /** = Description
342
+ * Returns the full path of the +_fileName+ given. Uses the default theme.
343
+ **/
344
+ getThemeGfxFile: function( _fileName ) {
345
+ return this.getThemeGfxPath() + _fileName;
346
+ },
347
+
348
+
349
+ /** = Description
350
+ * Sets the active theme.
351
+ *
352
+ * = Parameters
353
+ * +_theme+:: The name of the theme to be set as the active theme.
354
+ *
355
+ **/
356
+ setTheme: function(_theme) {
357
+ this.currentTheme = _theme;
358
+ },
359
+
360
+ /** Sets the default theme ( HDefaultTheme ) to be the active theme.
361
+ **/
362
+ restoreDefaultTheme: function() {
363
+ this.setTheme( HDefaultThemeName );
364
+ },
365
+
366
+ /** regexp: _variable_match
367
+ * A regular expression to match the template evaluation syntax: #{stuff_to_evaluate}
368
+ **/
369
+ _variable_match: new RegExp(/#\{([^\}]*)\}/),
370
+
371
+ /** = Description
372
+ * Evaluates the _variable_match regular expression for the string _markup.
373
+ *
374
+ * = Parameters
375
+ * +_cssTmpl+:: The css template file to be evaluated.
376
+ *
377
+ * = Returns
378
+ * An evaluated CSS Template.
379
+ **/
380
+ _bindCSSVariables: function( _cssTmpl ) {
381
+ while ( this._variable_match.test( _cssTmpl ) ) {
382
+ _cssTmpl = _cssTmpl.replace( this._variable_match, eval( RegExp.$1 ) );
383
+ }
384
+ return _cssTmpl;
385
+ }
386
+
387
+ });
File without changes
File without changes
@@ -0,0 +1,113 @@
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
+ /*** = Description
10
+ ** Serves as a mixin class for classes that need to draw markup but don't
11
+ ** inherit from the HView.
12
+ **
13
+ ** = Instance variables
14
+ ** +markup+:: The markup from the component's HTML template.
15
+ ***/
16
+ HMarkupView = HClass.extend({
17
+
18
+ /** = Description
19
+ * Evaluates the pieces of code defined in the markup template marked with
20
+ * syntax #{}.
21
+ * Can't use } characters in the code though.
22
+ * --
23
+ * This might need another look...
24
+ * ++
25
+ * Places the resulting markup in the instance variable.
26
+ *
27
+ **/
28
+ bindMarkupVariables: function() {
29
+
30
+ var _markup = this.markup;
31
+
32
+ while ( HMarkupView._assignment_match.test(_markup) ) {
33
+ _markup = _markup.replace( HMarkupView._assignment_match, this.evalMarkupVariable(RegExp.$1,true) );
34
+ }
35
+ while ( HMarkupView._variable_match.test(_markup) ) {
36
+ _markup = _markup.replace( HMarkupView._variable_match, this.evalMarkupVariable(RegExp.$1) );
37
+ }
38
+
39
+ this.markup = _markup;
40
+
41
+ return this;
42
+ },
43
+ /** = Description
44
+ * Evaluates a string and throws an error into console.log
45
+ * if the string doesn't pass evaluation.
46
+ * If _isAssignment flag is set to true returns empty string.
47
+ * if _isAssignment is set to false will return string if it passes
48
+ * evaluation.
49
+ *
50
+ * = Parameters
51
+ * +_strToEval+:: A String to evaluate.
52
+ *
53
+ * +_isAssignment+:: Flag to indicate return the String upon passed
54
+ * evaluation(false) or return of an empty String(true).
55
+ *
56
+ * = Returns
57
+ * +String+
58
+ *
59
+ **/
60
+ evalMarkupVariable: function(_strToEval,_isAssignment){
61
+ try {
62
+ var _ID = this.elemId.toString(),
63
+ _WIDTH = this.rect.width,
64
+ _HEIGHT = this.rect.height,
65
+ _result = eval(_strToEval);
66
+ if(_isAssignment){
67
+ return '';
68
+ }
69
+ if(_result===undefined){
70
+ return '';
71
+ }
72
+ else {
73
+ return _result;
74
+ }
75
+ }
76
+ catch(e) {
77
+ console.log("Warning, the markup string '"+_strToEval+"' failed evaluation. Reason:"+e+' '+e.description);
78
+ return '';
79
+ }
80
+ },
81
+
82
+ /** = Description
83
+ * Sets or unsets the _cssClass into a DOM element that goes by the ID
84
+ * _elementId.
85
+ *
86
+ * = Parameters
87
+ * +_elementId+:: ID of the DOM element, or the element itself, to be
88
+ * modified.
89
+ * +_cssClass+:: Name of the CSS class to be added or removed.
90
+ * +_setOn+:: Boolean value that tells should the CSS class be added or
91
+ * removed.
92
+ *
93
+ * = Returns
94
+ * +self+
95
+ *
96
+ **/
97
+ toggleCSSClass: function(_elementId, _cssClass, _setOn) {
98
+ if(_elementId) {
99
+ if (_setOn) {
100
+ ELEM.addClassName(_elementId, _cssClass);
101
+ }
102
+ else {
103
+ ELEM.removeClassName(_elementId, _cssClass);
104
+ }
105
+ }
106
+ return this;
107
+ }
108
+
109
+ },{
110
+ _variable_match: new RegExp(/#\{([^\}]*)\}/),
111
+ _assignment_match: new RegExp(/\$\{([^\}]*)\}/)
112
+ });
113
+