@@ -180,7 +180,7 @@ function Calendar( element, options )
180180 t . resources [ resource_id ] ,
181181 {
182182 start : start_time ,
183- date : date ,
183+ date : date . valueOf ( ) ,
184184 }
185185 ) ) {
186186 // was able to render in the new position, delete the original
@@ -234,29 +234,36 @@ function Calendar( element, options )
234234 t . eventmanager . deleteEvent , evt . attr . id ) ;
235235 } ) ;
236236
237- newev . draggable ( {
238- appendTo : 'body' ,
239- helper : 'clone' ,
240- zIndex : 9999 ,
241- /* drag : function( event, ui ){
242- var time_offset = t.options.get_time_offset( event, ui );
243- var start_time = nearest_time( time_offset );
244- ui.helper.find(".rc_event_head").text(start_time);
245- }
246- */
247- } ) . resizable ( {
248- handles : 's' ,
249-
250- stop : function ( event , ui ) {
251- var snapheight = ~ ~ ( ui . size . height / t . options . intervalpixels ) ;
252- var total_mins = snapheight * t . options . interval ;
253-
254- evt . attr . duration = total_mins - ( evt . attr . prep_time + evt . attr . cleanup_time ) ;
255- ui . helper . css ( 'height' , snapheight * t . options . intervalpixels - 2 + 'px' ) ;
256- }
237+ if ( ! evt . attr . locked ) {
238+ newev . draggable ( {
239+ appendTo : 'body' ,
240+ helper : 'clone' ,
241+ zIndex : 9999 ,
242+ /* drag : function( event, ui ){
243+ var time_offset = t.options.get_time_offset( event, ui );
244+ var start_time = nearest_time( time_offset );
245+ ui.helper.find(".rc_event_head").text(start_time);
246+ }
247+ */
248+ } ) . resizable ( {
249+ handles : 's' ,
250+
251+ stop : function ( event , ui ) {
252+ var snapheight = ~ ~ ( ui . size . height / t . options . intervalpixels ) ;
253+ var total_mins = snapheight * t . options . interval ;
254+
255+ evt . attr . duration = total_mins - ( evt . attr . prep_time + evt . attr . cleanup_time ) ;
256+ ui . helper . css ( 'height' , snapheight * t . options . intervalpixels - 2 + 'px' ) ;
257+ }
258+ } )
259+ }
257260
258- } ) . click ( function ( ) {
259- rc_event_edit ( evt , t . view_week_render_event ) ;
261+ newev . click ( function ( ) {
262+ rc_event_edit ( evt , function ( evt ) {
263+ t . view_week_render_event ( evt ) ;
264+ t . options . persist ( evt ) ;
265+ return false ;
266+ } ) ;
260267 } ) ;
261268
262269 return false ; // this is a fix for form submit callback
@@ -281,7 +288,7 @@ function Calendar( element, options )
281288 {
282289 return addMinutes_timeOfDay (
283290 t . options . min_time ,
284- ~ ~ ( offset / t . options . intervalpixels ) * t . options . interval ,
291+ ~ ~ ( ( offset + t . options . intervalpixels / 2 ) / t . options . intervalpixels ) * t . options . interval ,
285292 t . options . max_time
286293 ) . newtime ;
287294 }
@@ -378,7 +385,8 @@ function rc_Event( options )
378385 prep_time : 0 , // pre-event room preparation time
379386 cleanup_time : 0 , // post-event room
380387 resource : 'none' , // remove from this resource when added to another
381- written_to_server : false
388+ locked : false , // when locked, can not be dragged, resized, or bumped
389+ written_to_server : false
382390 } ;
383391
384392 t . attr = $ . extend ( true , { } , defaults , options ) ;
@@ -440,7 +448,7 @@ function rc_EventManager( retrieve_events, save_event, delete_event, resources,
440448 var stash = evt . attr ;
441449
442450 evt . attr . start = options . start ;
443- evt . attr . date = options . date . valueOf ;
451+ evt . attr . date = options . date ;
444452 evt . attr . t_offset = options . t_offset ;
445453
446454
@@ -490,15 +498,6 @@ function rc_EventManager( retrieve_events, save_event, delete_event, resources,
490498// 3: live Ajax + localStorage for offline working
491499
492500
493- //--- TEST DATA -------------------------------------------------------
494- var init_resource = {
495- Room1 :{ title :"Orca" , capacity :250 , location :"Rochester North" } ,
496- Room2 :{ title :"Narwhal" , capacity :50 , location :"Rochester North" } ,
497- Room3 :{ title :"Walrus" , capacity :500 , location :"Rochester East" } ,
498- } ;
499-
500- //--- END TEST DATA ---------------------------------------------------
501-
502501
503502function Resource ( resource_element , init_mode ) {
504503 var t = this ;
@@ -509,18 +508,8 @@ function Resource( resource_element, init_mode ) {
509508 //
510509 t . eventpool = { } ;
511510
512- t . id = resource_element . attr ( 'id' ) ;
513-
514- // initialization
515- switch ( init_mode )
516- {
517- case 'localtest' : {
518- t . attr = init_resource [ t . id ] ;
519- break ;
520- }
521-
522- default : alert ( "unrecognized Resource initialization mode" ) ;
523- }
511+ t . id = resource_element . attr ( 'id' ) ;
512+ t . attr = $ . parseJSON ( resource_element . attr ( 'data-attr' ) ) ;
524513
525514 //
526515 // Set up automated event acceptance test (application-level function)
0 commit comments