Patch: default event duration

Currently when adding a new event in the scheduler the length of the event will be scheduler.config.time_step where time_step is the default time scale resolution of the scheduler.

So if we configure a time scale resolution of 5 minutes. A newly created event will have a default duration of 5 minutes, which is not terribly useful as a duration.

I’d like to propose to add a configurable setting for default event duration:

$ diff -u scheduler.js.orig scheduler.js
--- scheduler.js.orig   2010-08-06 14:05:07.000000000 +0200
+++ scheduler.js        2010-08-06 14:05:35.000000000 +0200
@@ -152,7 +152,7 @@
 }
 
 scheduler.addEventNow=function(start,end,e){
-       var d = this.config.time_step*60000;
+       var d = this.config.event_duration*60000;
        if (!start) start = Math.round((new Date()).valueOf()/d)*d;
        var start_date = new Date(start);
        if (!end){
$ diff -u lightbox.js.orig lightbox.js
--- lightbox.js.orig    2010-08-06 14:48:52.000000000 +0200
+++ lightbox.js 2010-08-06 14:48:54.000000000 +0200
@@ -89,7 +89,7 @@
                        ev.start_date=new Date(s[3].value,s[2].value,s[1].value,0,s[0].value);
                        ev.end_date=new Date(s[7].value,s[6].value,s[5].value,0,s[4].value);
                        if (ev.end_date<=ev.start_date) 
-                               ev.end_date=scheduler.date.add(ev.start_date,scheduler.config.time_step,"minute");
+                               ev.end_date=scheduler.date.add(ev.start_date,scheduler.config.event_duration,"minute");
                },
                focus:function(node){
                        node.getElementsByTagName("select")[0].focus();
$ diff -u config.js.orig config.js
--- config.js.orig      2010-08-06 16:45:54.000000000 +0200
+++ config.js   2010-08-06 16:45:31.000000000 +0200
@@ -27,6 +27,7 @@
 
        hour_size_px:42,
        time_step:5,
+       envent_duration:60,
 
        start_on_monday:1,
        first_hour:0,

Thanks,
*t

It sounds useful, we will add the similar functionality in oncoming scheduler 2.3
Thanks for the idea.

I forgot to add a default configured value for the new setting. I’ve rectified that now.

Thanks,
*t