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
@@ -0,0 +1,103 @@
1
+ UtilMethods = HClass.extend
2
+
3
+ arrIncludes: (_arr,_what)->
4
+ _arr.indexOf(_what) != -1
5
+
6
+ # List of primitive object type's chars
7
+ _builtinTypeChr: [
8
+ 'b' # boolean
9
+ 'n' # number
10
+ 's' # string
11
+ ]
12
+
13
+ getValueById: (_id)->
14
+ COMM.Values.values[_id]
15
+
16
+ ###
17
+ # Returns object type as a single-char string.
18
+ # Use this method to detect the type of the object given.
19
+ #
20
+ # Returns the type of the object given as a character code. Returns false,
21
+ # if unknown or unsupported objcet type.
22
+ #
23
+ # Returns:
24
+ # _One of the following:_
25
+ # - 'a': Array
26
+ # - 'h': Hash (Generic Object)
27
+ # - 'd': Date
28
+ # - 'b': Boolean (true/false)
29
+ # - 'n': Number (integers and floats)
30
+ # - 's': String
31
+ # - '~': Null
32
+ # - '-': Undefined
33
+ # - false: unknown
34
+ ###
35
+ typeChr: (_obj)->
36
+ return '-' unless _obj?
37
+ return '~' if _obj == null
38
+ _typeChr = (typeof _obj).slice(0,1)
39
+ return _typeChr if @arrIncludes(@_builtinTypeChr,_typeChr)
40
+ if _typeChr == 'o'
41
+ return 'a' if _obj.constructor == Array
42
+ return 'h' if _obj.constructor == Object
43
+ return 'd' if _obj.constructor == Date
44
+ return false
45
+
46
+ baseStrToNum: (_str, _base)->
47
+ return null if 's' != @typeChr(_str)
48
+ _base = 10 unless _base?
49
+ parseInt(_str, _base)
50
+
51
+ baseNumToStr: (_num, _base)->
52
+ return null if 'n' != @typeChr(_num)
53
+ _base = 10 unless _base?
54
+ _num.toString(_base)
55
+
56
+ hexToNum: (_hex)->
57
+ @baseStrToNum(_hex,16)
58
+
59
+ numToHex: (_int)->
60
+ @baseNumToStr(_int,16)
61
+
62
+ base36ToNum: (_base36)->
63
+ @baseStrToNum(_base36,36)
64
+
65
+ numToBase36: (_num)->
66
+ @baseIntToStr(_num,36)
67
+
68
+ _hexColorLengths: [3,4,6,7]
69
+ _hexCharacters: ['0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f']
70
+ _hex3To6Ratio: 4097 # parseInt('1001',16)
71
+ _normalizeHexColorToNum: (_color)->
72
+ return null if @typeChr(_color) != 's'
73
+ _hexLen = _color.length
74
+ return null unless @arrIncludes(@_hexColorLengths,_hexLen)
75
+ _color = _color.toLowerCase()
76
+ _str = ''
77
+ for _chr, i in _color.split('')
78
+ continue if i == 0 and _chr == '#' and ( _hexLen == 4 or _hexLen == 7 )
79
+ return null unless @arrIncludes( @_hexCharacters, _chr )
80
+ _str += _chr
81
+ _num = @hexToNum( _str )
82
+ _num = 0 if _num < 0
83
+ _num = 16777215 if _num > 16777215
84
+ _num = _num*@_hex3To6Ratio if _hexLen < 6
85
+ return _num
86
+ _normalizeNumToHexColor: (_num)->
87
+ _num = 0 if _num < 0
88
+ _num = 16777215 if _num > 16777215
89
+ _str = @numToHex(_num)
90
+ _str = '0'+_str until _str.length == 6
91
+ return '#'+_str
92
+
93
+ hexColorAdd: (_hex1,_hex2)->
94
+ @_normalizeNumToHexColor(
95
+ @_normalizeHexColorToNum(_hex1) +
96
+ @_normalizeHexColorToNum(_hex2)
97
+ )
98
+
99
+ hexColorSubtract: (_hex1,_hex2)->
100
+ @_normalizeNumToHexColor(
101
+ @_normalizeHexColorToNum(_hex1) -
102
+ @_normalizeHexColorToNum(_hex2)
103
+ )
@@ -14,6 +14,9 @@ HCalendar = HControl.extend
14
14
  defaultEvents:
