rsence-pre 2.3.0.16 → 2.3.0.17

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.
Files changed (37) hide show
  1. data/VERSION +1 -1
  2. data/conf/default_conf.yaml +53 -200
  3. data/js/chat/chat_panel/chat_panel.coffee +120 -0
  4. data/js/chat/speech_bubble/speech_bubble.coffee +56 -0
  5. data/js/chat/speech_bubble/themes/default/speech_bubble.css +84 -0
  6. data/js/chat/speech_bubble/themes/default/speech_bubble.html +7 -0
  7. data/js/chat/speech_bubble/themes/default/user_anon.png +0 -0
  8. data/js/comm/sessionwatcher/sessionwatcher.js +1 -1
  9. data/js/comm/values/values.js +2 -34
  10. data/js/controls/numerictextcontrol/numerictextcontrol.coffee +109 -0
  11. data/js/controls/onoffbutton/onoffbutton.coffee +44 -0
  12. data/js/controls/onoffbutton/themes/default/onoffbutton.css +50 -0
  13. data/js/controls/onoffbutton/themes/default/onoffbutton.html +10 -0
  14. data/js/controls/textcontrol/textcontrol.coffee +291 -0
  15. data/js/core/class/class.js +1 -1
  16. data/js/core/elem/elem.coffee +83 -1
  17. data/js/core/util/util_methods/util_methods.coffee +103 -0
  18. data/js/datetime/calendar/calendar.coffee +3 -0
  19. data/js/datetime/calendar_pulldown/calendar_pulldown.coffee +62 -0
  20. data/js/datetime/calendar_pulldown/themes/default/calendar_pulldown.css +16 -0
  21. data/js/datetime/calendar_pulldown/themes/default/calendar_pulldown.html +1 -0
  22. data/js/datetime/calendar_pulldown/themes/default/calendar_pulldown.png +0 -0
  23. data/js/datetime/datepicker/datepicker.coffee +59 -0
  24. data/js/datetime/datetimepicker/datetimepicker.coffee +7 -0
  25. data/js/datetime/datetimepicker/datetimepicker.js +2 -2
  26. data/js/datetime/momentjs/momentjs.js +1400 -0
  27. data/js/datetime/timepicker/timepicker.coffee +7 -0
  28. data/js/foundation/application/application.js +1 -1
  29. data/js/foundation/control/valueaction/valueaction.js +8 -1
  30. data/js/foundation/control/valueresponder/valueresponder.js +1 -1
  31. data/js/foundation/view/morphanimation/morphanimation.js +9 -3
  32. data/js/foundation/view/view.js +43 -33
  33. data/js/views/scrollview/scrollview.js +10 -0
  34. data/lib/rsence/default_config.rb +10 -6
  35. data/plugins/client_pkg/lib/client_pkg_build.rb +2 -2
  36. metadata +22 -4
  37. data/js/controls/textcontrol/textcontrol.js +0 -420
