3030 render_event : 'view_week_render_event' ,
3131 postcalrender : function ( ) { } ,
3232
33+ // get_time_offset calculates distance in pixels of booking from start-of-day
3334 get_time_offset : function ( draggable , droppable ) {
3435 return draggable . offset . top - droppable . offset ( ) . top ;
3536 } ,
4546
4647 min_time : '07:00' , // 7am
4748 max_time : '20:00' , // 8pm
49+
50+ get_open_time : function ( date_ms , resource ) { return [ '07:00' , '20:00' ] ; } ,
51+
4852 interval : 20 , // minutes
4953 intervalpixels : 24 ,
5054 weekends : false ,
@@ -386,11 +390,14 @@ function Calendar( element, options )
386390 // Called during dragging and on drop, this function returns the id of a div beneath
387391 // the draggable object, if that div is visible and a droppable target.
388392 //
393+ // [TODO - problem dragging new event onto scrolled Narwhal, ends up in Orca]
394+ //
389395 function findDroppable ( ui )
390396 {
391397 retval = false ;
398+ var pos = ui . offset ;
392399
393- // [TODO] should cache this selection...
400+ // [TODO] should probably cache this selection...
394401 $ ( '.ui-droppable' ) . each ( function ( ) {
395402
396403 var parent = $ ( this ) . parent ( ) ;
@@ -399,8 +406,6 @@ function Calendar( element, options )
399406 var viewableTop = parent . position ( ) . top + adjust_scroll ;
400407 var viewableBottom = viewableTop + parent . height ( ) + adjust_scroll ;
401408
402- var pos = ui . position ;
403-
404409 if ( pos . top > viewableTop &&
405410 pos . top < viewableBottom &&
406411 ( pos . left + 20 ) > $ ( this ) . position ( ) . left &&
@@ -421,6 +426,8 @@ function Calendar( element, options )
421426 params . months = [ ] ;
422427 params . dows = [ ] ;
423428 params . dates = [ ] ;
429+ params . opentime = [ ] ;
430+ params . closetime = [ ] ;
424431 params . min_time = t . options . min_time ;
425432 params . max_time = t . options . max_time ;
426433 params . inc_time = t . options . interval ;
@@ -443,6 +450,11 @@ function Calendar( element, options )
443450 //--- header ---
444451 for ( var i = 0 ; i < params . col_count ; i ++ ) {
445452 params . dates [ i ] = dcalc . valueOf ( ) ;
453+
454+ var openclose = t . options . get_open_time ( params . dates [ i ] , resource ) ;
455+ params . opentime [ i ] = ( ( diffMinutes_timeOfDay ( t . options . min_time , openclose [ 0 ] ) / t . options . interval ) * t . options . intervalpixels ) ;
456+ params . closetime [ i ] = ( ( diffMinutes_timeOfDay ( openclose [ 1 ] , params . max_time ) / t . options . interval ) * t . options . intervalpixels ) ;
457+
446458 params . dows [ i ] = t . options . days [ ( i + t . options . startweek ) % 7 ] ;
447459 params . months [ i ] = ( 1 + dcalc . getMonth ( ) ) ;
448460 params . days [ i ] = dcalc . getDate ( ) ;
0 commit comments