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
@@ -92,7 +92,7 @@ Event = {
92
92
  Event.observers = false;
93
93
  },
94
94
 
95
- /** Starts observing the named event of the element and
95
+ /** Starts observing the named event of the element and
96
96
  * specifies a callback function.
97
97
  **/
98
98
  observe: function(_elem, _name, _function, _useCapture) {
@@ -145,7 +145,7 @@ Event = {
145
145
 
146
146
  };
147
147
 
148
- // Activates the garbage collector of Internet Explorer
148
+ // Activates the garbage collector of Internet Explorer
149
149
  // when the document is unloaded:
150
150
  if (BROWSER_TYPE.ie && !BROWSER_TYPE.ie9) {
151
151
  Event.observe(window, "unload", Event.unloadCache, false);
@@ -0,0 +1,31 @@
1
+
2
+ # The RSence namespace
3
+ RSence =
4
+
5
+ # Call this method from the index page for
6
+ # client-only features
7
+ clientConf: (_clientPrefix)->
8
+ HThemeManager.themePath = _clientPrefix+'/themes'
9
+ HThemeManager._start()
10
+
11
+ # Call this method from the index page to
12
+ # setup the environment variables and to
13
+ # start synchronizing immediately afterwards.
14
+ serverConf: (_clientPrefix, _helloUrl) ->
15
+ COMM.ClientPrefix = _clientPrefix
16
+ COMM.Transporter.HelloUrl = _helloUrl
17
+ RSence.clientConf( _clientPrefix )
18
+ COMM.AutoSyncStarter.start()
19
+ null
20
+
21
+ # Storage for guiTrees, cantains
22
+ # JSONRenderer instances by plugin name.
23
+ guiTrees: {}
24
+
25
+ killGuiTree: (_guiName)->
26
+ _guiTrees = RSence.guiTrees
27
+ _guiTree = _guiTrees[_guiName]
28
+ if _guiTree?
29
+ _guiTree.die()
30
+ _guiTrees[_guiName] = null
31
+ delete _guiTrees[_guiName]
@@ -6,18 +6,18 @@
6
6
  * with this software package. If not, contact licensing@riassence.com
7
7
  */
8
8
 
9
- // RSence namespace, nothing here yet.
10
- // However, a future version of client_pkg will pack var's assigned like..
11
- // var//RSence
12
- // ..into this namespace.
13
- // Additional logic for handling the namespaces will however be required.
14
- var RSence = {
9
+ // RSence client-side namespace initialization.
10
+ // Current contents are a store for guiTrees and the serverConf method for setting up variables before starting.
11
+ var
12
+ RSence = {
15
13
 
16
14
  // Configuration method for the html document of the server
17
15
  serverConf: function(_clientPrefix,_helloUrl){
18
16
  COMM.ClientPrefix=_clientPrefix;
19
17
  COMM.Transporter.HelloUrl=_helloUrl;
20
18
  HThemeManager.themePath=_clientPrefix+'/themes';
19
+ HThemeManager._start();
20
+ COMM.AutoSyncStarter.start();
21
21
  },
22
22
 
23
23
  // Structure reserved for JSONRenderer instances remotely populated by the server
@@ -0,0 +1,307 @@
1
+ ## RSence
2
+ # Copyright 2009-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
+ #### = Description
10
+ ## Use HCalendar to display a month calendar that displays days as columns
11
+ ## and weeks as rows. Its value is a date/time number specified in seconds
12
+ ## since or before epoch (1970-01-01 00:00:00 UTC).
13
+ ####
14
+ HCalendar = HControl.extend(
15
+
16
+ componentName: 'calendar'
17
+
18
+ ## Disable the mouseWheel event to prevent prev/next -month switching with
19
+ ## the mouse wheel or equivalent content-scrolling user interface gesture
20
+ defaultEvents:
21
+ mouseWheel: true
22
+ click: true
23
+
24
+ ## Calls HCalendar#nextMonth or HCalendar#prevMonth based on delta change
25
+ ## of the mouseWheel event
26
+ mouseWheel: (_delta)->
27
+ if _delta < 0
28
+ @nextMonth()
29
+ else
30
+ @prevMonth()
31
+
32
+ ## Simple click-through for the themed hyperlinks
33
+ click: ->
34
+ false
35
+
36
+ ## Returns an array of week day names starting with the short name of the word "week".
37
+ ## The default locale returns: ['Wk','Mon','Tue','Wed','Thu','Fri','Sat','Sun']
38
+ ## See HLocale for more details
39
+ localizedDays: ->
40
+ _str = HLocale.dateTime.strings
41
+ _arr = HVM.clone( _str.weekDaysShort )
42
+ _arr.push( _arr.shift() )
43
+ _arr.unshift( _str.weekShort )
44
+ _arr
45
+
46
+ _destroyWeekDayElems: ->
47
+ if @_weekDayElems?
48
+ for _elemId in @_weekDayElems
49
+ ELEM.del( _elemId )
50
+ @_weekDayElems = null
51
+
52
+ ## Refreshes the week days header
53
+ refreshWeekDays: ->
54
+ @_destroyWeekDayElems()
55
+ _dayNames = @localizedDays()
56
+ _availWidth = @rect.width-2
57
+ _dayWidth = Math.floor( _availWidth/8 )
58
+ _leftOffset = ( _availWidth % 8 ) - 1
59
+ _parentElem = @markupElemIds.label
60
+ _dayElems = []
61
+ for _dayName, i in _dayNames
62
+ _dayElem = ELEM.make( _parentElem )
63
+ ELEM.setHTML( _dayElem, _dayName )
64
+ ELEM.setStyle( _dayElem, 'width', _dayWidth+'px' )
65
+ _left = i * _dayWidth + _leftOffset
66
+ ELEM.setStyle( _dayElem, 'left', _left+'px' )
67
+ @_weekDayElems = _dayElems
68
+
69
+ ## Calls #refreshWeekDays when theme is applied
70
+ refreshLabel: ->
71
+ @refreshWeekDays() if @markupElemIds? and not @_weekDayElems?
72
+
73
+ ## Calculates the first and last week of the month of the _date
74
+ ##
75
+ ## Params:
76
+ ## - _date: A Date instance to check date range from
77
+ ##
78
+ ## Returns:
79
+ ## [Object]: {
80
+ ## week: {
81
+ ## firstDate: [Date]
82
+ ## lastDate: [Date]
83
+ ## firstNum: [Number]
84
+ ## lastNum: [Number]
85
+ ## count: [Number]
86
+ ## }
87
+ ## month: {
88
+ ## firstDate: [Date]
89
+ ## lastDate: [Date]
90
+ ## }
91
+ ## }
92
+ calendarDateRange: (_date)->
93
+ _monthFirst = @firstDateOfMonth( _date )
94
+ _monthLast = @lastDateOfMonth( _date )
95
+ _weekFirst = @firstDateOfWeek( _monthFirst )
96
+ _weekLast = @lastDateOfWeek( _monthLast )
97
+ _firstWeekNum = @week( _weekFirst )
98
+ _lastWeekNum = @week( _weekLast )
99
+ _weeks = _firstWeekNum - _lastWeekNum
100
+ if _weeks == 5
101
+ if _weekFirst.getDate() == 1
102
+ _weekFirst = new Date( _weekFirst.getTime() - @msWeek )
103
+ else
104
+ _weekLast = new Date( _weekLast.getTime() + @msWeek )
105
+ else if _weeks == 4
106
+ _weekFirst = new Date( _weekFirst.getTime() - @msWeek )
107
+ return {
108
+ week: {
109
+ firstDate: _weekFirst
110
+ lastDate: _weekLast
111
+ firstNum: _firstWeekNum
112
+ lastNum: _lastWeekNum
113
+ count: _weeks
114
+ }
115
+ month: {
116
+ firstDate: _monthFirst
117
+ lastDate: _monthLast
118
+ }
119
+ }
120
+
121
+ ## Calls #drawCalendar when the value is changed
122
+ refreshValue: ->
123
+ @drawCalendar( @date() )
124
+
125
+ ## Draws the next month
126
+ nextMonth: ->
127
+ _dateNext = new Date( @viewMonth[0], @viewMonth[1]+1, 1 )
128
+ _dateMs = _dateNext.getTime() - @tzMs(_dateNext)
129
+ @drawCalendar( new Date(_dateMs) )
130
+
131
+ ## Drows the prev month
132
+ prevMonth: ->
133
+ _datePrev = new Date( @viewMonth[0], @viewMonth[1]-1, 1 )
134
+ _dateMs = _datePrev.getTime() - @tzMs(_datePrev)
135
+ @drawCalendar( new Date(_dateMs) )
136
+
137
+ ## Stores the currently viewed year and month
138
+ viewMonth: [ 1970, 0 ]
139
+
140
+ ## Shows a pulldown menu for month selection
141
+ monthMenu: ->
142
+ return unless HMiniMenu?
143
+ _calendar = this
144
+ _monthValues = []
145
+ for _monthName, i in HLocale.dateTime.strings.monthsLong
146
+ _monthValues.push( [ i, _monthName ] )
147
+ _rect = ELEM.getBoxCoords( @_monthMenu )
148
+ _rect[0] += 20
149
+ _rect[2] = 80 if _rect[2] < 80
150
+ HMiniMenu.extend(
151
+ _killAfterRefresh: false
152
+ menuHide: ->
153
+ @base()
154
+ _menu = @
155
+ _menu._killAfterRefresh = true
156
+ COMM.Queue.push( ->
157
+ if _menu._killAfterRefresh
158
+ _menu.refreshValue()
159
+ )
160
+ return true;
161
+ refreshValue: ->
162
+ @base()
163
+ if @_killAfterRefresh
164
+ @_killAfterRefresh = false
165
+ _calendar.setValue( _calendar.setMonth( @value ) )
166
+ if _calendar.month() != @value
167
+ _calendar.setValue( _calendar.setMday( 30 ) )
168
+ _calendar.setValue( _calendar.setMonth( this.value ) )
169
+ if _calendar.month() != @value
170
+ _calendar.setValue( _calendar.setMday( 29 ) )
171
+ _calendar.setValue( _calendar.setMonth( @value ) )
172
+ if _calendar.month() != this.value
173
+ _calendar.setValue( _calendar.setMday( 28 ) )
174
+ _calendar.setValue( _calendar.setMonth( @value ) )
175
+ _menu = this
176
+ COMM.Queue.push( ->
177
+ _menu.die()
178
+ )
179
+ ).new( _rect, @,
180
+ value: @month()
181
+ initialVisibility: true
182
+ ).setListItems( _monthValues )
183
+
184
+ ## Shows a text field for year selection
185
+ yearMenu: ->
186
+ _calendar = @
187
+ _rect = ELEM.getBoxCoords( @_yearMenu )
188
+ _rect[0] += 20
189
+ _rect[2] = 40 if _rect[2] < 40
190
+ _rect[3] = 20
191
+ HNumericTextControl.extend(
192
+ refreshValue: ->
193
+ @base()
194
+ _calendar.setValue( _calendar.setYear( @value ) )
195
+ textBlur: ->
196
+ @base()
197
+ _year = this
198
+ COMM.Queue.push( ->
199
+ _year.die() if _year.markupElemIds?
200
+ )
201
+ textEnter: ->
202
+ @base()
203
+ _returnKeyPressed = EVENT.status[ EVENT.keysDown ].indexOf( 13 ) != -1
204
+ _noKeysPressed = EVENT.status[ EVENT.keysDown ].length == 0
205
+ if _returnKeyPressed or _noKeysPressed
206
+ ELEM.get( @markupElemIds.value ).blur()
207
+ ).new( _rect, @,
208
+ value: @year()
209
+ minValue: -38399
210
+ maxValue: 38400
211
+ focusOnCreate: true
212
+ refreshOnInput: false
213
+ )
214
+
215
+ _destroyCalendarElems: ->
216
+ if @_drawCalendarElems?
217
+ for _elemId in @_drawCalendarElems
218
+ ELEM.del( _elemId )
219
+ @_drawCalendarElems = null
220
+
221
+ die: ->
222
+ @_destroyWeekDayElems()
223
+ @_destroyCalendarElems()
224
+ @base()
225
+
226
+ ## Draws the calendar with the date open given as input.
227
+ ##
228
+ ## Params:
229
+ ## - _date: The date on which calendar UI is opened at.
230
+ drawCalendar: (_date)->
231
+ @_destroyCalendarElems()
232
+ _date = @date() unless ( _date instanceof Date )
233
+ _calendarDateRange = @calendarDateRange( _date )
234
+ _monthFirst = _calendarDateRange.month.firstDate
235
+ _monthLast = _calendarDateRange.month.lastDate
236
+ _firstDate = _calendarDateRange.week.firstDate
237
+ _lastDate = _calendarDateRange.week.lastDate
238
+ _availWidth = @rect.width - 2
239
+ _availHeight = @rect.height - 36
240
+ _leftPlus = ( _availWidth % 8 ) - 2
241
+ _topPlus = ( _availHeight % 6 )
242
+ _colWidth = Math.floor( _availWidth / 8 )
243
+ _rowHeight = Math.floor( _availHeight / 6 )
244
+ _parentElem = @markupElemIds.value
245
+ ELEM.setStyle( _parentElem, 'visibility', 'hidden', true )
246
+ _elems = []
247
+ for _row in [0..5]
248
+ _weekElem = ELEM.make( _parentElem )
249
+ _elems.push( _weekElem )
250
+ ELEM.addClassName( _weekElem, 'calendar_weeks_week_row' )
251
+ ELEM.setStyle( _weekElem, 'width', _availWidth+'px' )
252
+ ELEM.setStyle( _weekElem, 'height', _availHeight+'px' )
253
+ _top = (_row*_rowHeight)+_topPlus
254
+ ELEM.setStyle( _weekElem, 'top', _top+'px' )
255
+ for _col in [0..7]
256
+ if _col == 0
257
+ _colDate = new Date( _firstDate.getTime() + (_row*@msWeek) + (_col*@msDay) )
258
+ _colMs = _colDate.getTime()
259
+ _colElem = ELEM.make( _weekElem )
260
+ _elems.push( _colElem )
261
+ ELEM.addClassName( _colElem, 'calendar_weeks_week_col_wk' )
262
+ ELEM.setStyle( _colElem, 'left', '0px' )
263
+ ELEM.setStyle( _colElem, 'width', _colWidth+'px' )
264
+ ELEM.setStyle( _colElem, 'height', _rowHeight+'px' )
265
+ ELEM.setStyle( _colElem, 'line-height', _rowHeight+'px' )
266
+ ELEM.setHTML( _colElem, @week( _colDate ) )
267
+ else
268
+ _colDate = new Date( _firstDate.getTime() + (_row*@msWeek) + ((_col-1)*@msDay) )
269
+ _colMs = _colDate.getTime()
270
+ _colSecs = Math.round( _colMs/1000 )
271
+ _colElem = ELEM.make( _weekElem, 'a' )
272
+ _elems.push( _colElem )
273
+ if @value >= _colSecs and @value < _colSecs+86400
274
+ ELEM.addClassName( _colElem, 'calendar_weeks_week_col_sel' )
275
+ else if _colDate < _monthFirst or _colDate > _monthLast
276
+ ELEM.addClassName( _colElem, 'calendar_weeks_week_col_no' )
277
+ else
278
+ ELEM.addClassName( _colElem, 'calendar_weeks_week_col_yes' )
279
+ ELEM.setAttr( _colElem, 'href', "javascript:HSystem.views[#{@viewId}].setValue(#{_colSecs})" )
280
+ _left = (_col*_colWidth+_leftPlus)
281
+ ELEM.setStyle( _colElem, 'left', _left+'px' )
282
+ ELEM.setStyle( _colElem, 'width', (_colWidth-1)+'px' )
283
+ ELEM.setStyle( _colElem, 'height', (_rowHeight-1)+'px' )
284
+ ELEM.setStyle( _colElem, 'line-height', _rowHeight+'px' )
285
+ ELEM.setHTML( _colElem, @mday( _colDate ) )
286
+ ELEM.setStyle( _parentElem, 'visibility', 'inherit' )
287
+ _stateElem = @markupElemIds.state
288
+
289
+ @_monthMenu = ELEM.make( _stateElem, 'a' )
290
+ _elems.push( @_monthMenu )
291
+ ELEM.setAttr( @_monthMenu, 'href', "javascript:HSystem.views[#{@viewId}].monthMenu()" )
292
+ ELEM.setHTML( @_monthMenu, @monthName( _date ) )
293
+
294
+ _spacer = ELEM.make( _stateElem, 'span' )
295
+ _elems.push( _spacer )
296
+ ELEM.setHTML( _spacer, '&nbsp;' )
297
+
298
+ @_yearMenu = ELEM.make( _stateElem, 'a' )
299
+ _elems.push( @_yearMenu )
300
+ ELEM.setAttr( @_yearMenu, 'href', "javascript:HSystem.views[#{@viewId}].yearMenu()" )
301
+ ELEM.setHTML( @_yearMenu, @year( _date ) )
302
+
303
+ @viewMonth = [ _monthFirst.getUTCFullYear(), _monthFirst.getUTCMonth() ]
304
+ @_drawCalendarElems = _elems
305
+ )
306
+
307
+ HCalendar.implement( HDateTime )
@@ -1,7 +1,6 @@
1
1
  .calendar_control {
2
2
  position: absolute;
3
- left: 0px; top: 0px; right: 1px; bottom: 1px;
4
- border: 1px solid #999;
3
+ left: 0px; top: 0px; right: 0px; bottom: 0px;
5
4
  }
6
5
  .calendar_head {
7
6
  position: absolute;
@@ -12,7 +11,6 @@
12
11
  position: absolute;
13
12
  top: 2px; width: 16px; height: 16px;
14
13
  font-size: 0; line-height: 0;
15
- line-height: 20px;
16
14
  cursor: pointer;
17
15
  background-image: #{this.getCssFilePath('calendar_arrows.png')};
18
16
  }
@@ -55,7 +53,7 @@
55
53
  color: #000;
56
54
  font-family: Arial, sans-serif;
57
55
  font-size: 11px;
58
- line-height: 15px;
56
+ line-height: 16px;
59
57
  vertical-align: middle;
60
58
  text-align: center;
61
59
  }
@@ -86,11 +84,8 @@
86
84
  }
87
85
  .calendar_weeks_week_col_no {
88
86
  color: #666;
89
- border-left: 1px solid #999;
90
- border-top: 1px solid #999;
91
87
  }
92
88
  .calendar_weeks_week_col_no:hover {
93
- background-color: #fff;
94
89
  color: #000;
95
90
  }
96
91
  .calendar_weeks_week_col_yes,
@@ -98,11 +93,97 @@
98
93
  color: #000;
99
94
  background-color: #ddd;
100
95
  font-weight: bold;
101
- border-left: 1px solid #666;
102
- border-top: 1px solid #666;
96
+ border: 1px solid #666;
103
97
  }
104
98
  .calendar_weeks_week_col_sel,
105
99
  .calendar_weeks_week_col_yes:hover {
106
100
  background-color: #fff;
107
101
  }
102
+ .calendar_bg {
103
+ position: absolute;
104
+ left: -1px; right: -1px;
105
+ top: -1px; bottom: -2px;
106
+ }
107
+ .calendar_bg * {
108
+ position: absolute;
109
+ font-size: 0; line-height: 0; /* ie bug work-arounds */
110
+ }
111
+ .disabled > .calendar_bg {
112
+ opacity: 0.9;
113
+ }
114
+ .calendar_bg .calendar_nw,
115
+ .calendar_bg .calendar_n,
116
+ .calendar_bg .calendar_ne,
117
+ .calendar_bg .calendar_sw,
118
+ .calendar_bg .calendar_s,
119
+ .calendar_bg .calendar_se {
120
+ height: 12px;
121
+ background-image: #{this.getCssFilePath('calendar_parts1.png')};
122
+ }
123
+ .calendar_bg .calendar_c {
124
+ left: 12px; right: 12px; top: 12px; bottom: 12px;
125
+ background-color: #fbfafb;
126
+ /* background-image: #{this.getCssFilePath('calendar_bg.png')};*/
127
+ }
128
+ .calendar_bg .calendar_w,
129
+ .calendar_bg .calendar_e {
130
+ top: 12px; bottom: 12px;
131
+ width: 12px;
132
+ background-image: #{this.getCssFilePath('calendar_parts2.png')};
133
+ }
134
+ .calendar_bg .calendar_n,
135
+ .calendar_bg .calendar_s {
136
+ left: 12px; right: 12px;
137
+ }
138
+ .calendar_bg .calendar_nw,
139
+ .calendar_bg .calendar_ne,
140
+ .calendar_bg .calendar_sw,
141
+ .calendar_bg .calendar_se {
142
+ width: 12px;
143
+ }
144
+ .calendar_bg .calendar_nw,
145
+ .calendar_bg .calendar_n,
146
+ .calendar_bg .calendar_ne {
147
+ top: 0px;
148
+ }
149
+ .calendar_bg .calendar_sw,
150
+ .calendar_bg .calendar_s,
151
+ .calendar_bg .calendar_se {
152
+ bottom: 0px;
153
+ }
154
+ .calendar_bg .calendar_nw,
155
+ .calendar_bg .calendar_w,
156
+ .calendar_bg .calendar_sw {
157
+ left: 0px;
158
+ }
159
+ .calendar_bg .calendar_ne,
160
+ .calendar_bg .calendar_e,
161
+ .calendar_bg .calendar_se {
162
+ right: 0px;
163
+ }
164
+ .calendar_bg .calendar_nw {
165
+ background-position: 0px 0px;
166
+ }
167
+ .calendar_bg .calendar_n {
168
+ background-position: 0px -24px;
169
+ }
170
+ .calendar_bg .calendar_ne {
171
+ background-position: -12px 0px;
172
+ }
173
+ .calendar_bg .calendar_sw {
174
+ background-position: 0px -12px;
175
+ }
176
+ .calendar_bg .calendar_s {
177
+ background-position: 0px -36px;
178
+ }
179
+ .calendar_bg .calendar_se {
180
+ background-position: -12px -12px;
181
+ }
182
+ .calendar_bg .calendar_w {
183
+ background-position: 0px 0px;
184
+ }
185
+ .calendar_bg .calendar_e {
186
+ background-position: -12px 0px;
187
+ }
188
+
108
189