@@ -1,420 +0,0 @@
1
-
2
- /*** = Description
3
- ** HTextControl is a control unit that represents an editable input
4
- ** line of text. Commonly, textcontrol is used as a single text field in
5
- ** the request forms. HTextControl view or theme can be changed; the
6
- ** default_theme is used by default.
7
- **
8
- ** = Instance variables
9
- ** +type+:: '[HTextControl]'
10
- ** +value+:: The string that is currently held by this object.
11
- ***/
12
- var//RSence.Controls
13
- HTextControl = HControl.extend({
14
-
15
- componentName: "textcontrol",
16
-
17
- // allows text selection
18
- textSelectable: true,
19
-
20
- defaultEvents: {
21
- textEnter: true,
22
- contextMenu: true
23
- },
24
-
25
- controlDefaults: (HControlDefaults.extend({
26
- refreshOnBlur: true,
27
- refreshOnInput: true,
28
- refreshOnIdle: true,
29
- focusOnCreate: false
30
- })),
31
-
32
- drawSubviews: function(){
33
- ELEM.setStyle(this.elemId,'overflow','visible');
34
- this.base();
35
- if(this.options.focusOnCreate){
36
- this.getInputElement().focus();
37
- if( typeof this.value === 'string' ){
38
- this.setSelectionRange( this.value.length, this.value.length );
39
- }
40
- }
41
- },
42
-
43
- /** = Description
44
- * The contextMenu event for text input components is not prevented by default.
45
- **/
46
- contextMenu: function(){
47
- return true;
48
- },
49
-
50
- /** = Description
51
- * The refreshLabel method sets the title property of the text
52
- * field, essentially creating a tooltip using the label.
53
- *
54
- **/
55
- refreshLabel: function(){
56
- if(this['markupElemIds']!==undefined){
57
- if(this.markupElemIds['label']!==undefined){
58
- ELEM.setAttr(this.markupElemIds.label,'title',this.label);
59
- }
60
- }
61
- },
62
-
63
- lostActiveStatus: function(){
64
- if(this['markupElemIds']!==undefined){
65
- ELEM.get( this.markupElemIds.value ).blur();
66
- this.textBlur();
67
- }
68
- },
69
-
70
- setStyle: function(_name, _value, _cacheOverride) {
71
- if (!this['markupElemIds']||!this.markupElemIds['value']) {
72
- return;
73
- }
74
- this.setStyleOfPart('value', _name, _value, _cacheOverride);
75
- },
76
-
77
- setEnabled: function(_flag) {
78
- this.base(_flag);
79
- if(this['markupElemIds'] && this.markupElemIds.value) {
80
- ELEM.get(this.markupElemIds.value).disabled = !this.enabled;
81
- }
82
- },
83
-
84
- /** This flag is true, when the text input field has focus.
85
- **/
86
- hasTextFocus: false,
87
-
88
- _getChangeEventFn: function(){
89
- var _this = this;
90
- return function(e){
91
- if(_this._clipboardEventTimer){
92
- clearTimeout( this._clipboardEventTimer );
93
- }
94
- _this._clipboardEventTimer = setTimeout( function(){_this.clipboardEvent();}, 200 );
95
- return true;
96
- };
97
- },
98
-
99
- _updateValueFromField: function(){
100
- this.setValue(
101
- this.validateText(
102
- this.getTextFieldValue()
103
- )
104
- );
105
- },
106
-
107
- _clipboardEventTimer: null,
108
- clipboardEvent: function(){
109
- this._updateValueFromField();
110
- clearTimeout( this._clipboardEventTimer );
111
- this._clipboardEventTimer = null;
112
- },
113
-
114
- _changeEventFn: null,
115
- _clearChangeEventFn: function(){
116
- if( this._changeEventFn ){
117
- Event.stopObserving( ELEM.get(this.markupElemIds.value), 'paste', this._changeEventFn );
118
- Event.stopObserving( ELEM.get(this.markupElemIds.value), 'cut', this._changeEventFn );
119
- this._changeEventFn = null;
120
- }
121
- },
122
- _setChangeEventFn: function(){
123
- if( this._changeEventFn ){
124
- this._clearChangeEventFn();
125
- }
126
- this._changeEventFn = this._getChangeEventFn();
127
- Event.observe( ELEM.get(this.markupElemIds.value), 'paste', this._changeEventFn );
128
- Event.observe( ELEM.get(this.markupElemIds.value), 'cut', this._changeEventFn );
129
- },
130
-
131
- /** = Description
132
- * Special event for text entry components.
133
- * Called when the input field gains focus.
134
- *
135
- **/
136
- textFocus: function(){
137
- EVENT.changeActiveControl( this );
138
- this.hasTextFocus = true;
139
- this._setChangeEventFn();
140
- return true;
141
- },
142
-
143
- /** = Description
144
- * Special event for text entry components.
145
- * Called when the input field loses focus.
146
- *
147
- **/
148
- textBlur: function(){
149
- this.hasTextFocus = false;
150
- this._clearChangeEventFn();
151
- if(this.options.refreshOnBlur){
152
- this._updateValueFromField();
153
- this.refreshValue();
154
- }
155
- return true;
156
- },
157
-
158
- idle: function(){
159
- if( this.hasTextFocus && this.options.refreshOnIdle && this.options.refreshOnInput ){
160
- this._updateValueFromField();
161
- }
162
- },
163
-
164
- /** = Description
165
- * refreshValue function
166
- *
167
- *
168
- **/
169
- refreshValue: function(){
170
- this.setTextFieldValue( this.value );
171
- },
172
-
173
- /** = Description
174
- * Placeholder method for validation of the value.
175
- *
176
- **/
177
- validateText: function(_value){
178
- return _value;
179
- },
180
-
181
- /** = Description
182
- * Returns the input element or null, if no input element created (yet).
183
- *
184
- **/
185
- getInputElement: function(){
186
- if( this.markupElemIds && this.markupElemIds.value ){
187
- return ELEM.get(this.markupElemIds.value);
188
- }
189
- return null;
190
- },
191
-
192
- /** = Description
193
- * Returns the value of the input element.
194
- *
195
- **/
196
- getTextFieldValue: function(){
197
- var _inputElement = this.getInputElement();
198
- if( _inputElement === null ){
199
- return '';
200
- }
201
- return _inputElement.value;
202
- },
203
-
204
- /** = Description
205
- * Sets the value of the input element.
206
- *
207
- * = Parameters
208
- * +_value+:: The value to set.
209
- *
210
- **/
211
- setTextFieldValue: function(_value){
212
- var _inputElement = this.getInputElement(),
213
- _selectionRange = this.getSelectionRange();
214
- if( _inputElement === null ){
215
- return;
216
- }
217
- if( _inputElement.value !== String(_value) ){
218
- _inputElement.value = _value;
219
- }
220
- this.setSelectionRange( _selectionRange[0], _selectionRange[1] );
221
- },
222
-
223
- // returns a random number prefixed and suffixed with '---'
224
- _randomMarker: function(){
225
- return '---'+Math.round((1+Math.random())*10000)+'---';
226
- },
227
-
228
- die: function(){
229
- if( this.hasTextFocus ){
230
- this.getInputElement().blur();
231
- }
232
- this._clearChangeEventFn();
233
- this.base();
234
- },
235
-
236
- /** = Description
237
- * Returns the selection (or text cursor position) of the input element
238
- * as an +Array+ like +[ startOffset, endOffset ]+.
239
- *
240
- **/
241
- getSelectionRange: function(){
242
- var _inputElement = this.getInputElement();
243
- if( _inputElement === null || this.hasTextFocus === false ){
244
- return [ 0, 0 ];
245
- }
246
- if(document.selection){
247
- // Internet Explorer
248
-
249
- var
250
-
251
- // create a range object
252
- _range = document.selection.createRange(),
253
-
254
- // original range text
255
- _rangeText = _range.text,
256
- _rangeLength = _rangeText.length,
257
-
258
- // make a copy of the text and replace \r\n with \n
259
- _origValue = _inputElement.value.replace(/\r\n/g, "\n"),
260
-
261
- _markerValue,
262
- _markerLength,
263
- _markerIndex,
264
-
265
- // create random marker to replace the text with
266
- _marker = this._randomMarker();
267
-
268
- // re-generate marker if it's found in the text.
269
- while( ~_origValue.indexOf( _marker ) ){
270
- _marker = this._randomMarker();
271
- }
272
-
273
- _markerLength = _marker.length;
274
-
275
- // temporarily set the text of the selection to the unique marker
276
- _range.text = _marker;
277
-
278
- _markerValue = _inputElement.value.replace(/\r\n/g, "\n");
279
-
280
- _range.text = _rangeText;
281
-
282
- _markerIndex = _markerValue.indexOf( _marker );
283
-
284
- return [
285
- _markerIndex,
286
- _markerIndex + _rangeLength
287
- ];
288
- }
289
- else if (_inputElement.selectionStart){
290
- // Mozilla - Gecko
291
- return [
292
- _inputElement.selectionStart,
293
- _inputElement.selectionEnd
294
- ];
295
- }
296
- else {
297
- // no support
298
- return [ 0, 0 ];
299
- }
300
- },
301
-
302
- /** = Description
303
- * Sets the selection (or text cursor position) of the input element.
304
- *
305
- * = Parameters
306
- * +_selectionStart+:: The start of the selection (or an Array containing
307
- * both start and end offset, see below).
308
- * +_selectionEnd+:: The end offset of the selection.
309
- *
310
- * = Note
311
- * - +_selectionStart+ can also be given as an +Array+
312
- * like +[ startOffset, endOffset ]+.
313
- * - If the +_selectionEnd+ is omitted, no selection is made; the text
314
- * cursor is positioned at the startOffset instead.
315
- **/
316
- setSelectionRange: function( _selectionStart, _selectionEnd ){
317
- if( _selectionStart instanceof Array ){
318
- _selectionEnd = _selectionStart[1];
319
- _selectionStart = _selectionStart[0];
320
- }
321
- if( _selectionEnd === undefined ){
322
- _selectionEnd = _selectionStart;
323
- }
324
- var _inputElement = this.getInputElement();
325
- if( _inputElement === null || this.hasTextFocus === false ){
326
- return;
327
- }
328
- if(_inputElement.createTextRange){
329
- // Internet Explorer
330
- var _range = _inputElement.createTextRange();
331
- _range.move( 'character', _selectionStart, _selectionEnd );
332
- _range.select();
333
- }
334
- else if (_inputElement.selectionStart){
335
- // Mozilla - Gecko
336
- _inputElement.setSelectionRange( _selectionStart, _selectionEnd );
337
- }
338
- },
339
-
340
- /** = Description
341
- * Receives the +textEnter+ event to update the value
342
- * based on what's (potentially) entered in the text input field.
343
- *
344
- **/
345
- textEnter: function(){
346
- if(this.options.refreshOnInput){
347
- this.setValue(
348
- this.validateText(
349
- this.getTextFieldValue()
350
- )
351
- );
352
- this.refreshValue();
353
- }
354
- return false;
355
- }
356
-
357
- });
358
-
359
- /** = Description
360
- * HNumericTextControl is an extension of HTextControl that
361
- * validates the input as a number. It supports value ranges.
362
- *
363
- * If you need decimal numbers (floating-point), pass the
364
- * decimalNumber: true option to the constructor.
365
- **/
366
- var//RSence.Controls
367
- HNumericTextControl = HTextControl.extend({
368
-
369
- defaultEvents: {
370
- mouseWheel: true,
371
- textEnter: true,
372
- contextMenu: true,
373
- keyDown: true
374
- },
375
-
376
- /** Uses the mouseWheel event to step up/down the value.
377
- **/
378
- mouseWheel: function(_delta){
379
- var _value = this.value;
380
- _value = _value-((_delta<0)?1:-1);
381
- this.setValue(Math.round(this.validateText(_value)));
382
- },
383
-
384
- keyDown: function(_key){
385
- if(_key===Event.KEY_UP){
386
- this.mouseWheel(1);
387
- return true;
388
- }
389
- else if(_key===Event.KEY_DOWN){
390
- this.mouseWheel(-1);
391
- return true;
392
- }
393
- return false;
394
- },
395
-
396
- /** = Description
397
- * Extends the validateText method to ensure the
398
- * input is a number.
399
- *
400
- **/
401
- validateText: function(_value){
402
- if(this.options.decimalNumber){
403
- _value = parseFloat(_value);
404
- }
405
- else{
406
- _value = parseInt(_value,10);
407
- }
408
- if(isNaN(_value)){
409
- _value = this.value;
410
- }
411
- if(_value>this.options.maxValue){
412
- _value = this.options.maxValue;
413
- }
414
- else if(_value<this.options.minValue){
415
- _value = this.options.minValue;
416
- }
417
- return _value;
418
- }
419
-
420
- });