15
15
  mouseWheel: true
16
16
  keyDown: true
17
+
18
+ controlDefaults: HControlDefaults.extend
19
+ preserveTime: true
17
20
 
18
21
  ## Calls HCalendar#nextMonth or HCalendar#prevMonth based on delta change
19
22
  ## of the mouseWheel event
@@ -0,0 +1,62 @@
1
+ HCalendarPulldown = HMiniMenu.extend
2
+ componentName: 'calendar_pulldown'
3
+ defaultEvents:
4
+ click: true
5
+ resize: true
6
+ preserveTime: true
7
+ controlDefaults: HMiniMenu.prototype.controlDefaults.extend
8
+ calendarAlign: 'right'
9
+ label: ''
10
+ calendarRect: ->
11
+ [ x, y ] = [ @pageX(), @pageY() ]
12
+ if @options.calendarAlign == 'right'
13
+ return [ x-200+@rect.width, y, 200, 200 ]
14
+ else
15
+ return [ x, y, 200, 200 ]
16
+ repositionMenuItems: ->
17
+ @menuItemView.setRect( @calendarRect() )
18
+ @menuItemView.drawRect()
19
+ menuShow: ->
20
+ @base()
21
+ @setLabel( @options.labelHide )
22
+ menuHide: ->
23
+ @base()
24
+ @setLabel( @options.labelShow )
25
+ setValueObj: (_valueObj)->
26
+ @base(_valueObj)
27
+ if @calendar?
28
+ @calendar.valueObj.release( @calendar )
29
+ @valueObj.bind(@calendar)
30
+ refreshValue: ->
31
+ _date = moment(@value).utc()
32
+ @_timePreserve = [ _date.hours(), _date.minutes(), _date.seconds() ] if @options.preserveTime
33
+ @calendar.setValue(@value)
34
+ drawSubviews: ->
35
+ @menuItemView = HView.new( @calendarRect(), @app,
36
+ visible: false
37
+ logicParent: @
38
+ style:
39
+ overflow: 'visible'
40
+ )
41
+ HControl.extend(
42
+ defaultEvents:
43
+ click: true
44
+ click: ->
45
+ @parent.options.logicParent.menuHide()
46
+ true
47
+ ).new( [ 0, 0, 200, 20 ], @menuItemView )
48
+ @calendar = HCalendar.extend(
49
+ refreshValue: ->
50
+ @base()
51
+ @parent.options.logicParent.setValue(@value)
52
+ ).new( [ 0, 20, 200, 180 ], @menuItemView,
53
+ value: @value
54
+ valueObj: @valueObj
55
+ preserveTime: @options.preserveTime
56
+ style:
57
+ boxShadow: '0 0 5px #333'
58
+ borderRadius: '5px'
59
+ )
60
+ HCalendarPullDown = HCalendarPulldown
61
+ HCalendarMenu = HCalendarPulldown
62
+ HCalenderButton = HCalendarPulldown
@@ -0,0 +1,16 @@
1
+ .default > .calendar_pulldown {
2
+ position: absolute; left: 0; top: 0; width: 24px; height: 24px;
3
+ background-position: 0px 0px;
4
+ cursor: pointer;
5
+ font-size: 0;
6
+ background-image: url(#{this.getThemeGfxFile('/calendar_pulldown.png')});
7
+ }
8
+ .default.disabled > .calendar_pulldown {
9
+ opacity: 0.7;
10
+ }
11
+ .default.disabled:hover > .calendar_pulldown {
12
+ background-position: 0px 0px;
13
+ }
14
+ .default.enabled:hover > .calendar_pulldown {
15
+ background-position: 0px -24px;
16
+ }
@@ -0,0 +1 @@
1
+ <div class="calendar_pulldown" id="control#{_ID}"><span id="label#{_ID}"></span></div>
@@ -0,0 +1,59 @@
1
+ HDatePicker = HTextControl.extend
2
+ controlDefaults: HTextControl.prototype.controlDefaults.extend
3
+ fieldFormat: 'YYYY-MM-DD'
4
+ refreshAfter: 3
5
+ preserveTime: true
6
+ preserveDate: false
7
+ calendarPicker: false
8
+ valueToField: (_value)->
9
+ _date = moment.unix(_value).utc()
10
+ @_datePreserve = [ _date.year(), _date.month(), _date.date() ] if @options.preserveDate
11
+ if @options.preserveTime and @_timePreserve? and @calendar? and not @calendar.menuItemView.isHidden
12
+ @_dateRestore(_date)
13
+ @setValue(_date.unix())
14
+ else if @options.preserveTime
15
+ @_timePreserve = [ _date.hours(), _date.minutes(), _date.seconds() ] if @options.preserveTime
16
+ _date.format(@options.fieldFormat)
17
+ _dateRestore: (_date)->
18
+ if @_datePreserve? and @options.preserveDate
19
+ [ _year, _month, _mday ] = @_datePreserve
20
+ _date.year( _year )
21
+ _date.month( _month )
22
+ _date.date( _mday )
23
+ until _date.isValid()
24
+ _mday = _mday - 1
25
+ _date.date( _mday )
26
+ else if _date.year() == 0 and _date.month() == 0 and _date.date() == 1
27
+ _date.year(1970)
28
+ _date.month(0)
29
+ _date.date(1)
30
+ if @_timePreserve? and @options.preserveTime
31
+ [ _hours, _minutes, _seconds ] = @_timePreserve
32
+ _date.hours( _hours )
33
+ _date.minutes( _minutes )
34
+ _date.seconds( _seconds )
35
+ fieldToValue: (_value)->
36
+ _date = moment.utc(_value,@options.fieldFormat)
37
+ return @value unless _date.isValid()
38
+ @_dateRestore(_date)
39
+ _date.unix()
40
+ refreshValue: ->
41
+ @base()
42
+ @calendar.setValue(@value) if @calendar?
43
+ @setStyleOfPart('value','textAlign','right')
44
+ drawSubviews: ->
45
+ @base()
46
+ if @options.calendarPicker
47
+ @setStyleOfPart('label','right','26px')
48
+ @calendar = HCalendarPulldown.extend(
49
+ refreshValue: ->
50
+ @base()
51
+ @parent.setValue(@value)
52
+ ).new( [null,0,24,24,1,null], @,
53
+ value: @value
54
+ valueObj: @valueObj
55
+ preserveTime: @options.preserveTime
56
+ style:
57
+ borderLeft: '1px dotted #666'
58
+ )
59
+ @calendar.bringToFront()
@@ -0,0 +1,7 @@
1
+ HDateTimePicker = HDatePicker.extend
2
+ controlDefaults: HDatePicker.prototype.controlDefaults.extend
3
+ fieldFormat: 'YYYY-MM-DD HH:mm:ss'
4
+ refreshAfter: 3
5
+ preserveTime: false
6
+ preserveDate: false
7
+ calendarPicker: false
@@ -17,7 +17,7 @@ HDateTimePicker = HControl.extend({
17
17
  if(!this.m){
18
18
  return;
19
19
  }
20
- this.setLocked( HVM.values[ this.options.lockedId ].value );
20
+ // this.setLocked( HVM.values[ this.options.lockedId ].value );
21
21
  var
22
22
  date = new Date( this.value*1000 ),
23
23
  yyyy = date.getUTCFullYear(),
@@ -202,7 +202,7 @@ HDateTimePicker = HControl.extend({
202
202
  HStringView.nu(
203
203
  HRect.nu( _numStepperRect ),
204
204
  this, {
205
- valueObj: HVM.values[this.options.tzValueId]
205
+ // valueObj: HVM.values[this.options.tzValueId]
206
206
  }
207
207
  );
208
208
  this.refreshValue();