rsence-pre 2.1.8.1 → 2.2.0.0
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/INSTALL.rdoc +3 -3
- data/README.rdoc +4 -4
- data/VERSION +1 -1
- data/conf/default_conf.yaml +4 -1
- data/js/comm/sessionwatcher/sessionwatcher.js +3 -2
- data/js/controls/textcontrol/textcontrol.js +45 -19
- data/js/core/elem/elem.js +6 -0
- data/js/datetime/timesheet/old_timesheet.js +292 -0
- data/js/datetime/timesheet/themes/default/old_timesheet.css +30 -0
- data/js/datetime/timesheet/themes/default/old_timesheet.html +2 -0
- data/js/datetime/timesheet/themes/default/timesheet.css +50 -22
- data/js/datetime/timesheet/themes/default/timesheet.html +4 -2
- data/js/datetime/timesheet/timesheet.js +448 -159
- data/js/datetime/timesheet_item/old_timesheet_item.js +308 -0
- data/js/datetime/timesheet_item/themes/default/old_timesheet_item.css +42 -0
- data/js/datetime/timesheet_item/themes/default/old_timesheet_item.html +8 -0
- data/js/datetime/timesheet_item/themes/default/timesheet_item.css +42 -11
- data/js/datetime/timesheet_item/themes/default/timesheet_item.html +4 -2
- data/js/datetime/timesheet_item/themes/default/timesheet_item_icons.png +0 -0
- data/js/datetime/timesheet_item/timesheet_item.js +156 -259
- data/js/datetime/timesheet_item_edit/old_timesheet_item_edit.js +274 -0
- data/js/datetime/timesheet_item_edit/timesheet_item_edit.js +0 -274
- data/js/foundation/control/valueaction/js.inc +0 -0
- data/js/foundation/control/valueaction/valueaction.js +72 -0
- data/js/foundation/locale_settings/js.inc +0 -0
- data/js/foundation/locale_settings/locale_settings.js +122 -0
- data/js/foundation/system/system.js +3 -2
- data/js/foundation/view/view.js +27 -0
- data/js/lists/checkboxlist/checkboxlist.js +9 -0
- data/js/lists/listitems/listitems.js +16 -0
- data/js/lists/radiobuttonlist/radiobuttonlist.js +17 -1
- data/js/menus/minimenu/minimenu.js +9 -5
- data/lib/conf/argv.rb +1 -0
- metadata +21 -9
@@ -0,0 +1,308 @@
|
|
1
|
+
/* RSence
|
2
|
+
* Copyright 2009 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
|
+
** Item class to be used with HTimeSheet.
|
11
|
+
***/
|
12
|
+
var//RSence.DateTime
|
13
|
+
HTimeSheetItem = HControl.extend({
|
14
|
+
|
15
|
+
componentName: 'timesheet_item',
|
16
|
+
|
17
|
+
/* Which mode the component is in. When created by dragging, acts in 'create' mode, otherwise is 'normal'. Can be overridden in options. */
|
18
|
+
dragMode: 'create',
|
19
|
+
|
20
|
+
/* The previous coordinate. Used to detect double-drag as double-click */
|
21
|
+
prevXY: [0,0],
|
22
|
+
|
23
|
+
/* The time at the previous coordinate. Used to detect double-drag as double-click. */
|
24
|
+
prevXYTime: 0,
|
25
|
+
|
26
|
+
defaultEvents: {
|
27
|
+
draggable: true,
|
28
|
+
click: true,
|
29
|
+
doubleClick: true
|
30
|
+
},
|
31
|
+
|
32
|
+
controlDefaults: HControlDefaults.extend({
|
33
|
+
dragMode: 'create',
|
34
|
+
constructor: function(_ctrl){
|
35
|
+
_ctrl.dragMode = this.dragMode;
|
36
|
+
}
|
37
|
+
}),
|
38
|
+
|
39
|
+
/** = Description
|
40
|
+
* Dragging is used to change coordinates.
|
41
|
+
*
|
42
|
+
* = Parameters
|
43
|
+
* +x+:: X coordinate at the start of drag.
|
44
|
+
* +y+:: Y coordinate at the start of drag.
|
45
|
+
*
|
46
|
+
**/
|
47
|
+
startDrag: function(x,y){
|
48
|
+
this.origY = y-this.parent.pageY();
|
49
|
+
if(this.dragMode === 'normal'){
|
50
|
+
var _timeNow = new Date().getTime(),
|
51
|
+
_xEquals = (Math.round(this.prevXY[0]/4) === Math.round(x/4)),
|
52
|
+
_yEquals = (Math.round(this.prevXY[1]/4) === Math.round(y/4)),
|
53
|
+
_noTimeout = ((_timeNow - this.prevXYTime) < 500);
|
54
|
+
if( _xEquals && _yEquals && _noTimeout ) { // doubleClick
|
55
|
+
return true;
|
56
|
+
}
|
57
|
+
else {
|
58
|
+
var _diffTop = this.rect.top - this.origY,
|
59
|
+
_diffBottom = this.rect.bottom - this.origY;
|
60
|
+
if(0 >= _diffTop && _diffTop >= -3){
|
61
|
+
this.dragMode = 'resize-top';
|
62
|
+
}
|
63
|
+
else if(0 <= _diffBottom && _diffBottom <= 4){
|
64
|
+
this.dragMode = 'resize-bottom';
|
65
|
+
}
|
66
|
+
else {
|
67
|
+
this.dragMode = 'move';
|
68
|
+
this.moveDiff = this.origY - this.rect.top;
|
69
|
+
}
|
70
|
+
this.bringToFront();
|
71
|
+
}
|
72
|
+
}
|
73
|
+
this.prevXY = [x,y];
|
74
|
+
this.prevXYTime = _timeNow;
|
75
|
+
return true;
|
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
|
+
|
89
|
+
/** = Description
|
90
|
+
* Label setter function.
|
91
|
+
*
|
92
|
+
* = Parameters
|
93
|
+
* +_label+:: New label
|
94
|
+
*
|
95
|
+
**/
|
96
|
+
setTimeSheetItemLabel: function(_label){
|
97
|
+
this.label = _label;
|
98
|
+
this.refreshLabel();
|
99
|
+
},
|
100
|
+
|
101
|
+
/** = Description
|
102
|
+
* Function used to calculate the right size for a new
|
103
|
+
* item created by dragging.
|
104
|
+
*
|
105
|
+
* = Parameters
|
106
|
+
* +_y+:: Y coordinate at the start of drag.
|
107
|
+
*
|
108
|
+
**/
|
109
|
+
dragCreate: function(_y){
|
110
|
+
var _negative = (_y < this.origY),
|
111
|
+
_lineHeight = Math.floor(this.parent.pxPerHour/2),
|
112
|
+
_top, _bottom, _diff;
|
113
|
+
if(_negative){
|
114
|
+
var _floorY = Math.floor(_y/_lineHeight)*_lineHeight,
|
115
|
+
_ceilYo = Math.ceil(this.origY/_lineHeight)*_lineHeight;
|
116
|
+
if(_floorY<0){_floorY=0;}
|
117
|
+
_diff = _floorY-_ceilYo;
|
118
|
+
if( _diff <= 0-_lineHeight ){
|
119
|
+
_top = _floorY;
|
120
|
+
_bottom = _ceilYo;
|
121
|
+
}
|
122
|
+
else if( _diff === 0 ){
|
123
|
+
_top = _floorY-_lineHeight;
|
124
|
+
_bottom = _ceilYo;
|
125
|
+
}
|
126
|
+
}
|
127
|
+
else {
|
128
|
+
var _ceilY = Math.ceil(_y/_lineHeight)*_lineHeight,
|
129
|
+
_floorYo = Math.floor(this.origY/_lineHeight)*_lineHeight;
|
130
|
+
if(_ceilY>(_lineHeight*48)){_ceilY=_lineHeight*48;}
|
131
|
+
_diff = _ceilY-_floorYo;
|
132
|
+
if( _diff >= _lineHeight ){
|
133
|
+
_top = _floorYo;
|
134
|
+
_bottom = _ceilY;
|
135
|
+
}
|
136
|
+
else if( _diff === 0 ){
|
137
|
+
_top = _floorYo;
|
138
|
+
_bottom = _ceilY+_lineHeight;
|
139
|
+
}
|
140
|
+
}
|
141
|
+
this.rect.setTop(_top);
|
142
|
+
this.rect.setBottom(_bottom);
|
143
|
+
},
|
144
|
+
|
145
|
+
/** = Description
|
146
|
+
* Resize top by dragging auxiliary function.
|
147
|
+
*
|
148
|
+
* = Parameters
|
149
|
+
* +_y+:: Y coordinate at the start of drag.
|
150
|
+
**/
|
151
|
+
dragResizeTop: function(_y){
|
152
|
+
var _lineHeight = Math.floor(this.parent.pxPerHour/2),
|
153
|
+
_top = Math.floor( _y/_lineHeight )*_lineHeight;
|
154
|
+
if(_top < 0){ _top = 0; }
|
155
|
+
if(_top+_lineHeight > this.rect.bottom){
|
156
|
+
_top = this.rect.bottom - _lineHeight;
|
157
|
+
}
|
158
|
+
this.rect.setTop( _top );
|
159
|
+
},
|
160
|
+
|
161
|
+
/** = Description
|
162
|
+
* Resize function for resizing the bottom of item.
|
163
|
+
*
|
164
|
+
* = Parameters
|
165
|
+
* +_y+:: Y coordinate at the start of drag.
|
166
|
+
*
|
167
|
+
**/
|
168
|
+
dragResizeBottom: function(_y){
|
169
|
+
var _lineHeight = Math.floor(this.parent.pxPerHour/2),
|
170
|
+
_bottom = Math.floor( _y/_lineHeight )*_lineHeight;
|
171
|
+
if(_bottom > _lineHeight*48){ _bottom = _lineHeight*48; }
|
172
|
+
if(_bottom-_lineHeight < this.rect.top){
|
173
|
+
_bottom = this.rect.top + _lineHeight;
|
174
|
+
}
|
175
|
+
this.rect.setBottom( _bottom );
|
176
|
+
},
|
177
|
+
|
178
|
+
/** = Description
|
179
|
+
* Move function for item by dragging and dropping.
|
180
|
+
*
|
181
|
+
* = Parameters
|
182
|
+
* +_y+:: Y coordinate at the start of drag.
|
183
|
+
*
|
184
|
+
**/
|
185
|
+
dragMove: function(_y){
|
186
|
+
var _lineHeight = Math.floor(this.parent.pxPerHour/2),
|
187
|
+
_top = Math.floor( (0-this.moveDiff+_y)/_lineHeight )*_lineHeight;
|
188
|
+
if(_top<0){_top = 0;}
|
189
|
+
if(_top+this.rect.height>_lineHeight*48){
|
190
|
+
_top = _lineHeight*48 - this.rect.height;
|
191
|
+
}
|
192
|
+
this.rect.offsetTo( this.rect.left, _top );
|
193
|
+
},
|
194
|
+
|
195
|
+
/** = Description
|
196
|
+
* Drag function for item. Decides whether the user wants to create a new
|
197
|
+
* item, resize top, resize bottom or move an existing item.
|
198
|
+
*
|
199
|
+
* = Parameters
|
200
|
+
* +x+:: X coordinate at the start of drag.
|
201
|
+
* +y+:: Y coordinate at the start of drag.
|
202
|
+
*
|
203
|
+
**/
|
204
|
+
drag: function(x,y){
|
205
|
+
var _pageY = this.parent.pageY(),
|
206
|
+
_y = y - _pageY;
|
207
|
+
if(this.dragMode === 'create'){
|
208
|
+
this.dragCreate(_y);
|
209
|
+
}
|
210
|
+
else if(this.dragMode === 'resize-top'){
|
211
|
+
this.dragResizeTop(_y);
|
212
|
+
}
|
213
|
+
else if(this.dragMode === 'resize-bottom'){
|
214
|
+
this.dragResizeBottom(_y);
|
215
|
+
}
|
216
|
+
else if(this.dragMode === 'move'){
|
217
|
+
this.dragMove(_y);
|
218
|
+
}
|
219
|
+
this.drawRect();
|
220
|
+
return true;
|
221
|
+
},
|
222
|
+
|
223
|
+
/** = Description
|
224
|
+
* Modifies the existing item's coordinates or creates a new one.
|
225
|
+
*
|
226
|
+
* = Parameters
|
227
|
+
* +x+:: X coordinate at the end of drag.
|
228
|
+
* +y+:: Y coordinate at the end of drag.
|
229
|
+
*
|
230
|
+
**/
|
231
|
+
endDrag: function(x,y){
|
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
|
+
}
|
239
|
+
if(this.dragMode === 'create'){
|
240
|
+
this.parent.listItemViews.push( this );
|
241
|
+
_value = {};
|
242
|
+
this._setValueTop( _value );
|
243
|
+
this._setValueBottom( _value );
|
244
|
+
this._setValueLabel( _value );
|
245
|
+
if(this.parent['editor']){
|
246
|
+
this.parent.editor.createItem( _value );
|
247
|
+
}
|
248
|
+
}
|
249
|
+
else {
|
250
|
+
_value = COMM.Values.clone( this.value );
|
251
|
+
this._setValueTop( _value );
|
252
|
+
this._setValueBottom( _value );
|
253
|
+
if(this.parent['editor']){
|
254
|
+
this.parent.editor.modifyItem( _value );
|
255
|
+
}
|
256
|
+
}
|
257
|
+
this.setValue( _value );
|
258
|
+
this.dragMode = 'normal';
|
259
|
+
return true;
|
260
|
+
},
|
261
|
+
|
262
|
+
_setValueTop: function( _value ) {
|
263
|
+
_value['timeBegin'] = this.rect.top/this.parent.pxPerHour;
|
264
|
+
},
|
265
|
+
|
266
|
+
_setValueBottom: function( _value ) {
|
267
|
+
_value['timeEnd'] = this.rect.bottom/this.parent.pxPerHour;
|
268
|
+
},
|
269
|
+
|
270
|
+
_setValueLabel: function( _value ) {
|
271
|
+
_value['label'] = this.label;
|
272
|
+
},
|
273
|
+
|
274
|
+
_getValueLabel: function( _value ){
|
275
|
+
return _value.label;
|
276
|
+
},
|
277
|
+
|
278
|
+
_getValueTop: function( _value ){
|
279
|
+
return (_value.timeBegin * this.parent.pxPerHour)+1;
|
280
|
+
},
|
281
|
+
|
282
|
+
_getValueBottom: function( _value ){
|
283
|
+
return (_value.timeEnd * this.parent.pxPerHour)-2;
|
284
|
+
},
|
285
|
+
|
286
|
+
/** = Description
|
287
|
+
* Refreshes the object's label and place on the HTimeSheet.
|
288
|
+
*
|
289
|
+
**/
|
290
|
+
refreshValue: function(){
|
291
|
+
if ( HVM.type(this.value) === 'h' ){
|
292
|
+
var
|
293
|
+
_label = this._getValueLabel( this.value ),
|
294
|
+
_top = this._getValueTop( this.value ),
|
295
|
+
_bottom = this._getValueBottom( this.value ),
|
296
|
+
_minHeight = this.parent.options.itemMinHeight;
|
297
|
+
this.setLabel( _label );
|
298
|
+
if( (_bottom - _top) < _minHeight ){
|
299
|
+
_bottom = _top + _minHeight;
|
300
|
+
}
|
301
|
+
this.rect.setTop( _top );
|
302
|
+
this.rect.setBottom( _bottom );
|
303
|
+
this.drawRect();
|
304
|
+
}
|
305
|
+
}
|
306
|
+
});
|
307
|
+
|
308
|
+
|
@@ -0,0 +1,42 @@
|
|
1
|
+
.timesheet_item,
|
2
|
+
.timesheet_item_middle,
|
3
|
+
.timesheet_item_label,
|
4
|
+
.timesheet_item_resize_top,
|
5
|
+
.timesheet_item_move,
|
6
|
+
.timesheet_item_resize_bottom {
|
7
|
+
position: absolute;
|
8
|
+
left: 0px; right: 0px;
|
9
|
+
}
|
10
|
+
.timesheet_item {
|
11
|
+
top: 0px; bottom: 0px;
|
12
|
+
border: 1px solid #c00;
|
13
|
+
background-color: #c66;
|
14
|
+
opacity: 0.75;
|
15
|
+
}
|
16
|
+
.active .timesheet_item {
|
17
|
+
opacity: 1.0;
|
18
|
+
}
|
19
|
+
.timesheet_item_middle {
|
20
|
+
top: 50%; height: 0px;
|
21
|
+
overflow: visible;
|
22
|
+
}
|
23
|
+
.timesheet_item_label {
|
24
|
+
top: -6px; height: 12px;
|
25
|
+
font-size: 12px;
|
26
|
+
text-align: center;
|
27
|
+
color: #333;
|
28
|
+
opacity: 1;
|
29
|
+
font-family: Arial, sans-serif;
|
30
|
+
}
|
31
|
+
.timesheet_item_resize_top {
|
32
|
+
top: 0px; height: 3px;
|
33
|
+
cursor: n-resize;
|
34
|
+
}
|
35
|
+
.timesheet_item_move {
|
36
|
+
top: 3px; bottom: 3px;
|
37
|
+
cursor: move;
|
38
|
+
}
|
39
|
+
.timesheet_item_resize_bottom {
|
40
|
+
bottom: 0px; height: 3px;
|
41
|
+
cursor: s-resize;
|
42
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
<div class="timesheet_item">
|
2
|
+
<div class="timesheet_item_middle">
|
3
|
+
<div class="timesheet_item_label" id="label#{_ID}">#{this.label}</div>
|
4
|
+
</div>
|
5
|
+
<div class="timesheet_item_resize_top"></div>
|
6
|
+
<div class="timesheet_item_resize_bottom"></div>
|
7
|
+
<div class="timesheet_item_move" id="subview#{_ID}"></div>
|
8
|
+
</div>
|
@@ -3,40 +3,71 @@
|
|
3
3
|
.timesheet_item_label,
|
4
4
|
.timesheet_item_resize_top,
|
5
5
|
.timesheet_item_move,
|
6
|
+
.timesheet_item_time,
|
7
|
+
.timesheet_item_icons,
|
6
8
|
.timesheet_item_resize_bottom {
|
7
9
|
position: absolute;
|
8
10
|
left: 0px; right: 0px;
|
9
11
|
}
|
10
12
|
.timesheet_item {
|
11
13
|
top: 0px; bottom: 0px;
|
12
|
-
border: 1px solid #
|
13
|
-
|
14
|
+
border: 1px solid #ccc;
|
15
|
+
border-radius: 7px;
|
14
16
|
opacity: 0.75;
|
15
17
|
}
|
16
|
-
.
|
17
|
-
|
18
|
+
.timesheet_item_time,
|
19
|
+
.timesheet_item_label {
|
20
|
+
font-size: 12px;
|
21
|
+
color: #333;
|
22
|
+
font-family: Helvetica, Arial, sans-serif;
|
23
|
+
}
|
24
|
+
.timesheet_item_time {
|
25
|
+
top: 0px; height: 12px; line-height: 12px;
|
26
|
+
text-indent: 4px; padding-top: 2px;
|
27
|
+
font-weight: bold;
|
28
|
+
}
|
29
|
+
.active > .timesheet_item .timesheet_item_time {
|
30
|
+
border-radius: 7px 7px 0 0;
|
31
|
+
border-bottom: 1px solid #000;
|
32
|
+
/* opacity: 0.2;*/
|
33
|
+
}
|
34
|
+
.active > .timesheet_item {
|
35
|
+
border-color: #000;
|
36
|
+
opacity: 1;
|
18
37
|
}
|
19
38
|
.timesheet_item_middle {
|
20
39
|
top: 50%; height: 0px;
|
21
40
|
overflow: visible;
|
22
41
|
}
|
23
42
|
.timesheet_item_label {
|
24
|
-
top: -6px; height: 12px;
|
25
|
-
font-size: 12px;
|
26
43
|
text-align: center;
|
27
|
-
color: #333;
|
28
44
|
opacity: 1;
|
29
|
-
|
45
|
+
top: -6px; height: 12px;
|
30
46
|
}
|
31
47
|
.timesheet_item_resize_top {
|
32
|
-
top: 0px; height:
|
48
|
+
top: 0px; height: 6px;
|
33
49
|
cursor: n-resize;
|
34
50
|
}
|
35
51
|
.timesheet_item_move {
|
36
|
-
top:
|
52
|
+
top: 6px; bottom: 6px;
|
37
53
|
cursor: move;
|
38
54
|
}
|
39
55
|
.timesheet_item_resize_bottom {
|
40
|
-
bottom: 0px; height:
|
56
|
+
bottom: 0px; height: 6px;
|
41
57
|
cursor: s-resize;
|
42
58
|
}
|
59
|
+
.timesheet_item_icons {
|
60
|
+
top: 0px; height: 16px;
|
61
|
+
}
|
62
|
+
.timesheet_item_icon {
|
63
|
+
position: absolute;
|
64
|
+
top: 0px; width: 16px; height: 16px;
|
65
|
+
background-position: 0px 0px;
|
66
|
+
background-image: url(#{this.getThemeGfxFile('/timesheet_item_icons.png')});
|
67
|
+
}
|
68
|
+
|
69
|
+
.locked .timesheet_item_move,
|
70
|
+
.locked .timesheet_item_resize_bottom,
|
71
|
+
.locked .timesheet_item_resize_top {
|
72
|
+
cursor: pointer;
|
73
|
+
}
|
@@ -1,8 +1,10 @@
|
|
1
|
-
<div class="timesheet_item">
|
1
|
+
<div class="timesheet_item" id="bg#{_ID}">
|
2
|
+
<div class="timesheet_item_time" id="state#{_ID}"></div>
|
2
3
|
<div class="timesheet_item_middle">
|
3
4
|
<div class="timesheet_item_label" id="label#{_ID}">#{this.label}</div>
|
4
5
|
</div>
|
6
|
+
<div class="timesheet_item_icons" id="icons#{_ID}"></div>
|
5
7
|
<div class="timesheet_item_resize_top"></div>
|
6
8
|
<div class="timesheet_item_resize_bottom"></div>
|
7
9
|
<div class="timesheet_item_move" id="subview#{_ID}"></div>
|
8
|
-
</div>
|
10
|
+
</div>
|
Binary file
|