rsence 2.1.11 → 2.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (216) hide show
  1. data/INSTALL.rdoc +5 -3
  2. data/README.rdoc +23 -22
  3. data/VERSION +1 -1
  4. data/conf/default_conf.yaml +65 -29
  5. data/conf/rsence_command_strings.yaml +101 -71
  6. data/js/comm/autosync/autosync.js +3 -3
  7. data/js/comm/jsloader/jsloader.js +16 -3
  8. data/js/comm/queue/queue.js +1 -1
  9. data/js/comm/transporter/transporter.js +106 -83
  10. data/js/comm/values/values.js +8 -2
  11. data/js/controls/button/button.js +9 -4
  12. data/js/controls/button/themes/default/button.css +1 -1
  13. data/js/controls/checkbox/themes/default/checkbox.css +1 -1
  14. data/js/controls/dialogs/sheet/sheet.js +27 -18
  15. data/js/controls/radiobutton/themes/default/radiobutton.css +1 -1
  16. data/js/controls/searchfield/searchfield.coffee +2 -0
  17. data/js/controls/searchfield/themes/default/searchfield.css +96 -0
  18. data/js/controls/searchfield/themes/default/searchfield.html +12 -0
  19. data/js/controls/searchfield/themes/default/searchfield_parts1-ie6.gif +0 -0
  20. data/js/controls/searchfield/themes/default/searchfield_parts1.png +0 -0
  21. data/js/controls/sliders/slider/slider.js +7 -1
  22. data/js/controls/stepper/stepper.js +6 -1
  23. data/js/controls/stringview/stringview.js +50 -39
  24. data/js/controls/tab/tab.js +103 -7
  25. data/js/controls/tab/themes/default/tab.css +2 -0
  26. data/js/controls/textarea/themes/default/textarea.css +4 -0
  27. data/js/controls/textcontrol/textcontrol.js +32 -2
  28. data/js/controls/textcontrol/themes/default/textcontrol.css +17 -2
  29. data/js/controls/uploader/themes/default/uploader.css +3 -3
  30. data/js/controls/uploader/themes/default/uploader.html +1 -1
  31. data/js/controls/uploader/uploader.coffee +110 -0
  32. data/js/controls/window/themes/default/window.css +28 -5
  33. data/js/controls/window/themes/default/window.html +2 -0
  34. data/js/controls/window/window.js +5 -1
  35. data/js/core/class/class.js +22 -4
  36. data/js/core/elem/elem.coffee +816 -0
  37. data/js/core/event/event.js +2 -2
  38. data/js/core/rsence_ns/rsence_ns.coffee +31 -0
  39. data/js/core/rsence_ns/rsence_ns.js +6 -6
  40. data/js/datetime/calendar/calendar.coffee +307 -0
  41. data/js/datetime/calendar/themes/default/calendar.css +90 -9
  42. data/js/datetime/calendar/themes/default/calendar.html +11 -0
  43. data/js/datetime/calendar/themes/default/calendar_bg-ie6.gif +0 -0
  44. data/js/datetime/calendar/themes/default/calendar_bg.png +0 -0
  45. data/js/datetime/calendar/themes/default/calendar_parts1-ie6.gif +0 -0
  46. data/js/datetime/calendar/themes/default/calendar_parts1.png +0 -0
  47. data/js/datetime/calendar/themes/default/calendar_parts2-ie6.gif +0 -0
  48. data/js/datetime/calendar/themes/default/calendar_parts2.png +0 -0
  49. data/js/datetime/datetimepicker/datetimepicker.js +217 -0
  50. data/js/datetime/datetimevalue/datetimevalue.js +22 -5
  51. data/js/datetime/timesheet/themes/default/timesheet.css +51 -22
  52. data/js/datetime/timesheet/themes/default/timesheet.html +4 -2
  53. data/js/datetime/timesheet/timesheet.js +782 -192
  54. data/js/datetime/timesheet_item/themes/default/timesheet_item.css +42 -11
  55. data/js/datetime/timesheet_item/themes/default/timesheet_item.html +4 -2
  56. data/js/datetime/timesheet_item/themes/default/timesheet_item_icons.png +0 -0
  57. data/js/datetime/timesheet_item/timesheet_item.js +158 -254
  58. data/js/datetime/timesheet_item_edit/timesheet_item_edit.js +0 -274
  59. data/js/foundation/application/application.js +52 -9
  60. data/js/foundation/control/eventresponder/eventresponder.js +7 -4
  61. data/js/foundation/control/valueaction/valueaction.js +71 -0
  62. data/js/foundation/eventmanager/eventmanager.js +71 -33
  63. data/js/foundation/geom/rect/rect.js +39 -7
  64. data/js/foundation/json_renderer/json_renderer.js +278 -62
  65. data/js/foundation/locale_settings/locale_settings.js +131 -0
  66. data/js/foundation/system/system.js +40 -13
  67. data/js/foundation/thememanager/thememanager.js +21 -0
  68. data/js/foundation/view/markupview/markupview.js +12 -12
  69. data/js/foundation/view/view.js +221 -27
  70. data/js/graphics/svgcontrol/svgcontrol.js +400 -0
  71. data/js/lists/checkboxlist/checkboxlist.js +18 -7
  72. data/js/lists/listitems/listitems.js +52 -38
  73. data/js/lists/radiobuttonlist/radiobuttonlist.js +23 -7
  74. data/js/menus/menuitem/menuitem.js +5 -0
  75. data/js/menus/menuitem/themes/default/menuitem.css +45 -0
  76. data/js/menus/menuitem/themes/default/menuitem.html +4 -0
  77. data/js/menus/minimenu/minimenu.js +47 -16
  78. data/js/menus/minimenuitem/minimenuitem.js +62 -0
  79. data/js/menus/{minimenu/minimenuitem → minimenuitem}/themes/default/minimenuitem.css +2 -2
  80. data/js/menus/{minimenu/minimenuitem → minimenuitem}/themes/default/minimenuitem.html +0 -0
  81. data/js/menus/{minimenu/minimenuitem → minimenuitem}/themes/default/minimenuitem_checkmark.png +0 -0
  82. data/js/menus/popupmenu/popupmenu.js +14 -0
  83. data/js/menus/popupmenu/themes/default/popupmenu.css +65 -0
  84. data/js/menus/popupmenu/themes/default/popupmenu.html +7 -0
  85. data/js/menus/popupmenu/themes/default/popupmenu.png +0 -0
  86. data/js/no_pkg/no_pkg.js +2 -0
  87. data/js/util/reloadapp/reloadapp.js +1 -1
  88. data/js/views/scrollview/scrollview.js +6 -0
  89. data/lib/rsence.rb +136 -3
  90. data/lib/rsence/argv.rb +218 -0
  91. data/lib/rsence/argv/argv_util.rb +58 -0
  92. data/lib/rsence/argv/env_check.rb +58 -0
  93. data/lib/rsence/argv/help_argv.rb +15 -0
  94. data/lib/rsence/argv/initenv_argv.rb +218 -0
  95. data/lib/rsence/argv/save_argv.rb +92 -0
  96. data/lib/rsence/argv/startup_argv.rb +118 -0
  97. data/lib/rsence/argv/status_argv.rb +132 -0
  98. data/lib/rsence/argv/test_port.rb +32 -0
  99. data/lib/{daemon → rsence}/daemon.rb +67 -23
  100. data/lib/{conf/default.rb → rsence/default_config.rb} +18 -10
  101. data/lib/{plugins → rsence}/dependencies.rb +0 -0
  102. data/lib/{util → rsence}/gzstring.rb +0 -0
  103. data/lib/rsence/http.rb +3 -0
  104. data/lib/{http → rsence/http}/broker.rb +106 -19
  105. data/lib/{http → rsence/http}/rackup.rb +0 -0
  106. data/lib/{http → rsence/http}/request.rb +0 -4
  107. data/lib/{http → rsence/http}/response.rb +0 -1
  108. data/lib/{session → rsence}/msg.rb +17 -1
  109. data/lib/{plugins → rsence}/pluginmanager.rb +29 -12
  110. data/lib/{plugins → rsence}/plugins.rb +7 -7
  111. data/lib/{plugins → rsence/plugins}/gui_plugin.rb +8 -3
  112. data/lib/{plugins → rsence/plugins}/guiparser.rb +9 -6
  113. data/lib/{plugins → rsence/plugins}/plugin.rb +23 -4
  114. data/lib/{plugins → rsence/plugins}/plugin_base.rb +11 -1
  115. data/lib/{plugins → rsence/plugins}/plugin_plugins.rb +2 -2
  116. data/lib/{plugins → rsence/plugins}/plugin_sqlite_db.rb +0 -0
  117. data/lib/{plugins → rsence/plugins}/servlet.rb +0 -0
  118. data/lib/{session → rsence}/sessionmanager.rb +101 -39
  119. data/lib/{session → rsence}/sessionstorage.rb +30 -16
  120. data/lib/{daemon → rsence}/sigcomm.rb +0 -0
  121. data/lib/{transporter → rsence}/transporter.rb +13 -11
  122. data/lib/{values/hvalue.rb → rsence/value.rb} +6 -1
  123. data/lib/{values → rsence}/valuemanager.rb +1 -1
  124. data/plugins/client_pkg/client_pkg.rb +14 -4
  125. data/plugins/client_pkg/info.yaml +2 -2
  126. data/plugins/client_pkg/lib/client_pkg_build.rb +145 -45
  127. data/plugins/client_pkg/lib/client_pkg_cache.rb +1 -1
  128. data/plugins/client_pkg/lib/client_pkg_serve.rb +1 -1
  129. data/plugins/main/main.rb +43 -3
  130. data/plugins/main/tmpl/index.html +2 -10
  131. data/plugins/main/values.yaml +3 -1
  132. data/plugins/ticket/lib/common.rb +6 -3
  133. data/plugins/ticket/ticket.rb +11 -3
  134. metadata +144 -174
  135. data/js/comm/autosync/js.inc +0 -0
  136. data/js/comm/js.inc +0 -0
  137. data/js/comm/jsloader/js.inc +0 -0
  138. data/js/comm/queue/js.inc +0 -0
  139. data/js/comm/session/js.inc +0 -0
  140. data/js/comm/sessionwatcher/js.inc +0 -0
  141. data/js/comm/transporter/js.inc +0 -0
  142. data/js/comm/urlresponder/js.inc +0 -0
  143. data/js/comm/values/js.inc +0 -0
  144. data/js/controls/button/js.inc +0 -0
  145. data/js/controls/checkbox/js.inc +0 -0
  146. data/js/controls/dialogs/alert_sheet/js.inc +0 -0
  147. data/js/controls/dialogs/confirm_sheet/js.inc +0 -0
  148. data/js/controls/dialogs/sheet/js.inc +0 -0
  149. data/js/controls/imageview/js.inc +0 -0
  150. data/js/controls/passwordcontrol/js.inc +0 -0
  151. data/js/controls/progress/progressbar/js.inc +0 -0
  152. data/js/controls/progress/progressindicator/js.inc +0 -0
  153. data/js/controls/radiobutton/js.inc +0 -0
  154. data/js/controls/sliders/slider/js.inc +0 -0
  155. data/js/controls/sliders/vslider/js.inc +0 -0
  156. data/js/controls/stepper/js.inc +0 -0
  157. data/js/controls/stringview/js.inc +0 -0
  158. data/js/controls/tab/js.inc +0 -0
  159. data/js/controls/textarea/js.inc +0 -0
  160. data/js/controls/textcontrol/js.inc +0 -0
  161. data/js/controls/uploader/js.inc +0 -0
  162. data/js/controls/uploader/uploader.js +0 -154
  163. data/js/controls/validatorview/js.inc +0 -0
  164. data/js/controls/window/js.inc +0 -0
  165. data/js/core/class/js.inc +0 -0
  166. data/js/core/elem/elem.js +0 -1325
  167. data/js/core/elem/js.inc +0 -0
  168. data/js/core/event/js.inc +0 -0
  169. data/js/core/iefix/js.inc +0 -0
  170. data/js/core/rsence_ns/js.inc +0 -0
  171. data/js/datetime/calendar/calendar.js +0 -198
  172. data/js/datetime/calendar/js.inc +0 -0
  173. data/js/datetime/datetimevalue/js.inc +0 -0
  174. data/js/datetime/timesheet/js.inc +0 -0
  175. data/js/datetime/timesheet/old_timesheet.js +0 -292
  176. data/js/datetime/timesheet/themes/default/old_timesheet.css +0 -30
  177. data/js/datetime/timesheet/themes/default/old_timesheet.html +0 -2
  178. data/js/datetime/timesheet_item/js.inc +0 -0
  179. data/js/datetime/timesheet_item/old_timesheet_item.js +0 -308
  180. data/js/datetime/timesheet_item/themes/default/old_timesheet_item.css +0 -42
  181. data/js/datetime/timesheet_item/themes/default/old_timesheet_item.html +0 -8
  182. data/js/datetime/timesheet_item_edit/js.inc +0 -0
  183. data/js/datetime/timesheet_item_edit/old_timesheet_item_edit.js +0 -274
  184. data/js/foundation/application/js.inc +0 -0
  185. data/js/foundation/control/controldefaults/js.inc +0 -0
  186. data/js/foundation/control/dummyvalue/js.inc +0 -0
  187. data/js/foundation/control/dyncontrol/js.inc +0 -0
  188. data/js/foundation/control/eventresponder/js.inc +0 -0
  189. data/js/foundation/control/js.inc +0 -0
  190. data/js/foundation/control/valuematrix/js.inc +0 -0
  191. data/js/foundation/control/valueresponder/js.inc +0 -0
  192. data/js/foundation/eventmanager/js.inc +0 -0
  193. data/js/foundation/geom/point/js.inc +0 -0
  194. data/js/foundation/geom/rect/js.inc +0 -0
  195. data/js/foundation/json_renderer/js.inc +0 -0
  196. data/js/foundation/system/js.inc +0 -0
  197. data/js/foundation/thememanager/js.inc +0 -0
  198. data/js/foundation/value/js.inc +0 -0
  199. data/js/foundation/view/js.inc +0 -0
  200. data/js/foundation/view/markupview/js.inc +0 -0
  201. data/js/foundation/view/morphanimation/js.inc +0 -0
  202. data/js/foundation/view/viewdefaults/js.inc +0 -0
  203. data/js/lists/checkboxlist/js.inc +0 -0
  204. data/js/lists/listitems/js.inc +0 -0
  205. data/js/lists/propertylist/js.inc +0 -0
  206. data/js/lists/propertylist/propertylisteditor/js.inc +0 -0
  207. data/js/lists/radiobuttonlist/js.inc +0 -0
  208. data/js/menus/minimenu/js.inc +0 -0
  209. data/js/menus/minimenu/minimenuitem/js.inc +0 -0
  210. data/js/menus/minimenu/minimenuitem/minimenuitem.js +0 -33
  211. data/js/util/reloadapp/js.inc +0 -0
  212. data/js/util/sha/js.inc +0 -0
  213. data/js/views/centerview/js.inc +0 -0
  214. data/js/views/inlineview/js.inc +0 -0
  215. data/js/views/scrollview/js.inc +0 -0
  216. data/lib/conf/argv.rb +0 -880
