rsence 2.1.3 → 2.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.1.3
1
+ 2.1.4
@@ -25,14 +25,15 @@
25
25
  COMM.SessionWatcher = HApplication.extend({
26
26
  constructor: function( _timeoutSecs, _sesTimeoutValueId ){
27
27
 
28
- // onIdle is called when HSystem's ticker count % 100 == 0
29
- // this means it's 5 seconds with HSystemTickerInterval 50
30
- this.base(10, 'SesWatcher');
31
-
32
28
  // gets the HValue represented by
33
29
  // sesTimeoutValueId (:client_time in server)
34
30
  this.sesTimeoutValue = COMM.Values.values[_sesTimeoutValueId];
35
31
  this.timeoutSecs = _timeoutSecs;
32
+
33
+ // onIdle is called when HSystem's ticker count % 100 == 0
34
+ // this means it's 5 seconds with HSystemTickerInterval 50
35
+ this.base(10, 'SesWatcher');
36
+
36
37
  },
37
38
 
38
39
  // Tells the server the client's current time
@@ -25,7 +25,7 @@
25
25
  }
26
26
 
27
27
  .button_edge_left {
28
- left: 0px; width: 24px;
28
+ left: 0px; width: 6px;
29
29
  background-position: 0px 0px;
30
30
  }
31
31
  .disabled > .button_control > .button_edge_left {
@@ -39,21 +39,21 @@
39
39
  }
40
40
 
41
41
  .button_edge_right {
42
- right: 0px; width: 24px;
43
- background-position: -24px 0px;
42
+ right: 0px; width: 6px;
43
+ background-position: -42px 0px;
44
44
  }
45
45
  .disabled > .button_control > .button_edge_right {
46
- background-position: -24px -144px;
46
+ background-position: -42px -144px;
47
47
  }
48
48
  .enabled > .button_control:hover > .button_edge_right {
49
- background-position: -24px -48px;
49
+ background-position: -42px -48px;
50
50
  }
51
51
  .enabled > .button_control:active > .button_edge_right {
52
- background-position: -24px -96px;
52
+ background-position: -42px -96px;
53
53
  }
54
54
 
55
55
  .button_center {
56
- left: 24px; right: 24px;
56
+ left: 6px; right: 6px;
57
57
  background-position: 0px -24px;
58
58
  }
59
59
  .disabled > .button_control > .button_center {
@@ -23,6 +23,10 @@ HTimeSheet = HControl.extend({
23
23
  /* Default amount of pixels from right. Override with options when necessary. */
24
24
  itemOffsetRight: 0,
25
25
 
26
+ defaultEvents: {
27
+ draggable: true
28
+ },
29
+
26
30
  controlDefaults: HControlDefaults.extend({
27
31
  pxPerHour: null,
28
32
  itemOffsetLeft: null,
@@ -120,9 +124,29 @@ HTimeSheet = HControl.extend({
120
124
  *
121
125
  **/
122
126
  startDrag: function(x,y){
123
- this.createItem(y-this.pageY());
124
- EVENT.startDragging( this.dragItem );
127
+ this._startDragTime = new Date().getTime();
128
+ this._startDragCoords = [x,y];
129
+ return true;
130
+ },
131
+
132
+ drag: function(x,y){
133
+ if(((new Date().getTime()) - this._startDragTime) < 200){
134
+ // only create when 200 ms has elapsed to enable clicking
135
+ return true;
136
+ }
137
+ if(this._startDragCoords[0]!==x && this._startDragCoords[1]!==y){
138
+ this.createItem(this._startDragCoords[1]-this.pageY());
139
+ EVENT.startDragging( this.dragItem );
140
+ return true;
141
+ }
142
+ },
143
+
144
+ click: function(x,y){
145
+ // deactivate all items
146
+ EVENT.changeActiveControl(this);
147
+ return true;
125
148
  },
149
+
126
150
  listItemViews: false,
127
151
 
128
152
  /** = Description
@@ -145,10 +169,10 @@ HTimeSheet = HControl.extend({
145
169
  *
146
170
  **/
147
171
  createItemRect: function(_origY, _lineHeight){
148
- var _left = this.itemOffsetLeft,
149
- _top = _origY,
150
- _right = this.rect.width - this.itemOffsetRight,
151
- _bottom = _origY + _lineHeight;
172
+ var _left = this.itemOffsetLeft+1,
173
+ _top = _origY+1,
174
+ _right = this.rect.width - this.itemOffsetRight - 1,
175
+ _bottom = _origY + _lineHeight - 2;
152
176
  return HRect.nu( _left, _top, _right, _bottom );
153
177
  },
154
178
 
@@ -204,24 +228,61 @@ HTimeSheet = HControl.extend({
204
228
  *
205
229
  **/
206
230
  refreshValue: function(){
207
- var _data = this.value, i;
231
+ var
232
+ _data = this.value,
233
+ i;
208
234
  if(this.listItemViews === false){
209
235
  this.listItemViews = [];
210
236
  }
211
- if(this.listItemViews.length !== 0){
237
+ else if(this.listItemViews.length > 0){
212
238
  for( i=0; i<this.listItemViews.length; i++){
213
239
  this.listItemViews[i].die();
214
240
  }
215
241
  this.listItemViews = [];
216
242
  }
217
- if(_data instanceof Array){
218
- var _value, _item;
243
+ if(_data instanceof Array && _data.length > 0){
244
+ var
245
+ _value,
246
+ _item;
219
247
  for( i=0; i<_data.length; i++){
220
248
  _value = _data[i];
221
249
  _item = this.createTimeSheetItem( _value );
222
250
  this.listItemViews.push( _item );
223
251
  }
224
252
  }
253
+ var
254
+ _overlaps = [],
255
+ j;
256
+ for(i=0;i<this.listItemViews.length;i++){
257
+ for(j=0;j<this.listItemViews.length;j++){
258
+ if((i !== j) && (_overlaps.indexOf(i)===-1) && (_overlaps.indexOf(j)===-1)){
259
+ if(this.listItemViews[i].rect.intersects(this.listItemViews[j].rect)){
260
+ _overlaps.push(i);
261
+ }
262
+ }
263
+ }
264
+ }
265
+ var
266
+ _overlapCount = _overlaps.length+1,
267
+ _overlapLefts = {},
268
+ _itemWidth = ( this.rect.width - this.itemOffsetRight - this.itemOffsetLeft ),
269
+ _width = Math.floor( _itemWidth / _overlapCount),
270
+ _left = this.itemOffsetLeft;
271
+ for(j=0;j<_overlapCount;j++){
272
+ _overlapLefts[_overlaps[j]] = _left + (j*_width) + _width;
273
+ }
274
+ for(i=0;i<this.listItemViews.length;i++){
275
+ if(_overlaps.indexOf(i)===-1){
276
+ this.listItemViews[i].rect.setLeft(_left);
277
+ }
278
+ else {
279
+ this.listItemViews[i].rect.setLeft(_overlapLefts[i]);
280
+ }
281
+ this.listItemViews[i].rect.setWidth(_width);
282
+ }
283
+ for(i=0;i<this.listItemViews.length;i++){
284
+ this.listItemViews[i].drawRect();
285
+ }
225
286
  }
226
287
  });
227
288
 
@@ -17,12 +17,18 @@ HTimeSheetItem = HControl.extend({
17
17
  /* Which mode the component is in. When created by dragging, acts in 'create' mode, otherwise is 'normal'. Can be overridden in options. */
18
18
  dragMode: 'create',
19
19
 
20
- /* The previous coordinate. Used to detect double-drag as double-click. */
20
+ /* The previous coordinate. Used to detect double-drag as double-click */
21
21
  prevXY: [0,0],
22
22
 
23
23
  /* The time at the previous coordinate. Used to detect double-drag as double-click. */
24
24
  prevXYTime: 0,
25
25
 
26
+ defaultEvents: {
27
+ draggable: true,
28
+ click: true,
29
+ doubleClick: true
30
+ },
31
+
26
32
  controlDefaults: HControlDefaults.extend({
27
33
  dragMode: 'create',
28
34
  constructor: function(_ctrl){
@@ -46,12 +52,7 @@ HTimeSheetItem = HControl.extend({
46
52
  _yEquals = (Math.round(this.prevXY[1]/4) === Math.round(y/4)),
47
53
  _noTimeout = ((_timeNow - this.prevXYTime) < 500);
48
54
  if( _xEquals && _yEquals && _noTimeout ) { // doubleClick
49
- if( this.parent['editor'] ){
50
- var _editor = this.parent.editor;
51
- _editor.setTimeSheetItem(this);
52
- _editor.bringToFront();
53
- _editor.show();
54
- }
55
+ return true;
55
56
  }
56
57
  else {
57
58
  var _diffTop = this.rect.top - this.origY,
@@ -74,6 +75,17 @@ HTimeSheetItem = HControl.extend({
74
75
  return true;
75
76
  },
76
77
 
78
+ doubleClick: function(x,y){
79
+ if( this.parent['editor'] ){
80
+ var _editor = this.parent.editor;
81
+ _editor.setTimeSheetItem(this);
82
+ _editor.bringToFront();
83
+ _editor.show();
84
+ return true;
85
+ }
86
+ return false;
87
+ },
88
+
77
89
  /** = Description
78
90
  * Label setter function.
79
91
  *
@@ -217,8 +229,13 @@ HTimeSheetItem = HControl.extend({
217
229
  *
218
230
  **/
219
231
  endDrag: function(x,y){
220
- var _pxPerHour = Math.floor(this.parent.pxPerHour),
221
- _value;
232
+ var
233
+ _pxPerHour = Math.floor(this.parent.pxPerHour),
234
+ _value,
235
+ _yEquals = (Math.round(this.prevXY[1]/4) === Math.round(y/4));
236
+ if(_yEquals){ // nothing moved, just return.
237
+ return true;
238
+ }
222
239
  if(this.dragMode === 'create'){
223
240
  this.parent.listItemViews.push( this );
224
241
  _value = {};
@@ -259,11 +276,11 @@ HTimeSheetItem = HControl.extend({
259
276
  },
260
277
 
261
278
  _getValueTop: function( _value ){
262
- return _value.timeBegin * this.parent.pxPerHour;
279
+ return (_value.timeBegin * this.parent.pxPerHour)+1;
263
280
  },
264
281
 
265
282
  _getValueBottom: function( _value ){
266
- return _value.timeEnd * this.parent.pxPerHour;
283
+ return (_value.timeEnd * this.parent.pxPerHour)-2;
267
284
  },
268
285
 
269
286
  /** = Description
@@ -187,10 +187,16 @@ HApplication = HClass.extend({
187
187
  * resistant. Do not extend.
188
188
  **/
189
189
  _startIdle: function(){
190
- HSystem.busyApps[ this.appId ] = true;
191
- this.onIdle();
192
- this._pollViews();
193
- HSystem.busyApps[ this.appId ] = false;
190
+ var _this = this;
191
+ HSystem.busyApps[ _this.appId ] = true;
192
+ this._busyTimer = setTimeout(
193
+ function(){
194
+ _this.onIdle();
195
+ _this._pollViews();
196
+ HSystem.busyApps[ _this.appId ] = false;
197
+ },
198
+ 10
199
+ );
194
200
  },
195
201
 
196
202
  /** = Description
@@ -320,10 +320,12 @@ EVENT = {
320
320
  * controls registered for the event.
321
321
  **/
322
322
  resize: function(e) {
323
- var i = 0,
324
- _this = EVENT,
325
- _ctrlID,
326
- _ctrl;
323
+ var
324
+ i = 0,
325
+ _this = EVENT,
326
+ _ctrlID,
327
+ _ctrl;
328
+ HSystem._updateFlexibleRects();
327
329
  for (; i < _this.resizeListeners.length; i++) {
328
330
  _ctrlID = _this.resizeListeners[i];
329
331
  _ctrl = HSystem.views[_ctrlID];
@@ -302,17 +302,19 @@ HSystem = {
302
302
  **/
303
303
  _flushUpdateZIndexOfChilden: function() {
304
304
 
305
- var j=0, // buffer index
306
-
307
- // reference to the HSystem namespace
308
- _this = HSystem,
309
-
310
- // reference to the buffer
311
- _buffer = _this._updateZIndexOfChildrenBuffer,
312
-
313
- // the length of the buffer
314
- _bufLen = _buffer.length;
315
-
305
+ var
306
+
307
+ j = 0, // buffer index
308
+
309
+ // reference to the HSystem namespace
310
+ _this = HSystem,
311
+
312
+ // reference to the buffer
313
+ _buffer = _this._updateZIndexOfChildrenBuffer,
314
+
315
+ // the length of the buffer
316
+ _bufLen = _buffer.length;
317
+
316
318
  // loop buffer length times to get the items
317
319
  for ( ; j < _bufLen; j++ ) {
318
320
 
@@ -657,7 +657,7 @@ HView = HClass.extend({
657
657
  }
658
658
  _styl(_elemId,_key,_value,true);
659
659
  }
660
- (this.drown === false) && _this._updateZIndex();
660
+ (this.drawn === false) && _this._updateZIndex();
661
661
 
662
662
  if ( _this._cachedLeft !== _rect.left || _this._cachedTop !== _rect.top) {
663
663
  _this.invalidatePositionCache();
@@ -885,12 +885,18 @@ HView = HClass.extend({
885
885
  _width, // = _rect.width,
886
886
  _height, // = _rect.height;
887
887
  _parentElemId = ( this.parent.markupElemIds && this.parent.markupElemIds.subview ) ? this.parent.markupElemIds.subview : this.parent.elemId;
888
- // if (this.parent.flexLeft && this.parent.flexRight){
888
+ if (this.parent.flexLeft && this.parent.flexRight){
889
889
  _width = parseInt( ELEM.getStyle( _parentElemId, 'width', true ), 10 );
890
- // }
891
- // if (this.parent.flexBottom && this.parent.flexTop){
890
+ }
891
+ else {
892
+ _width = _rect.width;
893
+ }
894
+ if (this.parent.flexBottom && this.parent.flexTop){
892
895
  _height = parseInt( ELEM.getStyle( _parentElemId, 'height', true ), 10 );
893
- // }
896
+ }
897
+ else {
898
+ _height = _rect.height;
899
+ }
894
900
  return [ _width, _height ];
895
901
  }
896
902
  },
@@ -999,6 +1005,14 @@ HView = HClass.extend({
999
1005
  }
1000
1006
  this.rect = HRect.nu(_leftOffset,_topOffset,_right,_bottom);
1001
1007
 
1008
+ if(!this.rect.isValid){
1009
+ console.log('---------------------------------------------');
1010
+ console.log('invalid rect:', this.rect.left, ',', this.rect.top, ',', this.rect.width, ',', this.rect.height, ',', this.rect.right, ',', this.rect.bottom );
1011
+ console.log(' parent size:', this.parentSize() );
1012
+ console.log(' rect array:', _rect );
1013
+ console.log('---------------------------------------------');
1014
+ }
1015
+
1002
1016
  }
1003
1017
  else {
1004
1018
  console.log(_throwPrefix + 'the length has to be either 4 or 6.');
@@ -102,14 +102,9 @@ HMiniMenu = HRadioButtonList.extend({
102
102
  },
103
103
 
104
104
  drawSubviews: function(){
105
- this.markupElemIds.subview = 0;
106
- this.menuItemView = HView.extend({
107
- bringToFront: function(){
108
- this.setStyle('z-index',10000);//this.app.views.length);
109
- }
110
- }).nu(
111
- [ this.rect.left, this.rect.top, this.rect.width, 500 ],
112
- this, {
105
+ this.menuItemView = HView.nu(
106
+ [ this.rect.left, this.rect.top, this.rect.width, 10 ],
107
+ this.app, {
113
108
  visible: false,
114
109
  style: [
115
110
  ['background-color','#f6f6f6'],
@@ -229,6 +229,10 @@ module RSence
229
229
  end
230
230
 
231
231
  elsif msg.refresh_page?( @plugins.incr ) and @config[:client_autoreload]
232
+ while msg.refresh_page?( @plugins.incr )
233
+ msg.session[:plugin_incr] == @plugins.incr
234
+ sleep 0.5
235
+ end
232
236
  # Forces the client to reload, if plugins are incremented
233
237
  msg.reply("window.location.reload( true );")
234
238
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rsence
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 3
5
5
  prerelease: false
6
6
  segments:
7
7
  - 2
8
8
  - 1
9
- - 3
10
- version: 2.1.3
9
+ - 4
10
+ version: 2.1.4
11
11
  platform: ruby
12
12
  authors:
13
13
  - Riassence Inc.
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-12-12 00:00:00 +02:00
18
+ date: 2010-12-13 00:00:00 +02:00
19
19
  default_executable: rsence
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency