rsence-pre 2.2.0.11 → 2.2.0.12
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 +1 -1
- data/js/controls/window/themes/default/window.css +9 -0
- data/js/datetime/calendar/calendar.js +109 -11
- data/js/datetime/calendar/themes/default/calendar.css +89 -7
- data/js/datetime/calendar/themes/default/calendar.html +11 -0
- data/js/datetime/calendar/themes/default/calendar_bg-ie6.gif +0 -0
- data/js/datetime/calendar/themes/default/calendar_bg.png +0 -0
- data/js/datetime/calendar/themes/default/calendar_parts1-ie6.gif +0 -0
- data/js/datetime/calendar/themes/default/calendar_parts1.png +0 -0
- data/js/datetime/calendar/themes/default/calendar_parts2-ie6.gif +0 -0
- data/js/datetime/calendar/themes/default/calendar_parts2.png +0 -0
- data/js/datetime/datetimevalue/datetimevalue.js +22 -5
- data/js/foundation/eventmanager/eventmanager.js +8 -6
- data/js/foundation/locale_settings/locale_settings.js +7 -0
- data/js/lists/radiobuttonlist/radiobuttonlist.js +4 -2
- data/js/menus/minimenu/minimenu.js +7 -2
- data/lib/conf/argv.rb +1 -130
- data/lib/conf/default.rb +5 -5
- data/lib/plugins/gui_plugin.rb +2 -0
- data/lib/plugins/plugin_plugins.rb +1 -1
- data/lib/rsence.rb +134 -3
- data/plugins/client_pkg/client_pkg.rb +7 -3
- data/plugins/client_pkg/lib/client_pkg_build.rb +2 -1
- metadata +11 -12
- data/js/datetime/timesheet/old_timesheet.js +0 -292
- data/js/datetime/timesheet/themes/default/old_timesheet.css +0 -30
- data/js/datetime/timesheet/themes/default/old_timesheet.html +0 -2
- data/js/datetime/timesheet_item/old_timesheet_item.js +0 -308
- data/js/datetime/timesheet_item/themes/default/old_timesheet_item.css +0 -42
- data/js/datetime/timesheet_item/themes/default/old_timesheet_item.html +0 -8
- data/js/datetime/timesheet_item_edit/old_timesheet_item_edit.js +0 -274
| @@ -1,308 +0,0 @@ | |
| 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 | 
            -
             | 
| @@ -1,42 +0,0 @@ | |
| 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 | 
            -
            }
         | 
| @@ -1,8 +0,0 @@ | |
| 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>
         | 
| @@ -1,274 +0,0 @@ | |
| 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 | 
            -
              ** Editor control for HTimeSheet. Editor can access the HTimeSheetItems 
         | 
| 11 | 
            -
              ** on HTimeSheet.
         | 
| 12 | 
            -
              ***/
         | 
| 13 | 
            -
            var//RSence.DateTime
         | 
| 14 | 
            -
            HTimeSheetEditor = HControl.extend({
         | 
| 15 | 
            -
              timeSheetItem: false,
         | 
| 16 | 
            -
              createId: 0,
         | 
| 17 | 
            -
              
         | 
| 18 | 
            -
            /** = Description
         | 
| 19 | 
            -
              * Selects a HTimeSheetItem to edit.
         | 
| 20 | 
            -
              *
         | 
| 21 | 
            -
              * = Parameters
         | 
| 22 | 
            -
              * +_timeSheetItem+:: A HTimeSheetItem to edit.
         | 
| 23 | 
            -
              *
         | 
| 24 | 
            -
              **/
         | 
| 25 | 
            -
              setTimeSheetItem: function(_timeSheetItem){
         | 
| 26 | 
            -
                this.timeSheetItem = _timeSheetItem;
         | 
| 27 | 
            -
                this.textField.setValue( _timeSheetItem.label );
         | 
| 28 | 
            -
              },
         | 
| 29 | 
            -
             | 
| 30 | 
            -
            /** = Description
         | 
| 31 | 
            -
              * Opens HTimeSheetEditor for the selected HTimeSheetItem.
         | 
| 32 | 
            -
              *
         | 
| 33 | 
            -
              **/
         | 
| 34 | 
            -
              show: function(){
         | 
| 35 | 
            -
                if(this.timeSheetItem!==false){
         | 
| 36 | 
            -
                  var _newRect = HRect.nu(this.timeSheetItem.rect);
         | 
| 37 | 
            -
                  if(_newRect.height < 40){
         | 
| 38 | 
            -
                    _newRect.setHeight( 40 );
         | 
| 39 | 
            -
                  }
         | 
| 40 | 
            -
                  if(_newRect.width < 200){
         | 
| 41 | 
            -
                    _newRect.setWidth( 200 );
         | 
| 42 | 
            -
                  }
         | 
| 43 | 
            -
                  var _timeSheetItemParentRect = this.timeSheetItem.parent.rect;
         | 
| 44 | 
            -
                  _newRect.offsetBy( _timeSheetItemParentRect.left, _timeSheetItemParentRect.top );
         | 
| 45 | 
            -
                  this.setRect( _newRect );
         | 
| 46 | 
            -
                  this.drawRect();
         | 
| 47 | 
            -
                }
         | 
| 48 | 
            -
                this.base();
         | 
| 49 | 
            -
              },
         | 
| 50 | 
            -
              
         | 
| 51 | 
            -
            /** = Description
         | 
| 52 | 
            -
              * Hides the HTimeSheetEditor.
         | 
| 53 | 
            -
              *
         | 
| 54 | 
            -
              **/
         | 
| 55 | 
            -
              hide: function(){
         | 
| 56 | 
            -
                this.base();
         | 
| 57 | 
            -
              },
         | 
| 58 | 
            -
              origParent: null,
         | 
| 59 | 
            -
             | 
| 60 | 
            -
            /** = Description
         | 
| 61 | 
            -
              * Creates a new item.
         | 
| 62 | 
            -
              *
         | 
| 63 | 
            -
              * = Parameters
         | 
| 64 | 
            -
              * +_properties+:: Properties for the new item.
         | 
| 65 | 
            -
              *
         | 
| 66 | 
            -
              **/
         | 
| 67 | 
            -
              createItem: function( _properties ){
         | 
| 68 | 
            -
                if(_properties['id'] === undefined){
         | 
| 69 | 
            -
                  this.createId--;
         | 
| 70 | 
            -
                  _properties['id'] = this.createId;
         | 
| 71 | 
            -
                }
         | 
| 72 | 
            -
                var _value = COMM.Values.clone( this.value ),
         | 
| 73 | 
            -
                    _create = _value['create'],
         | 
| 74 | 
            -
                    i = 0,
         | 
| 75 | 
            -
                    _item = false;
         | 
| 76 | 
            -
                for(;i<_create.length;i++){
         | 
| 77 | 
            -
                  if(_create[i]['id'] === _properties['id']){
         | 
| 78 | 
            -
                    _item = _create[i];
         | 
| 79 | 
            -
                    break;
         | 
| 80 | 
            -
                  }
         | 
| 81 | 
            -
                }
         | 
| 82 | 
            -
                if(!_item){
         | 
| 83 | 
            -
                  _create.push( _properties );
         | 
| 84 | 
            -
                }
         | 
| 85 | 
            -
                else {
         | 
| 86 | 
            -
                  for( var _key in _properties ){
         | 
| 87 | 
            -
                    _item[_key] = _properties[_key];
         | 
| 88 | 
            -
                  }
         | 
| 89 | 
            -
                }
         | 
| 90 | 
            -
                this.setValue( _value );
         | 
| 91 | 
            -
              },
         | 
| 92 | 
            -
              
         | 
| 93 | 
            -
            /** = Description
         | 
| 94 | 
            -
              * Modifies an item.
         | 
| 95 | 
            -
              *
         | 
| 96 | 
            -
              * = Parameters
         | 
| 97 | 
            -
              * +_properties+:: Properties to change.
         | 
| 98 | 
            -
              *
         | 
| 99 | 
            -
              **/
         | 
| 100 | 
            -
              modifyItem: function( _properties ){
         | 
| 101 | 
            -
                if(_properties['id'] < 0){
         | 
| 102 | 
            -
                  this.createItem( _properties );
         | 
| 103 | 
            -
                }
         | 
| 104 | 
            -
                else {
         | 
| 105 | 
            -
                  var _value = COMM.Values.clone( this.value ),
         | 
| 106 | 
            -
                      _modify = _value['modify'],
         | 
| 107 | 
            -
                      i = 0,
         | 
| 108 | 
            -
                      _item = false;
         | 
| 109 | 
            -
                  for(;i<_modify.length;i++){
         | 
| 110 | 
            -
                    if(_modify[i]['id'] === _properties['id']){
         | 
| 111 | 
            -
                      _item = _modify[i];
         | 
| 112 | 
            -
                      break;
         | 
| 113 | 
            -
                    }
         | 
| 114 | 
            -
                  }
         | 
| 115 | 
            -
                  if(!_item){
         | 
| 116 | 
            -
                    _modify.push( _properties );
         | 
| 117 | 
            -
                  }
         | 
| 118 | 
            -
                  else {
         | 
| 119 | 
            -
                    for( var _key in _properties ){
         | 
| 120 | 
            -
                      _item[_key] = _properties[_key];
         | 
| 121 | 
            -
                    }
         | 
| 122 | 
            -
                  }
         | 
| 123 | 
            -
                  this.setValue( _value );
         | 
| 124 | 
            -
                }
         | 
| 125 | 
            -
              },
         | 
| 126 | 
            -
             | 
| 127 | 
            -
            /** = Description
         | 
| 128 | 
            -
              * Deletes an item with id given as parameter.
         | 
| 129 | 
            -
              *
         | 
| 130 | 
            -
              * = Parameters
         | 
| 131 | 
            -
              * +_itemId+:: Id of an item to be deleted.
         | 
| 132 | 
            -
              * 
         | 
| 133 | 
            -
              **/
         | 
| 134 | 
            -
              deleteItem: function( _itemId ){
         | 
| 135 | 
            -
                var _value = COMM.Values.clone( this.value );
         | 
| 136 | 
            -
                if(_value['delete'].indexOf( _itemId ) === -1){
         | 
| 137 | 
            -
                  _value['delete'].push( _itemId );
         | 
| 138 | 
            -
                  this.setValue( _value );
         | 
| 139 | 
            -
                }
         | 
| 140 | 
            -
              },
         | 
| 141 | 
            -
             | 
| 142 | 
            -
            /** = Description
         | 
| 143 | 
            -
              * Refreshes the values by iterating through value['response'] and checking
         | 
| 144 | 
            -
              * the new values from the response array. 
         | 
| 145 | 
            -
              *
         | 
| 146 | 
            -
              **/
         | 
| 147 | 
            -
              refreshValue: function(){
         | 
| 148 | 
            -
                var _value = COMM.Values.clone( this.value ),
         | 
| 149 | 
            -
                    i = 0,
         | 
| 150 | 
            -
                    _parent = this.origParent?this.origParent:this.parent,
         | 
| 151 | 
            -
                    _listItemViews = _parent.listItemViews,
         | 
| 152 | 
            -
                    _response = _value['response'],
         | 
| 153 | 
            -
                    _item,
         | 
| 154 | 
            -
                    _itemValue,
         | 
| 155 | 
            -
                    _responseItem,
         | 
| 156 | 
            -
                    j, k;
         | 
| 157 | 
            -
                for( ; i < _response.length; i++ ){
         | 
| 158 | 
            -
                  for( j = 0; j < _listItemViews.length; j++ ){
         | 
| 159 | 
            -
                    _responseItem = _response[i];
         | 
| 160 | 
            -
                    _item = _listItemViews[j];
         | 
| 161 | 
            -
                    if( _item.value['id'] === _responseItem['id'] ){
         | 
| 162 | 
            -
                      _itemValue = COMM.Values.clone( _item.value );
         | 
| 163 | 
            -
                      if(_responseItem['modify'] !== undefined){
         | 
| 164 | 
            -
                        for( k in _responseItem['modify'] ){
         | 
| 165 | 
            -
                          _itemValue[k] = _responseItem['modify'][k];
         | 
| 166 | 
            -
                        }
         | 
| 167 | 
            -
                        _item.setValue( _itemValue );
         | 
| 168 | 
            -
                      }
         | 
| 169 | 
            -
                    }
         | 
| 170 | 
            -
                  }
         | 
| 171 | 
            -
                }
         | 
| 172 | 
            -
                _value['response'] = [];
         | 
| 173 | 
            -
                this.setValue( _value );
         | 
| 174 | 
            -
              },
         | 
| 175 | 
            -
             | 
| 176 | 
            -
            /** = Description
         | 
| 177 | 
            -
              * Draws ok, delete and cancel buttons.
         | 
| 178 | 
            -
              *
         | 
| 179 | 
            -
              **/
         | 
| 180 | 
            -
              drawSubviews: function(){
         | 
| 181 | 
            -
                this.origParent = this.parent;
         | 
| 182 | 
            -
                this.remove();
         | 
| 183 | 
            -
                this.origParent.parent.addView( this );
         | 
| 184 | 
            -
                ELEM.append( this.elemId, this.parent.elemId );
         | 
| 185 | 
            -
                this.textField = HTextArea.nu(
         | 
| 186 | 
            -
                  [0,0,null,20,0,26],
         | 
| 187 | 
            -
                  this, {
         | 
| 188 | 
            -
                    value: ''
         | 
| 189 | 
            -
                  }
         | 
| 190 | 
            -
                );
         | 
| 191 | 
            -
                this.delButton = HButton.extend({
         | 
| 192 | 
            -
                  
         | 
| 193 | 
            -
                /** = Description
         | 
| 194 | 
            -
                  * Click function for delete button. Will call delete function on click
         | 
| 195 | 
            -
                  * for the current item.
         | 
| 196 | 
            -
                  *
         | 
| 197 | 
            -
                  **/
         | 
| 198 | 
            -
                  click: function(){
         | 
| 199 | 
            -
                    this.parent.hide();
         | 
| 200 | 
            -
                    var _sheetItem = this.parent.timeSheetItem;
         | 
| 201 | 
            -
                    if(_sheetItem!==false){
         | 
| 202 | 
            -
                      this.parent.deleteItem( _sheetItem.value['id'] );
         | 
| 203 | 
            -
                      _sheetItem.die();
         | 
| 204 | 
            -
                      var _parent = this.parent.origParent?this.parent.origParent:this.parent.parent;
         | 
| 205 | 
            -
                      var _sheetIdx = _parent.listItemViews.indexOf( _sheetItem );
         | 
| 206 | 
            -
                      _parent.listItemViews.splice( _sheetIdx, 1 );
         | 
| 207 | 
            -
                      this.parent.timeSheetItem = false;
         | 
| 208 | 
            -
                    }
         | 
| 209 | 
            -
                  }
         | 
| 210 | 
            -
                }).nu(
         | 
| 211 | 
            -
                  [2,null,60,24,null,0],
         | 
| 212 | 
            -
                  this, {
         | 
| 213 | 
            -
                    label: 'Delete',
         | 
| 214 | 
            -
                    events: {
         | 
| 215 | 
            -
                      click: true
         | 
| 216 | 
            -
                    }
         | 
| 217 | 
            -
                  }
         | 
| 218 | 
            -
                );
         | 
| 219 | 
            -
                this.okButton = HButton.extend({
         | 
| 220 | 
            -
                  
         | 
| 221 | 
            -
                /** = Description
         | 
| 222 | 
            -
                  * Click function for okButton will ok the modifications for the current item.
         | 
| 223 | 
            -
                  *
         | 
| 224 | 
            -
                  **/
         | 
| 225 | 
            -
                  click: function(){
         | 
| 226 | 
            -
                    this.parent.hide();
         | 
| 227 | 
            -
                    if(this.parent.timeSheetItem!==false){
         | 
| 228 | 
            -
                      var _label = this.parent.textField.getTextFieldValue(),
         | 
| 229 | 
            -
                          _id = this.parent.timeSheetItem.value['id'],
         | 
| 230 | 
            -
                          _data = this.parent.timeSheetItem.value;
         | 
| 231 | 
            -
                      _data['label'] = _label;
         | 
| 232 | 
            -
                      this.parent.modifyItem( _data );
         | 
| 233 | 
            -
                      this.parent.timeSheetItem.setTimeSheetItemLabel( _label );
         | 
| 234 | 
            -
                      this.parent.timeSheetItem = false;
         | 
| 235 | 
            -
                    }
         | 
| 236 | 
            -
                  }
         | 
| 237 | 
            -
                }).nu(
         | 
| 238 | 
            -
                  [null,null,60,24,2,0],
         | 
| 239 | 
            -
                  this, {
         | 
| 240 | 
            -
                    label: 'Save',
         | 
| 241 | 
            -
                    events: {
         | 
| 242 | 
            -
                      click: true
         | 
| 243 | 
            -
                    }
         | 
| 244 | 
            -
                  }
         | 
| 245 | 
            -
                );
         | 
| 246 | 
            -
                this.cancelButton = HButton.extend({
         | 
| 247 | 
            -
                /** = Description
         | 
| 248 | 
            -
                  * Click function for cancel button will cancel 
         | 
| 249 | 
            -
                  * the modifications for the current item.
         | 
| 250 | 
            -
                  *
         | 
| 251 | 
            -
                  **/
         | 
| 252 | 
            -
                  click: function(){
         | 
| 253 | 
            -
                    this.parent.hide();
         | 
| 254 | 
            -
                    if(this.timeSheetItem!==false){
         | 
| 255 | 
            -
                      this.parent.timeSheetItem = false;
         | 
| 256 | 
            -
                    }
         | 
| 257 | 
            -
                  }
         | 
| 258 | 
            -
                }).nu(
         | 
| 259 | 
            -
                  [null,null,60,24,66,0],
         | 
| 260 | 
            -
                  this, {
         | 
| 261 | 
            -
                    label: 'Cancel',
         | 
| 262 | 
            -
                    events: {
         | 
| 263 | 
            -
                      click: true
         | 
| 264 | 
            -
                    }
         | 
| 265 | 
            -
                  }
         | 
| 266 | 
            -
                );
         | 
| 267 | 
            -
                this.textField.setStyle('text-align','center');
         | 
| 268 | 
            -
                this.textField.setStyle('line-height','12px');
         | 
| 269 | 
            -
                this.textField.setStyle('font-size','12px');
         | 
| 270 | 
            -
                this.textField.setStyle('font-family','Arial, sans-serif');
         | 
| 271 | 
            -
                this.origParent.setEditor( this );
         | 
| 272 | 
            -
              }
         | 
| 273 | 
            -
            });
         | 
| 274 | 
            -
             |