@@ -0,0 +1,131 @@
1
+ /* RSence
2
+ * Copyright 2011 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
+ var
10
+ HLocale = {
11
+ components: {
12
+
13
+ },
14
+ dateTime: {
15
+ strings: {
16
+ monthsLong: [
17
+ 'January', 'February', 'March', 'April', 'May', 'June', 'July',
18
+ 'August', 'September', 'October', 'November', 'December'
19
+ ],
20
+ monthsShort: [
21
+ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'
22
+ ],
23
+ weekDaysLong: [ 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday' ],
24
+ weekDaysShort: [ 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat' ],
25
+ weekLong: 'Week',
26
+ weekShort: 'WK',
27
+ dateDelimitter: '.',
28
+ timeDelimitter: ':',
29
+ timeMsDelimitter: '.',
30
+ rangeDelimitter: ' ... '
31
+ },
32
+ settings: {
33
+ zeroPadTime: true,
34
+ AMPM: false
35
+ },
36
+ defaultOptions: {
37
+ longWeekDay: false,
38
+ shortWeekDay: false,
39
+ shortYear: false,
40
+ fullYear: true,
41
+ seconds: false,
42
+ milliSeconds: false
43
+ },
44
+ options: function( _custom ){
45
+ var
46
+ _this = HLocale.dateTime,
47
+ _default = _this.defaultOptions,
48
+ _options = {},
49
+ _key;
50
+ for( _key in _default ){
51
+ _options[_key] = _default[_key];
52
+ }
53
+ if( !_custom ){
54
+ _custom = {};
55
+ }
56
+ for( _key in _custom ){
57
+ _options[_key] = _custom[_key];
58
+ }
59
+ return _options;
60
+ },
61
+ zeroPadTime: function( _num ){
62
+ if( HLocale.dateTime.settings.zeroPadTime && _num < 10 ){
63
+ return '0'+_num;
64
+ }
65
+ return _num.toString();
66
+ },
67
+ formatShortWeekDay: function( _dateTimeEpoch ){
68
+ var
69
+ _this = HLocale.dateTime,
70
+ _date = new Date( _dateTimeEpoch * 1000 ),
71
+ _strings = _this.strings,
72
+ _wday = _date.getUTCDay();
73
+ return _strings.weekDaysShort[ _wday ];
74
+ },
75
+ formatLongWeekDay: function( _dateTimeEpoch ){
76
+ var
77
+ _this = HLocale.dateTime,
78
+ _date = new Date( _dateTimeEpoch * 1000 ),
79
+ _strings = _this.strings,
80
+ _wday = _date.getUTCDay();
81
+ return _strings.weekDaysLong[ _wday ];
82
+ },
83
+ formatDate: function( _dateTimeEpoch, _options ){
84
+ var
85
+ _this = HLocale.dateTime,
86
+ _date = new Date( _dateTimeEpoch * 1000 ),
87
+ _strings = _this.strings,
88
+ _wday = _date.getUTCDay(),
89
+ _dateString = _date.getUTCDate() + _strings.dateDelimitter + (_date.getUTCMonth() + 1) + _strings.dateDelimitter;
90
+
91
+ _options = _this.options( _options );
92
+
93
+ if( _options.fullYear ){
94
+ _dateString += _date.getUTCFullYear();
95
+ }
96
+ else if( _options.shortYear ){
97
+ _dateString += date.getUTCYear();
98
+ }
99
+
100
+ if( _options.longWeekDay ){
101
+ return _strings.weekDaysLong[_wday] + ' ' + _dateString;
102
+ }
103
+ else if( _options.shortWeekDay ){
104
+ return _strings.weekDaysShort[_wday] + ' ' + _dateString;
105
+ }
106
+ return _dateString;
107
+ },
108
+ formatTime: function( _dateTimeEpoch, _options ){
109
+ var
110
+ _this = HLocale.dateTime,
111
+ _date = new Date( _dateTimeEpoch * 1000 ),
112
+ _strings = _this.strings,
113
+ _timeString = _this.zeroPadTime( _date.getUTCHours() ) + _strings.timeDelimitter + _this.zeroPadTime( _date.getUTCMinutes() );
114
+
115
+ _options = _this.options( _options );
116
+
117
+ if( _options.seconds ){
118
+ _timeString += _strings.timeDelimitter + _this.zeroPadTime( _date.getUTCSeconds() );
119
+ if( _options.milliSeconds ){
120
+ _timeString += _strings.timeMsDelimitter + _date.getUTCMilliseconds();
121
+ }
122
+ }
123
+ return _timeString;
124
+ },
125
+ formatDateTime: function( _dateTimeEpoch, _options ){
126
+ var _this = HLocale.dateTime;
127
+ return _this.formatDate( _dateTimeEpoch, _options ) + ' ' + _this.formatTime( _dateTimeEpoch, _options );
128
+ }
129
+ }
130
+ };
131
+
@@ -64,15 +64,21 @@ HSystem = {
64
64
  /** Calls applications, uses the prority as a prioritizer.
65
65
  **/
66
66
  scheduler: function(){
67
-
67
+ var
68
+ _appId=0,
69
+ _priority;
68
70
  // Loop through all applications:
69
- for( var _appId=0; _appId<this.apps.length; _appId++ ){
71
+ for( ; _appId<this.apps.length; _appId++ ){
70
72
  // Check, if the application exists:
71
73
  if( this.apps[ _appId ] ){
72
74
  // Check, if the application is busy:
73
75
  if( !this.busyApps[ _appId ] ){
76
+ _priority = this.appPriorities[ _appId ];
77
+ if( _priority < 0 ){
78
+ continue;
79
+ }
74
80
  // Check, if the tick count matches the priority of the app:
75
- if( (this.ticks % this.appPriorities[ _appId ]) === 0 ){
81
+ if( this.ticks % _priority === 0 ){
76
82
  // Set the app busy, the app itself should "unbusy" itself, when the idle call is done.
77
83
  // That happens in <HApplication._startIdle>
78
84
 
@@ -198,15 +204,33 @@ HSystem = {
198
204
  *
199
205
  **/
200
206
  killApp: function(_appId, _forced){
201
- if( !_forced ){
202
- var _startedWaiting = new Date().getTime();
203
- while( this.busyApps[ _appId ] === true ) {
204
- /* Waiting for the app to finish its idle loop... */
205
- if (new Date().getTime() > _startedWaiting + this.maxAppRunTime) {
206
- break;
207
- }
208
- }
207
+ this.reniceApp( _appId, -1 ); // prevent new idle calls to the app
208
+ if( _forced || ( this.busyApps[ _appId ] === false ) ){
209
+ this._forceKillApp( _appId );
209
210
  }
211
+ else {
212
+ /* Waiting for the app to finish its idle loop before killing it */
213
+ var
214
+ _startedWaiting = new Date().getTime(),
215
+ _this = this,
216
+ _timeout = setInterval(
217
+ function(){
218
+ if( _this.busyApps[ _appId ] === true ) {
219
+ if (new Date().getTime() > _startedWaiting + _this.maxAppRunTime) {
220
+ clearTimeout(_timeout);
221
+ _this._forceKillApp( _appId );
222
+ }
223
+ else {
224
+ clearTimeout(_timeout);
225
+ _this._forceKillApp( _appId );
226
+ }
227
+ }
228
+ }, 10
229
+ );
230
+ }
231
+ },
232
+
233
+ _forceKillApp: function( _appId ){
210
234
  this.busyApps[_appId] = true;
211
235
 
212
236
  this.apps[ _appId ].destroyAllViews();
@@ -331,7 +355,6 @@ HSystem = {
331
355
  _viewLen = _views.length,
332
356
 
333
357
  // reference to the setStyle method of the element manager
334
- _setStyl = ELEM.setStyle,
335
358
 
336
359
  // reference to HSystem.views (collection of all views, by index)
337
360
  _sysViews = _this.views,
@@ -370,8 +393,12 @@ HSystem = {
370
393
  // the element id of the view
371
394
  _elemId = _view[ _elemIdStr ];
372
395
 
396
+ if( _elemId === undefined ){
397
+ continue;
398
+ }
399
+
373
400
  // do the element manager call itself to update the dom property
374
- _setStyl( _elemId, _zIdxStr, i );
401
+ ELEM.setStyle( _elemId, _zIdxStr, i );
375
402
  }
376
403
  }
377
404
  }
@@ -388,6 +388,27 @@ HThemeManager = HClass.extend({
388
388
  _cssTmpl = _cssTmpl.replace( this._variable_match, eval( RegExp.$1 ) );
389
389
  }
390
390
  return _cssTmpl;
391
+ },
392
+
393
+ _initFns: [],
394
+ _pushStarted: false,
395
+ _pushStart: function( _fn ){
396
+ if(this._pushStarted){
397
+ _fn();
398
+ }
399
+ else{
400
+ this._initFns.push( _fn );
401
+ }
402
+ },
403
+ _start: function(){
404
+ var
405
+ _this = this,
406
+ i = 0;
407
+ _this._pushStarted = true;
408
+ for( ; i<_this._initFns.length; i++){
409
+ _this._initFns[i]();
410
+ }
411
+ _this._initFns = [];
391
412
  }
392
413
 
393
414
  });
@@ -19,7 +19,7 @@ HMarkupView = HClass.extend({
19
19
  /** = Description
20
20
  * Evaluates the pieces of code defined in the markup template marked with
21
21
  * syntax #{}.
22
- * Can't use } characters in the code though.
22
+ * Can't use } characters in the code though.
23
23
  * --
24
24
  * This might need another look...
25
25
  * ++
@@ -30,10 +30,10 @@ HMarkupView = HClass.extend({
30
30
 
31
31
  var _markup = this.markup;
32
32
 
33
- while ( HMarkupView._assignment_match.test(_markup) ) {
33
+ while ( HMarkupView._assignment_match.test(_markup) ) {
34
34
  _markup = _markup.replace( HMarkupView._assignment_match, this.evalMarkupVariable(RegExp.$1,true) );
35
35
  }
36
- while ( HMarkupView._variable_match.test(_markup) ) {
36
+ while ( HMarkupView._variable_match.test(_markup) ) {
37
37
  _markup = _markup.replace( HMarkupView._variable_match, this.evalMarkupVariable(RegExp.$1) );
38
38
  }
39
39
 
@@ -42,20 +42,20 @@ HMarkupView = HClass.extend({
42
42
  return this;
43
43
  },
44
44
  /** = Description
45
- * Evaluates a string and throws an error into console.log
46
- * if the string doesn't pass evaluation.
47
- * If _isAssignment flag is set to true returns empty string.
48
- * if _isAssignment is set to false will return string if it passes
45
+ * Evaluates a string and throws an error into console.log
46
+ * if the string doesn't pass evaluation.
47
+ * If _isAssignment flag is set to true returns empty string.
48
+ * if _isAssignment is set to false will return string if it passes
49
49
  * evaluation.
50
50
  *
51
51
  * = Parameters
52
52
  * +_strToEval+:: A String to evaluate.
53
53
  *
54
- * +_isAssignment+:: Flag to indicate return the String upon passed
54
+ * +_isAssignment+:: Flag to indicate return the String upon passed
55
55
  * evaluation(false) or return of an empty String(true).
56
56
  *
57
57
  * = Returns
58
- * +String+
58
+ * +String+
59
59
  *
60
60
  **/
61
61
  evalMarkupVariable: function(_strToEval,_isAssignment){
@@ -81,14 +81,14 @@ HMarkupView = HClass.extend({
81
81
  },
82
82
 
83
83
  /** = Description
84
- * Sets or unsets the _cssClass into a DOM element that goes by the ID
84
+ * Sets or unsets the _cssClass into a DOM element that goes by the ID
85
85
  * _elementId.
86
86
  *
87
87
  * = Parameters
88
- * +_elementId+:: ID of the DOM element, or the element itself, to be
88
+ * +_elementId+:: ID of the DOM element, or the element itself, to be
89
89
  * modified.
90
90
  * +_cssClass+:: Name of the CSS class to be added or removed.
91
- * +_setOn+:: Boolean value that tells should the CSS class be added or
91
+ * +_setOn+:: Boolean value that tells should the CSS class be added or
92
92
  * removed.
93
93
  *
94
94
  * = Returns
@@ -299,7 +299,6 @@ HView = HClass.extend({
299
299
  *
300
300
  **/
301
301
  constructor: function(_rect, _parent, _options) {
302
-
303
302
  if( !_options ){
304
303
  _options = {};
305
304
  }
@@ -625,7 +624,6 @@ HView = HClass.extend({
625
624
  i = 0,
626
625
  _this = this,
627
626
  _elemId = _this.elemId,
628
- _styl = ELEM.setStyle,
629
627
  _rect = _this.rect,
630
628
  _auto = 'auto',
631
629
  _left = _this.flexLeft?_rect.left:_auto,
@@ -655,9 +653,11 @@ HView = HClass.extend({
655
653
  if( i < 6 && _value !== _auto ){
656
654
  _value += 'px';
657
655
  }
658
- _styl(_elemId,_key,_value,true);
656
+ ELEM.setStyle(_elemId,_key,_value,true);
657
+ }
658
+ if(this.drawn === false){
659
+ _this._updateZIndex();
659
660
  }
660
- (this.drawn === false) && _this._updateZIndex();
661
661
 
662
662
  if ( _this._cachedLeft !== _rect.left || _this._cachedTop !== _rect.top) {
663
663
  _this.invalidatePositionCache();
@@ -698,6 +698,7 @@ HView = HClass.extend({
698
698
  * +self+
699
699
  *
700
700
  **/
701
+ _ieNoThrough: null,
701
702
  draw: function() {
702
703
  var _isDrawn = this.drawn;
703
704
  this.drawRect();
@@ -706,6 +707,11 @@ HView = HClass.extend({
706
707
  if(this['componentName']!==undefined){
707
708
  this.drawMarkup();
708
709
  }
710
+ else if(BROWSER_TYPE.ie && this._ieNoThrough === null){
711
+ this._ieNoThrough = ELEM.make( this.elemId );
712
+ ELEM.setCSS( this._ieNoThrough, 'position:absolute;left:0;top:0;bottom:0;right:0;background-color:#ffffff;font-size:0;line-height:0' );
713
+ ELEM.setStyle( this._ieNoThrough, 'opacity', 0.01 );
714
+ }
709
715
  this.drawSubviews();
710
716
  if(this.options.style){
711
717
  this.setStyles( this.options.style );
@@ -837,7 +843,7 @@ HView = HClass.extend({
837
843
  _reFrom = _reArr[i][0];
838
844
  _reTo = _reArr[i][1];
839
845
  _html = _html.replace( _reFrom, _reTo );
840
- }
846
+ }
841
847
  return _html;
842
848
  },
843
849
  _escapeHTMLArr: [
@@ -875,8 +881,17 @@ HView = HClass.extend({
875
881
  /** Gets the size of the parent. If the parent is the document body, uses the browser window size.
876
882
  **/
877
883
  parentSize: function(){
884
+ if(!this.parent){
885
+ return [ 0, 0 ];
886
+ }
878
887
  if(this.parent.elemId === 0){
879
- var _winSize = ELEM.windowSize();
888
+ var
889
+ _winSize = ELEM.windowSize(),
890
+ _docSize = ELEM.getScrollSize(0);
891
+ // console.log('winSize:',JSON.stringify(_winSize),', docSize:',JSON.stringify(_docSize));
892
+ if( _docSize[0] > _winSize[0] || _docSize[1] > _winSize[1] ){
893
+ _winSize = _docSize;
894
+ }
880
895
  return [ _winSize[0], _winSize[1] ];
881
896
  }
882
897
  else {
@@ -885,7 +900,7 @@ HView = HClass.extend({
885
900
  _width, // = _rect.width,
886
901
  _height, // = _rect.height;
887
902
  _parentElemId = ( this.parent.markupElemIds && this.parent.markupElemIds.subview ) ? this.parent.markupElemIds.subview : this.parent.elemId;
888
- if (this.parent.flexLeft && this.parent.flexRight){
903
+ if (this.parent.flexLeft && this.parent.flexRight){
889
904
  _width = parseInt( ELEM.getStyle( _parentElemId, 'width', true ), 10 );
890
905
  }
891
906
  else {
@@ -956,11 +971,13 @@ HView = HClass.extend({
956
971
  _validWidth = (typeof _width === 'number'),
957
972
  _validHeight = (typeof _height === 'number'),
958
973
  _right,
959
- _bottom;
974
+ _bottom,
975
+ _parentSize,
976
+ _parentWidth,
977
+ _parentHeight;
960
978
  if(_arrLen === 6){
961
- var
962
- _parentSize = this.parentSize(),
963
- _parentWidth = _parentSize[0],
979
+ _parentSize = this.parentSize();
980
+ _parentWidth = _parentSize[0];
964
981
  _parentHeight = _parentSize[1];
965
982
  }
966
983
 
@@ -987,7 +1004,9 @@ HView = HClass.extend({
987
1004
  }
988
1005
  else if(_validLeftOffset && _validRightOffset){
989
1006
  _right = _parentWidth - _rightOffset;
990
- _validWidth && this.setMinWidth( _width );
1007
+ if( _validWidth ){
1008
+ this.setMinWidth( _width );
1009
+ }
991
1010
  _right = _parentWidth - _rightOffset;
992
1011
  }
993
1012
 
@@ -1000,11 +1019,18 @@ HView = HClass.extend({
1000
1019
  }
1001
1020
  else if(_validTopOffset && _validBottomOffset){
1002
1021
  _bottom = _parentHeight - _bottomOffset;
1003
- _validHeight && this.setMinHeight( _height );
1022
+ if( _validHeight ){
1023
+ this.setMinHeight( _height );
1024
+ }
1004
1025
  _bottom = _parentHeight - _bottomOffset;
1005
1026
  }
1027
+ if( _leftOffset > _right ){
1028
+ _right = _leftOffset;
1029
+ }
1030
+ if( _topOffset > _bottom ){
1031
+ _bottom = _topOffset;
1032
+ }
1006
1033
  this.rect = HRect.nu(_leftOffset,_topOffset,_right,_bottom);
1007
-
1008
1034
  if(!this.rect.isValid){
1009
1035
  console.log('---------------------------------------------');
1010
1036
  console.log('invalid rect:', this.rect.left, ',', this.rect.top, ',', this.rect.width, ',', this.rect.height, ',', this.rect.right, ',', this.rect.bottom );
@@ -1113,7 +1139,7 @@ HView = HClass.extend({
1113
1139
  * +self+
1114
1140
  *
1115
1141
  **/
1116
- setStyleOfPart: function(_partName, _name, _value, _cacheOverride) {
1142
+ setStyleOfPart: function(_partName, _name, _value, _force) {
1117
1143
  if (!this['markupElemIds']){
1118
1144
  console.log('Warning, setStyleOfPart: no markupElemIds');
1119
1145
  }
@@ -1121,7 +1147,7 @@ HView = HClass.extend({
1121
1147
  console.log('Warning, setStyleOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
1122
1148
  }
1123
1149
  else {
1124
- ELEM.setStyle(this.markupElemIds[_partName], _name, _value, _cacheOverride);
1150
+ ELEM.setStyle(this.markupElemIds[_partName], _name, _value, _force);
1125
1151
  }
1126
1152
  return this;
1127
1153
  },
@@ -1138,12 +1164,12 @@ HView = HClass.extend({
1138
1164
  * The style of a specified markup element.
1139
1165
  *
1140
1166
  **/
1141
- styleOfPart: function(_partName, _name) {
1167
+ styleOfPart: function(_partName, _name, _force) {
1142
1168
  if (this.markupElemIds[_partName]===undefined) {
1143
1169
  console.log('Warning, styleOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
1144
1170
  return '';
1145
1171
  }
1146
- return ELEM.getStyle(this.markupElemIds[_partName], _name);
1172
+ return ELEM.getStyle(this.markupElemIds[_partName], _name, _force);
1147
1173
  },
1148
1174
 
1149
1175
  /** = Description
@@ -1176,7 +1202,7 @@ HView = HClass.extend({
1176
1202
  * +_partName+:: The identifier of the markup element.
1177
1203
  *
1178
1204
  * = Returns
1179
- * The style of a specified markup element.
1205
+ * The markup of a specified markup element.
1180
1206
  *
1181
1207
  **/
1182
1208
  markupOfPart: function(_partName) {
@@ -1186,6 +1212,66 @@ HView = HClass.extend({
1186
1212
  }
1187
1213
  return ELEM.getHTML(this.markupElemIds[_partName]);
1188
1214
  },
1215
+
1216
+ /** = Description
1217
+ * Sets a element attribute of a specified markup element that has been bound to this
1218
+ * view.
1219
+ *
1220
+ * = Parameters
1221
+ * +_partName+:: The identifier of the markup element.
1222
+ * +_value+:: Value for markup element.
1223
+ *
1224
+ * = Returns
1225
+ * +self+
1226
+ *
1227
+ **/
1228
+ setAttrOfPart: function( _partName, _value, _force ) {
1229
+ if (this.markupElemIds[_partName]===undefined) {
1230
+ console.log('Warning, setAttrOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
1231
+ }
1232
+ else {
1233
+ ELEM.setAttr( this.markupElemIds[_partName], _value, _force );
1234
+ }
1235
+ return this;
1236
+ },
1237
+
1238
+ /** = Description
1239
+ * Returns a element attribute of a specified markup element that has been bound to this
1240
+ * view.
1241
+ *
1242
+ * = Parameters
1243
+ * +_partName+:: The identifier of the markup element.
1244
+ *
1245
+ * = Returns
1246
+ * The attribute of a specified markup element.
1247
+ *
1248
+ **/
1249
+ attrOfPart: function(_partName, _force) {
1250
+ if (this.markupElemIds[_partName]===undefined) {
1251
+ console.log('Warning, attrOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
1252
+ return '';
1253
+ }
1254
+ return ELEM.getAttr(this.markupElemIds[_partName], _force);
1255
+ },
1256
+
1257
+ /** = Description
1258
+ * Returns a element itself of a specified markup element that has been bound to this
1259
+ * view.
1260
+ *
1261
+ * = Parameters
1262
+ * +_partName+:: The identifier of the markup element.
1263
+ *
1264
+ * = Returns
1265
+ * The element of a specified markup element.
1266
+ *
1267
+ **/
1268
+ elemOfPart: function(_partName) {
1269
+ if (this.markupElemIds[_partName]===undefined) {
1270
+ console.log('Warning, elemOfPart: partName "'+_partName+'" does not exist for viewId '+this.viewId+'.');
1271
+ return '';
1272
+ }
1273
+ return ELEM.get( this.markupElemIds[_partName] );
1274
+ },
1189
1275
 
1190
1276
  /** = Description
1191
1277
  * Hides the component's main DOM element (and its children).
@@ -1293,9 +1379,12 @@ HView = HClass.extend({
1293
1379
  // this._domElementBindings = [];
1294
1380
  }
1295
1381
 
1382
+ if( this._ieNoThrough !== null ){
1383
+ ELEM.del( this._ieNoThrough );
1384
+ }
1296
1385
  // Remove the DOM object itself
1297
1386
  ELEM.del(this.elemId);
1298
-
1387
+
1299
1388
  this.rect = null;
1300
1389
  var _this = this;
1301
1390
  for( i in _this ){
@@ -1306,11 +1395,11 @@ HView = HClass.extend({
1306
1395
 
1307
1396
  /** Recursive idle poller. Should be extended if functionality is desired.
1308
1397
  **/
1309
- onIdle: function() {
1310
- for(var i = 0; i < this.views.length; i++) {
1311
- HSystem.views[this.views[i]].onIdle();
1312
- }
1313
- },
1398
+ // onIdle: function() {
1399
+ // for(var i = 0; i < this.views.length; i++) {
1400
+ // HSystem.views[this.views[i]].onIdle();
1401
+ // }
1402
+ //},
1314
1403
 
1315
1404
  /** Used by addView to build a parents array of parent classes.
1316
1405
  **/
@@ -1361,7 +1450,7 @@ HView = HClass.extend({
1361
1450
  *
1362
1451
  **/
1363
1452
  removeView: function(_viewId) {
1364
- HSystem.views[_viewId].remove();
1453
+ this.app.removeView( _viewId ); // no reason to duplicate this functionality here
1365
1454
  return this;
1366
1455
  },
1367
1456
 
@@ -1799,7 +1888,9 @@ HView = HClass.extend({
1799
1888
  **/
1800
1889
  invalidatePositionCache: function() {
1801
1890
  for(var i=0; i<this.views.length; i++) {
1802
- HSystem.views[this.views[i]].invalidatePositionCache();
1891
+ if( typeof HSystem.views[this.views[i]]['invalidatePositionCache'] === 'function' ){
1892
+ HSystem.views[this.views[i]].invalidatePositionCache();
1893
+ }
1803
1894
  }
1804
1895
  return this;
1805
1896
  },
@@ -1843,6 +1934,109 @@ HView = HClass.extend({
1843
1934
  ELEM.del(_elementId);
1844
1935
  this._domElementBindings.splice(_indexOfElementId, 1);
1845
1936
  }
1937
+ },
1938
+
1939
+
1940
+ /** = Description
1941
+ * Finds a string from the locale of the component.
1942
+ * The attrPath is a string or array to find an object.
1943
+ * For instance, if a component has a structure like this defined:
1944
+ * HLocale.components.FooComponent = {
1945
+ * strings: {
1946
+ * defaultLabel: 'Default Label',
1947
+ * otherLabel: 'Other Label',
1948
+ * }
1949
+ * };
1950
+ *
1951
+ * To get the defaultLabel, call getLocaleString like this:
1952
+ * this.getLocaleString( 'FooComponent', 'strings.defaultLabel' );
1953
+ * ..or:
1954
+ * this.getLocaleString( 'FooComponent', ['strings','defaultLabel'] );
1955
+ * ..or:
1956
+ * this.getLocaleString( 'FooComponent.strings.defaultLabel' );
1957
+ *
1958
+ * = Parameters
1959
+ * +_componentClassName+:: The name of the item in HLocale.components
1960
+ * +_attrPath+:: The object path to the string. String or Array.
1961
+ * +_default+:: The default object to return if nothing matched.
1962
+ *
1963
+ **/
1964
+ getLocaleString: function( _componentClassName, _attrPath, _default ){
1965
+ if( _default === undefined ){
1966
+ _default = '';
1967
+ }
1968
+ var
1969
+ _searchTarget = HLocale.components[_componentClassName],
1970
+ i = 0,
1971
+ _key;
1972
+ if( _searchTarget === undefined && (typeof _componentClassName === 'string') ){
1973
+ _searchTarget = HLocale.components;
1974
+ _attrPath = _componentClassName;
1975
+ _default = _attrPath;
1976
+ }
1977
+ if( typeof _attrPath === 'string' ){
1978
+ if( _attrPath.indexOf( '.' ) > 0 ){
1979
+ _attrPath = _attrPath.split('.');
1980
+ }
1981
+ else {
1982
+ _attrPath = [ _attrPath ];
1983
+ }
1984
+ }
1985
+ if( _searchTarget[ _attrPath[0] ] === undefined ){
1986
+ _searchTarget = HLocale;
1987
+ }
1988
+ if( _searchTarget[ _attrPath[0] ] === undefined ){
1989
+ return _default;
1990
+ }
1991
+ for( ; i < _attrPath.length; i++ ){
1992
+ _key = _attrPath[i];
1993
+ if( typeof _searchTarget[_key] === 'object' ){
1994
+ _searchTarget = _searchTarget[_key];
1995
+ }
1996
+ else if( typeof _searchTarget[_key] === 'string' ){
1997
+ return _searchTarget[_key];
1998
+ }
1999
+ else {
2000
+ return _default;
2001
+ }
2002
+ }
2003
+ return _default;
2004
+ },
2005
+
2006
+ isParentOf: function( _obj ){
2007
+ if( !_obj ){
2008
+ return false;
2009
+ }
2010
+ if( typeof _obj['hasAncestor'] === 'function' ){
2011
+ if( _obj.parents.indexOf( this ) !== -1 ){
2012
+ return true;
2013
+ }
2014
+ }
2015
+ return false;
2016
+ },
2017
+
2018
+ isChildOf: function( _obj ){
2019
+ if( !_obj ){
2020
+ return false;
2021
+ }
2022
+ if( typeof _obj['isParentOf'] === 'function' ){
2023
+ return _obj.isParentOf( this );
2024
+ }
2025
+ return false;
2026
+ },
2027
+
2028
+ isSiblingOf: function( _obj ){
2029
+ if( !_obj ){
2030
+ return false;
2031
+ }
2032
+ if( typeof _obj['parents'] === 'object' && _obj.parents instanceof Array ){
2033
+ if( _obj.parents.length !== this.parents.length ){
2034
+ return false;
2035
+ }
2036
+ var i = this.parents.length-1;
2037
+ return _obj.parents[i] === this.parents[i];
2038
+ }
2039
+ return false;
1846
2040
  }
1847
2041
 
1848
2042