search envelope-o feed check
Home Unanswered Active Tags New Question
user comment-o

Passing datetime back to DayPilotScheduler1.TimeRangeSelected

Asked by John
11 years ago.

Trying to pass back a start and end dates from a popup window back to the booking schedule form but I get

!An exception was thrown in the server-side event handler:

...unable to parse datetime: '06/05/2008'...

Seems to be in the prepareCallback function.

At the moment the date valies are taken from text fields.

var data = encodeURIComponent(document.getElementById('textName').value) + '&'
+ encodeURIComponent(document.getElementById('textColumnId').value);
var start = document.getElementById('textStart').value;
var end = document.getElementById('textEnd').value;
window.opener.DayPilotScheduler1.timeRangeSelectedCallBack(start, end, data);
window.close();

Any ideas?

Comment posted by Dan Letecky
11 years ago.
Please check http://forums.daypilot.org/Topic.aspx/460/date_format and let me know if it didn't help.

You could also try to replace the window.open() code with AJAX ModalPopup. You need ASP.NET AJAX Extensions and AJAX Control Toolkit for that solution. The advantages:
  • faster I would say (opening a popup takes a lot of time)
  • no JavaScript needed
  • no parsing needed
A working example can be found in DemoSQL/Default.aspx in the DayPilot package.
Comment posted by Dan Letecky
11 years ago.
Sorry, I see that http://forums.daypilot.org/Topic.aspx/460/date_format is not related to this problem.

If you don't switch to ModalPopup, you could do the following:

1. Put a standard Button into the popup aspx and let the same page handle the PostBack. Do you DB change in the Button.Click handler.
2. Add a script (possibly using RegisterStartupScript) that will call opener.dpc1.refreshCallBack(); and window.close().
Comment posted by John
11 years ago.

If I use a button on the popup windows to handle the database refresh, how do I get the calling Scheduler window to refresh from the Popup window?

Comment posted by John
11 years ago.

336I've tried adding Jscript to a OK button on the popup window.

butAdd.Attributes.Add("onclick", "opener.dpc1.refreshCallBack(); window.close();")

I get

Microsoft JScript runtime error: 'opener.dpc1' is null or not an object

Comment posted by John
11 years ago.

I've amended the code to

butAdd.Attributes.Add("onclick", "opener.DayPilotScheduler1.refreshCallBack(); window.close();")

but now get

Microsoft JScript runtime error: 'getFullYear' is null or not an object

It breaks at

var DayPilotScheduler={};DayPilotScheduler.moving=null;DayPilotScheduler.originalTop=null;DayPilotScheduler.originalMouse=null;DayPilotScheduler.originalWidth=null;DayPilotScheduler.originalLeft=null;DayPilotScheduler.resizing=null;DayPilotScheduler.globalHandlers=false;DayPilotScheduler.startOffset=0;DayPilotScheduler.selectedCells=null;DayPilotScheduler.findCalendar=function(el){var o=el.parentNode;while(o){if(o.calendar)return o.calendar;o=o.parentNode;};return null;};DayPilotScheduler.getRow=function($a){var i=0;var tr=$a.parentNode;while(tr.previousSibling){tr=tr.previousSibling;if(tr.tagName==="TR"){i++;}};return i;};DayPilotScheduler.getCellsLeft=function($a){var $b=[];var $c=$a;while($c&&$c!=DayPilotScheduler.firstSelected){$b.push($c);$c=$c.previousSibling;};$b.push($c);return $b;};DayPilotScheduler.getCellsRight=function($a){var $b=[];var $c=$a;while($c&&$c!=DayPilotScheduler.firstSelected){$b.push($c);$c=$c.nextSibling;};$b.push($c);return $b;};DayPilotScheduler.dragStart=function(element,$d,id,$e){DayPilot.us(element);var $f=DayPilotScheduler.drag={};$f.element=element;$f.duration=$d;$f.text=$e;$f.id=id;return false;};DayPilotScheduler.gMouseMove=function(ev){if(typeof(DayPilotScheduler)==='undefined'){return;};ev=ev||window.event;var $g=DayPilot.mc(ev);if(DayPilotScheduler.drag){document.body.style.cursor='move';if(!DayPilotScheduler.gShadow){DayPilotScheduler.gShadow=DayPilotScheduler.createGShadow();};var $h=DayPilotScheduler.gShadow;$h.style.left=$g.x+'px';$h.style.top=$g.y+'px';DayPilotScheduler.moving=null;DayPilotScheduler.removeShadow(DayPilotScheduler.movingShadow);DayPilotScheduler.movingShadow=null;}};DayPilotScheduler.gMouseUp=function(e){if(DayPilotScheduler.resizing){var $i=DayPilotScheduler.resizing.event;var $j=DayPilotScheduler.resizingShadow.clientWidth+4;var $k=DayPilotScheduler.resizingShadow.offsetLeft;var $l=DayPilotScheduler.resizing.dpBorder;var $m=new Date(DayPilotScheduler.getShadowRow(DayPilotScheduler.resizingShadow).getAttribute("dpRowStart"));DayPilotScheduler.removeShadow(DayPilotScheduler.resizingShadow);DayPilotScheduler.resizing=null;document.body.style.cursor='default';$i.root.eventResize($i,$j,$k,$l,$m);}else if(DayPilotScheduler.moving){var $n=null;if(DayPilotScheduler.moving.getAttribute){$n=DayPilotScheduler.getShadowRow(DayPilotScheduler.moving).getAttribute("dpRow");};var $o=DayPilotScheduler.movingShadow.row.getAttribute("dpRow");var $p=DayPilotScheduler.movingShadow.row.getAttribute("dpRowStart");var $k=DayPilotScheduler.movingShadow.offsetLeft;DayPilotScheduler.removeShadow(DayPilotScheduler.movingShadow);var $i=DayPilotScheduler.moving.event;DayPilotScheduler.moving=null;document.body.style.cursor='default';if(DayPilotScheduler.drag){if(!$i.root.todo){$i.root.todo={};};$i.root.todo.del=DayPilotScheduler.drag.element;};$i.root.eventMove($i,$n,$o,$p,$k);};if(DayPilotScheduler.drag){DayPilotScheduler.drag=null;document.body.style.cursor=null;};if(DayPilotScheduler.gShadow){document.body.removeChild(DayPilotScheduler.gShadow);DayPilotScheduler.gShadow=null;};DayPilotScheduler.moveOffsetX=null;};DayPilotScheduler.getShadowRow=function($q){if(!$q){return null;};var $r=$q.parentNode;while($r&&$r.tagName!="TR"){$r=$r.parentNode;};return $r;};DayPilotScheduler.updateView=function($s,$t){var $s=eval("("+$s+")");var $u=eval($t);var $v=$u.$("main");if($s.Action=="None"){return;};var $w=document.createElement("input");$w.type='hidden';$w.name=$u.id+"_vsupdate";$w.id=$w.name;$w.value=$s.VsUpdate;$u.$("vsph").innerHTML='';$u.$("vsph").appendChild($w);$u.minEnd=$s.MinEnd;$u.maxStart=$s.MaxStart;$u.innerHeight=$s.InnerHeight;if($s.Action=="Refresh"){$u.startDate=new Date($s.StartDate);$u.days=$s.Days;$u.cellDuration=$s.CellDuration;$u.cellGroupBy=$s.CellGroupBy;$u.cellWidth=$s.CellWidth;$u.colors=$s.Colors;$u.row1=$s.Row1;$u.row2=$s.Row2;$u.rows=$s.Rows;$u.updateHeaders();$u.drawTable();$u.$("scroll").scrollLeft=0;$u.$("timescroll").scrollLeft=0;};$u.events=$s.Events;var $x=$u.headerHeight;var scroll=$u.$("scroll");var $y=parseInt(scroll.style.height);var $z=($u.innerHeight+16+2);if($u.heightSpec=='Auto'){scroll.style.height=$z+'px';$u.$('resscroll').style.height=$z+'px';document.getElementById($u.id).style.height=($z+2*$u.headerHeight)+"px";};$u.$("main").style.height=($u.innerHeight-1)+'px';var $k=$u.$("left");if($k){$k.parentNode.style.top=(-($u.innerHeight+$x+16+1+2))+'px';};var $A=$u.$("right");if($A){$A.parentNode.style.top=(-($u.innerHeight+$x+16+1+2))+'px';};var $B=$u.$("header");$u.drawEvents();if($u.timeRangeSelectedHandling!="HoldForever"){$u.cleanSelection();};$u.updateScrollIndicators();if($u.todo){if($u.todo.del){var $C=$u.todo.del;$C.parentNode.removeChild($C);$u.todo.del=null;}};$u.afterRender($s.CallBackData);};DayPilotScheduler.removeShadow=function($h){if(!$h){return;};if(!$h.parentNode){return;};$h.parentNode.removeChild($h);};DayPilotScheduler.hidePreview=function($q){var $D=document.getElementById('dpPreview');if($D){$D.parentNode.removeChild($D);}};DayPilotScheduler.createShadow=function($q){var $r=$q.parentNode;while($r&&$r.tagName!="TD"){$r=$r.parentNode;};var $h=document.createElement('div');$h.setAttribute('unselectable','on');$h.style.position='absolute';$h.style.fontSize='1px';var $j=Math.max($q.offsetWidth-4,0);$h.style.width=$j+'px';var $E=Math.max($q.offsetHeight-4,0);$h.style.height=$E+'px';$h.style.left=$q.offsetLeft+'px';$h.style.top=$q.offsetTop+'px';$h.style.border='2px dotted #666666';$r.firstChild.appendChild($h);return $h;};DayPilotScheduler.createGShadow=function(){var $h=document.createElement('div');$h.setAttribute('unselectable','on');$h.style.position='absolute';$h.style.width='100px';$h.style.height='20px';$h.style.border='2px dotted #666666';$h.style.zIndex=101;document.body.appendChild($h);return $h;};DayPilotScheduler.Scheduler=function(id){var $u=this;this.id=id;this.eventClickPostBack=function(e){this.postBack('CLK:',e.value(),e.tag(),e.start(),e.end(),e.text(),e.row(),false);};this.eventClickCallBack=function(e){this.callBack('CLK:',e.value(),e.tag(),e.start(),e.end(),e.text(),e.row(),false);};this.eventClick=function(){var e=this.event;if(!this.data.ClickEnabled){return;};switch($u.eventClickHandling){case 'PostBack':$u.eventClickPostBack(e);break;case 'CallBack':$u.eventClickCallBack(e);break;case 'JavaScript':$u.eventClickCustom(e);break;case 'Edit':$u.divEdit(this);break;}};this.setHScrollPosition=function($F){this.$("scroll").scrollLeft=$F;};this.getHScrollPosition=function(){return this.$("scroll").scrollLeft;};this.rightClickPostBack=function(e){this.postBack('RCK:',e.value(),e.tag(),e.start(),e.end(),e.text(),e.row(),false);};this.rightClickCallBack=function(e){this.callBack('RCK:',e.value(),e.tag(),e.start(),e.end(),e.text(),e.row(),false);};this.rightClick=function(){var e=this.event;if(!this.data.RightClickEnabled){return false;};switch($u.rightClickHandling){case 'PostBack':$u.rightClickPostBack(e);break;case 'CallBack':$u.rightClickCallBack(e);break;case 'JavaScript':$u.rightClickCustom(e);break;case 'ContextMenu':if(this.data.ContextMenu){eval(this.data.ContextMenu+".show(this.event)");}else{if($u.contextMenu){$u.contextMenu.show(this.event);}};break;};return false;};this.eventResizePostBack=function(e,$G,$H){this.postBack('RES:',e.value(),e.tag(),e.start(),e.end(),e.text(),e.row(),false,$G,$H);};this.eventResizeCallBack=function(e,$G,$H){this.callBack('RES:',e.value(),e.tag(),e.start(),e.end(),e.text(),e.row(),false,$G,$H);};this.eventResize=function(e,$I,$J,$l,$m){var $K=0;var $G=new Date();var $H=new Date();if($l==='left'){var $L=Math.floor(($J-$K)/$u.cellWidth);var $M=$L*$u.cellDuration;var ts=$M*60*1000;var $N=0;$G.setTime($m.getTime()+ts+$N);$H=e.end();}else if($l==='right'){var $L=Math.floor(($J+$I-$K)/$u.cellWidth);var $M=$L*$u.cellDuration;var ts=$M*60*1000;var $N=0;$G=e.start();$H.setTime($m.getTime()+ts+$N);};switch($u.eventResizeHandling){case 'PostBack':$u.eventResizePostBack(e,$G,$H);break;case 'CallBack':$u.eventResizeCallBack(e,$G,$H);break;case 'JavaScript':$u.eventResizeCustom(e,$G,$H);break;}};this.eventMovePostBack=function(e,$G,$H,$O,$P){this.postBack('MOV:',e.value(),e.tag(),e.start(),e.end(),e.text(),$O,false,$G,$H,$P);};this.eventMoveCallBack=function(e,$G,$H,$O,$P){this.callBack('MOV:',e.value(),e.tag(),e.start(),e.end(),e.text(),$O,false,$G,$H,$P);};this.eventMove=function(e,$O,$P,$Q,$J){var $K=0;var $L=Math.floor(($J-$K)/$u.cellWidth);var $R=$L*$u.cellDuration*60*1000;var $S=e.start();var end=e.end();var $T=new Date();$T.setTime(Date.UTC($S.getUTCFullYear(),$S.getUTCMonth(),$S.getUTCDate()));var $U=(e.useBox&&e.useBox())?$S.getTime()-($T.getTime()+Math.floor(($S.getUTCHours()*60+$S.getUTCMinutes())/$u.cellDuration)*$u.cellDuration*60*1000):0;var length=end.getTime()-$S.getTime();var $N=0;var $V=(Date._jsParse)?Date._jsParse($Q):Date.parse($Q);var $G=new Date();$G.setTime($V+$R+$U+$N);var $H=new Date();$H.setTime($G.getTime()+length);switch($u.eventMoveHandling){case 'PostBack':$u.eventMovePostBack(e,$G,$H,$O,$P);break;case 'CallBack':$u.eventMoveCallBack(e,$G,$H,$O,$P);break;case 'JavaScript':$u.eventMoveCustom(e,$G,$H,$O,$P,DayPilotScheduler.drag?true:false);break;}};this.eventMenuClickPostBack=function(e,$W){this.postBack('MNU:',e.value(),e.tag(),e.start(),e.end(),e.text(),e.row(),false,$W);};this.eventMenuClickCallBack=function(e,$W){this.callBack('MNU:',e.value(),e.tag(),e.start(),e.end(),e.text(),e.row(),false,$W);};this.eventMenuClick=function($W,e,$X){switch($X){case 'PostBack':$u.eventMenuClickPostBack(e,$W);break;case 'CallBack':$u.eventMenuClickCallBack(e,$W);break;}};this.timeRangeSelectedPostBack=function($S,end,$Y){this.postBack('FRE:',$S,end,$Y);};this.timeRangeSelectedCallBack=function($S,end,$Y){this.callBack('FRE:',$S,end,$Y);};this.timeRangeSelected=function($S,end,$Y){switch($u.timeRangeSelectedHandling){case 'PostBack':$u.timeRangeSelectedPostBack($S,end,$Y);break;case 'CallBack':$u.timeRangeSelectedCallBack($S,end,$Y);break;case 'JavaScript':$u.timeRangeSelectedCustom($S,end,$Y);break;case 'Hold':break;}};this.timeRangeMenuClickPostBack=function(e,$W){this.postBack('TRM:',e.start,e.end,e.resource,$W);};this.timeRangeMenuClickCallBack=function(e,$W){this.callBack('TRM:',e.start,e.end,e.resource,$W);};this.timeRangeMenuClick=function($W,e,$X){switch($X){case 'PostBack':$u.timeRangeMenuClickPostBack(e,$W);break;case 'CallBack':$u.timeRangeMenuClickCallBack(e,$W);break;}};this.eventEditPostBack=function(e,$Z){this.postBack('EDT:',e.value(),e.tag(),e.start(),e.end(),e.text(),e.row(),false,$Z);};this.eventEditCallBack=function(e,$Z){this.callBack('EDT:',e.value(),e.tag(),e.start(),e.end(),e.text(),e.row(),false,$Z);};this.eventEdit=function(e,$Z){switch($u.eventEditHandling){case 'PostBack':$u.eventEditPostBack(e,$Z);break;case 'CallBack':$u.eventEditCallBack(e,$Z);break;case 'JavaScript':$u.eventEditCustom(e,$Z);break;}};this.refreshCallBack=function($S,$00,$01){var $02;if(!$00){$00=this.days;};if(!$S){$02=this.startDate;};if($S.getFullYear){$02=$S;}else{var $03=parseInt($S);if(isNaN($03)){throw "You must pass null, Date or number as the first parameter to Scheduler.refreshCallBack().";}else{var $02=new Date();$02.setTime(this.startDate.getTime()+$03*24*3600*1000);}};this.callBack('REF:',$02,$00,$01);};this.postBack=function($04){var $05=[];for(var i=1;i<arguments.length;i++){$05.push(arguments[i]);};__doPostBack($u.uniqueID,$04+DayPilot.ea($05));};this.callBack=function($04){var $05=[];for(var i=1;i<arguments.length;i++){$05.push(arguments[i]);};$05.push($u.startDate);$05.push($u.days);$05.push($u.cellDuration);$05.push($u.cellGroupBy);$05.push($u.cellWidth);WebForm_DoCallback(this.uniqueID,$04+DayPilot.ea($05),DayPilotScheduler.updateView,this.clientName,this.callbackError,true);};this.$=function($06){return document.getElementById(id+"_"+$06);};this.createShadow=function($d){var $07=$u.$("main");var $08=$07.rows[$07.rows.length-1];var $09=$u.getShadowCoords();var $j=Math.floor($d*$u.cellWidth/($u.cellDuration*60));if($u.useEventBoxes=='Never'){$j=Math.max($j,4);}else if($u.useEventBoxes=='ShortEventsOnly'){$j=Math.max($j,$u.cellWidth);}else if($u.useEventBoxes=='Always'){var $0a=Math.ceil($j/$u.cellWidth);$j=Math.max($0a*$u.cellWidth,$u.cellWidth);};var $E=$09.row.clientHeight;var $h=document.createElement('div');$h.setAttribute('unselectable','on');$h.style.position='absolute';$h.style.width=($j-4)+'px';$h.style.height=($E-4)+'px';$h.style.left=$09.left+'px';$h.style.top=$09.invertedTop+'px';$h.style.border='2px dotted #666666';$h.style.zIndex=101;$08.cells[0].firstChild.appendChild($h);return $h;};this.getShadowCoords=function(){var $07=this.$("main");var y=$u.coords.y;var $0b=0;var $08=null;var $0c=$07.rows.length;var top=0;for(var i=0;i<$0c;i++){$0b+=$07.rows[i].clientHeight;if(y<$0b){top=$0b-$07.rows[i].clientHeight;$08=$07.rows[i];break;}};var $0d=top+$07.rows[$07.rows.length-1].clientHeight-$07.clientHeight;var $03=DayPilotScheduler.moveOffsetX;if(!$03){$03=$u.cellWidth/2;};var $k=Math.floor((($u.coords.x-$03)+$u.cellWidth/2) / $u.cellWidth)*$u.cellWidth;var $09={};$09.top=top;$09.left=$k;$09.row=$08;$09.rowIndex=i;$09.invertedTop=$0d;return $09;};this.moveShadow=function(){var scroll=this.$("scroll");if(!$u.coords){return;};var $h=DayPilotScheduler.movingShadow;var $09=this.getShadowCoords();if($09.left<scroll.scrollLeft-$u.cellWidth){return;};$h.style.top=$09.invertedTop+'px';$h.style.left=$09.left+'px';$h.style.height=Math.max($09.row.clientHeight-4,0)+'px';$h.row=$09.row;};this.registerResize=function(){if(!this.resizeRegistered){this.resizeRegistered=true;DayPilot.re(window,'resize',this.resize);}};this.resize=function(){$u.$("scroll").style.width=(document.getElementById(id).clientWidth-80)+"px";};this.Init=function(){var $07=this.$('main');this.drawTable();this.enableScrolling();this.drawEvents();this.registerGlobalHandlers();};this.registerGlobalHandlers=function(){if(!DayPilotScheduler.globalHandlers){DayPilotScheduler.globalHandlers=true;DayPilot.re(document,'mousemove',DayPilotScheduler.gMouseMove);DayPilot.re(document,'mouseup',DayPilotScheduler.gMouseUp);}};this.enableScrolling=function(){var $0e=this.$('scroll');if(this.initScrollPos==null){return;};$0e.root=this;$0e.onscroll=this.scroll;if($0e.scrollLeft==0&&this.initScrollPos!=0){$0e.scrollLeft=this.initScrollPos;}else{this.scroll();}};this.ced=function($01){var $0f=document.createElement("div");$0f.data=$01;$0f.style.position='absolute';$0f.style.left=$01.Left+'px';$0f.style.top=$01.Top+'px';$0f.style.width=$01.Width+'px';$0f.style.height=$01.Height+'px';return $0f;};this.drawEvents=function(){var $07=this.$('main');var $0g=$07.rows.length;for(var i=0;i<$0g;i++){$07.rows[i].cells[0].firstChild.innerHTML='';$07.rows[i].cells[0].firstChild.newHeight=$u.eventHeight-1;};for(var i=0;i<this.separators.length;i++){this.drawLine(i);};var $0h=this.events.length;for(var i=0;i<$0h;i++){var $01=this.events[i];var $0f=document.createElement("div");$0f.data=this.events[i];$0f.style.position='absolute';$0f.style.left=$01.Left+'px';$0f.style.top=$01.Top+'px';$0f.style.width=$01.Width+'px';$0f.style.height=$01.Height+'px';$0f.style.border='1px solid '+this.eventBorderColor;$0f.style.backgroundColor=$01.BackgroundColor;$0f.style.whiteSpace='nowrap';$0f.style.fontSize=this.eventFontSize;$0f.style.overflow='hidden';$0f.style.cursor='default';$0f.style.fontFamily=this.eventFontFamily;$0f.className=this.cssClass+" event";if(this.showToolTip){$0f.title=$01.ToolTip;};$0f.unselectable='on';if($01.ClickEnabled){$0f.onclick=this.eventClick;};$0f.oncontextmenu=this.rightClick;if(this.bubble){$0f.onmouseover=function(){$u.bubble.showEvent($u.uniqueID,this.event.value());};$0f.onmouseout=function(){$u.bubble.hideOnMouseOut();};};var $0i=[];if($u.durationBarVisible){$0i.push("<div unselectable='on' style='width:");$0i.push($01.BarWidth);$0i.push("px;margin-left:");$0i.push($01.BarLeft);$0i.push("px;height:2px;background-color:");$0i.push($01.BarColor);$0i.push(";font-size:1px;position:relative'></div>");$0i.push("<div unselectable='on' style='width:");$0i.push($01.Width);$0i.push("px;height:1px;background-color:black;font-size:1px;position:relative'></div>");};$0i.push("<div unselectable='on' style='padding-left:1px;");if($u.rtl){$0i.push("direction:rtl;");};$0i.push("'>");$0i.push($01.InnerHTML);$0i.push("</div>");$0f.innerHTML=$0i.join('');if($01.DayIndex<$0g){var $0j=$07.rows[$01.DayIndex].cells[0].firstChild;var $0k=$01.Top+$01.Height+1;if($0k>$0j.newHeight){$0j.newHeight=$0k;};$0j.appendChild($0f);var e=new DayPilotScheduler.Event($0f,$u);if($u.afterEventRender){$u.afterEventRender(e,$0f);}}};var $B=this.$("header");var $0l=16+1;var $0m=$B.rows.length-1;for(var i=0;i<$0m;i++){var $0n=$B.rows[i].cells[0];var $0o=$07.rows[i];var $0p=$0o.cells[0].firstChild;var $z=$0p.newHeight;if(parseInt($0n.firstChild.style.height)!=$z){$0n.firstChild.style.height=$z+"px";$0n.firstChild.style.lineHeight=$z+"px";var $0q=$0o.cells.length;for(var j=0;j<$0q;j++){$0o.cells[j].firstChild.style.height=$z+'px';}};$0l+=$z+1;};if(this.heightSpec=='Auto'){this.$("scroll").style.height=$0l+"px";}};this.cleanSelection=function(){for(var j=0;j<DayPilotScheduler.selectedCells.length;j++){var $a=DayPilotScheduler.selectedCells[j];if($a){$a.style.backgroundColor=$a.originalColor;$a.selected=false;}}};this.mousedown=function(ev,$a){if(DayPilotScheduler.selecting){return;};if(!$u.AllowSelecting){return;};var $a=ev.srcElement||ev.target;while($a.tagName!="TD"){$a=$a.parentNode;};if($a.parentNode.cells[0]==$a){return;};if(DayPilotScheduler.editing){DayPilotScheduler.editing.blur();return;};var $0r=(window.event)?window.event.button:ev.which;if($0r!==1){return;};DayPilotScheduler.firstMousePos=DayPilot.mc(ev||window.event);DayPilotScheduler.selecting=true;if(DayPilotScheduler.selectedCells){$u.cleanSelection();DayPilotScheduler.selectedCells=[];};DayPilotScheduler.row=DayPilotScheduler.getRow($a);DayPilotScheduler.selectedCells.push($a);DayPilotScheduler.firstSelected=$a;DayPilotScheduler.leftSelectedCell=$a;DayPilotScheduler.rightSelectedCell=$a;$a.originalColor=$a.style.backgroundColor;$a.style.backgroundColor=$u.cellSelectColor;};this.mousemove=function(ev,$a){if(typeof(DayPilotScheduler)==='undefined'){return;};if(!DayPilotScheduler.selecting){return;};var $a=ev.srcElement||ev.target;while($a.tagName!="TD"){$a=$a.parentNode;};if($a.parentNode.cells[0]==$a){return;};var $0r=(window.event)?window.event.button:ev.which;if($0r!==1){return;};var $g=DayPilot.mc(ev||window.event);var $0s=DayPilotScheduler.getRow($a);if($0s!==DayPilotScheduler.row){return;};$u.cleanSelection();if($g.x<DayPilotScheduler.firstMousePos.x){DayPilotScheduler.selectedCells=DayPilotScheduler.getCellsRight($a);DayPilotScheduler.leftSelectedCell=DayPilotScheduler.selectedCells[0];DayPilotScheduler.rightSelectedCell=DayPilotScheduler.firstSelected;}else{DayPilotScheduler.selectedCells=DayPilotScheduler.getCellsLeft($a);DayPilotScheduler.leftSelectedCell=DayPilotScheduler.firstSelected;DayPilotScheduler.rightSelectedCell=DayPilotScheduler.selectedCells[0];};$u.activateSelection();};this.activateSelection=function(){var $0t=$u.getSelection();for(var j=0;j<DayPilotScheduler.selectedCells.length;j++){var c=DayPilotScheduler.selectedCells[j];if(c){c.originalColor=c.style.backgroundColor;c.style.backgroundColor=$u.cellSelectColor;c.selected=true;}}};this.cellCount=function(){if(this.viewType=='Resources'){return this.days*24*60/this.cellDuration;}else{return 24*60/this.cellDuration;}};this.getSelection=function(){var $0u=DayPilotScheduler.getRow(DayPilotScheduler.leftSelectedCell);var $v=this.$('main');var $08=$v.rows[$0u];var $T=new Date($08.getAttribute("dpRowStart")).getTime();var $0v=$08.getAttribute("dpRow");var $S=new Date();var $U=this.cellDuration*(DayPilot.ci(DayPilotScheduler.leftSelectedCell)-1)*60*1000;$S.setTime($T+$U);var end=new Date();var $0w=this.cellDuration*DayPilot.ci(DayPilotScheduler.rightSelectedCell)*60*1000;end.setTime($T+$0w);return new DayPilot.Selection($S,end,$0v,$u);};this.mouseup=function(ev){if(DayPilotScheduler.selecting&&DayPilotScheduler.leftSelectedCell!==null){DayPilotScheduler.selecting=false;var $0x=$u.getSelection();$u.timeRangeSelected($0x.start,$0x.end,$0x.resource);if($u.timeRangeSelectedHandling!="Hold"&&$u.timeRangeSelectedHandling!="HoldForever"){$u.cleanSelection();};return;}else{DayPilotScheduler.selecting=false;}};this.createEdit=function($q){var $r=$q.parentNode;var $0y=document.createElement('textarea');$0y.style.position='absolute';$0y.style.width=(($q.offsetWidth<100)?100:($q.offsetWidth-2))+'px';$0y.style.height=($q.offsetHeight-2)+'px';$0y.style.fontFamily=DayPilot.gs($q,'fontFamily')+DayPilot.gs($q,'font-family');$0y.style.fontSize=DayPilot.gs($q,'fontSize')+DayPilot.gs($q,'font-size');$0y.style.left=$q.offsetLeft+'px';$0y.style.top=$q.offsetTop+'px';$0y.style.border='1px solid black';$0y.style.padding='0px';$0y.style.marginTop='0px';$0y.style.backgroundColor='white';$0y.value=DayPilot.tr($q.event.text());$0y.event=$q.event;$r.appendChild($0y);return $0y;};this.divEdit=function($q){if(DayPilotScheduler.editing){DayPilotScheduler.editing.blur();return;};var $0y=this.createEdit($q);DayPilotScheduler.editing=$0y;$0y.onblur=function(){var id=$q.event.value();var $0z=$q.event.tag();var $0A=$q.event.text();var $Z=$0y.value;DayPilotScheduler.editing=null;$0y.parentNode.removeChild($0y);if($0A===$Z){return;};$q.style.display='none';$u.eventEdit($q.event,$Z);};$0y.onkeypress=function(e){var $0B=(window.event)?event.keyCode:e.keyCode;if($0B===13){this.onblur();return false;}else if($0B===27){$0y.parentNode.removeChild($0y);DayPilotScheduler.editing=false;};return true;};$0y.select();$0y.focus();};this.onCellContext=function($a){if(!$a.selected&&($u.timeRangeSelectedHandling=='Hold'||$u.timeRangeSelectedHandling=='HoldForever')){if(DayPilotScheduler.selectedCells){$u.cleanSelection();DayPilotScheduler.selectedCells=[];};DayPilotScheduler.row=DayPilotScheduler.getRow($a);DayPilotScheduler.selectedCells.push($a);DayPilotScheduler.firstSelected=$a;DayPilotScheduler.leftSelectedCell=$a;DayPilotScheduler.rightSelectedCell=$a;$u.activateSelection();};if($u.contextMenuSelection){$u.contextMenuSelection.show($u.getSelection());};return false;};this.onResMouseMove=function(td){if(typeof(DayPilotBubble)!='undefined'&&$u.resourceBubble){$u.resourceBubble.showResource($u.uniqueID,td.getAttribute("resource"));}};this.onResMouseOut=function(){if(typeof(DayPilotBubble)!='undefined'&&$u.resourceBubble){$u.resourceBubble.hideOnMouseOut();}};this.onCellMouseOut=function(){if(typeof(DayPilotBubble)!='undefined'&&$u.cellBubble){$u.cellBubble.hideOnMouseOut();}};this.onCellMouseMove=function($a){if(typeof(DayPilotBubble)!='undefined'&&$u.cellBubble){var $0u=DayPilotScheduler.getRow($a);var $v=this.$('main');var $08=$v.rows[$0u];var $T=new Date($08.getAttribute("dpRowStart"));var $0v=$08.getAttribute("dpRow");var $0C=DayPilot.ci($a)-1;var $S=DayPilot.Date.addMinutes($T,this.cellDuration*$0C);var end=DayPilot.Date.addMinutes($S,this.cellDuration);$u.cellBubble.showCell($u.uniqueID,$0v,$S,end);}};this.updateHeaders=function(){var $0D=[];$0D.push("<table cellspacing='0' cellpadding='0'><tr>");$0D.push($u.row1);$0D.push("</tr><tr>");$0D.push($u.row2);$0D.push("</tr></table>");$u.$("north").innerHTML=$0D.join('');};this.drawLine=function($0E){var $0F=new Date(this.separators[$0E].Location);var $0G=this.separators[$0E].Color;var $0H=DayPilot.Date.diff($0F,$u.startDate);var $M=Math.floor($0H/(1000*60));var $k=Math.floor($M*$u.cellWidth/$u.cellDuration)-1;$k=Math.max($k,0);var $0I=document.createElement("div");$0I.style.width='1px';$0I.style.height=$u.innerHeight+'px';$0I.style.position='absolute';$0I.style.left=$k+'px';$0I.style.top='0px';$0I.style.backgroundColor=$0G;var $07=$u.$("main");if($07.rows[0].cells[0].firstChild.firstChild){$07.rows[0].cells[0].firstChild.insertBefore($0I,$07.rows[0].cells[0].firstChild.firstChild);}else{$07.rows[0].cells[0].firstChild.appendChild($0I);}};this.drawTable=function(){$0J=$u.$("maind");$0J.calendar=$u;var $0D=[];DayPilotScheduler.selectedCells=[];var $0K=Math.floor($u.cellCount());$0D.push("<table ");$0D.push("cellspacing='0' ");$0D.push("cellpadding='0' ");$0D.push("id='");$0D.push($u.id+"_main");$0D.push("' ");$0D.push("style='position:relative;border-collapse:collapse;");$0D.push("width:"+($0K*$u.cellWidth)+"px;");$0D.push("height:"+$u.innerHeight+"px;");$0D.push("' >");var rl=$u.rows.length;for(var k=0;k<rl;k++){var r=$u.rows[k];$0D.push("<tr ");$0D.push("dpRow='"+r.Value+"' ");$0D.push("dpRowStart='"+r.Start+"' ");$0D.push("style='-khtml-user-select:none;-moz-user-select:none;' ");$0D.push("onmousedown='");$0D.push("DayPilotScheduler.findCalendar(this).mousedown(event,this);");$0D.push("' ");$0D.push("onmousemove='");$0D.push("DayPilotScheduler.findCalendar(this).mousemove(event,this);");$0D.push("' ");$0D.push("onmouseup='");$0D.push("DayPilotScheduler.findCalendar(this).mouseup(event,this);");$0D.push("' ");$0D.push(">");$0D.push("<td style='width:1px;border-bottom:1px solid black;background-color:");$0D.push($u.colors[k][0]);$0D.push("' class='");$0D.push($u.cssClass);$0D.push(" cellbackground' valign='top' unselectable='on'><div style='position:relative;width:1px;height:");$0D.push(r.Height);$0D.push("px;overflow:none;line-height:1.2;' unselectable='on'><!-- -->");$0D.push("</div>");$0D.push("</td>");for(var j=0;j<$0K;j++){$0D.push("<td ");$0D.push("oncontextmenu='");$0D.push("return DayPilotScheduler.findCalendar(this).onCellContext(this);");$0D.push("' ");$0D.push("onmousemove='");$0D.push("return DayPilotScheduler.findCalendar(this).onCellMouseMove(this);");$0D.push("' ");$0D.push("onmouseout='");$0D.push("return DayPilotScheduler.findCalendar(this).onCellMouseOut(this);");$0D.push("' ");$0D.push("style='border-bottom: 1px solid ");$0D.push($u.borderColor);$0D.push(";background-color:"+$u.colors[k][j]+"' ");$0D.push("class='");$0D.push($u.cssClass);$0D.push(" cellbackground' ");$0D.push(">");$0D.push("<div unselectable='on' style='font-size:1px;cursor:default;");if($u.hourBorderColor!=''){$0D.push("border-right:1px solid ");$0D.push($u.hourBorderColor);$0D.push(";");};$0D.push("height:");$0D.push(r.Height);$0D.push("px;width:");var $j=(j==0)?$u.cellWidth-2:$u.cellWidth-1;$0D.push($j);$0D.push("px' class='");$0D.push($u.cssClass);$0D.push(" hourcellborder'></div>");$0D.push("</td>");};$0D.push("</tr>");};$0D.push("</table>");$0J.innerHTML='';$0J.innerHTML=$0D.join('');var $v=$u.$("main");$v.onmousemove=function(ev){var $0L=$u.$("scroll");DayPilotScheduler.activeCalendar=this;$u.coords=DayPilot.mo2($0L,ev);ev=ev||window.event;var $g=DayPilot.mc(ev);if(DayPilotScheduler.resizing){var $0M=DayPilotScheduler.resizing.event.root.cellWidth;var $K=0;var $0N=($g.x-DayPilotScheduler.originalMouse.x);if(DayPilotScheduler.resizing.dpBorder==='right'){var $0O=Math.floor(((DayPilotScheduler.originalWidth+DayPilotScheduler.originalLeft+$0N)+$0M/2) / $0M)*$0M-DayPilotScheduler.originalLeft;if($0O<$0M){$0O=$0M;};var $0P=DayPilotScheduler.resizing.event.root.$("main").clientWidth;if(DayPilotScheduler.originalLeft+$0O>$0P){$0O=$0P-DayPilotScheduler.originalLeft;};DayPilotScheduler.resizingShadow.style.width=($0O-4)+'px';}else if(DayPilotScheduler.resizing.dpBorder==='left'){var $0Q=Math.floor(((DayPilotScheduler.originalLeft+$0N-$K)+$0M/2) / $0M)*$0M+$K;if($0Q<$K){$0Q=$K;};var $0O=DayPilotScheduler.originalWidth-($0Q-DayPilotScheduler.originalLeft);if($0O<$0M){$0O=$0M;}else{DayPilotScheduler.resizingShadow.style.left=$0Q+'px';};DayPilotScheduler.resizingShadow.style.width=($0O-4)+'px';}}else if(DayPilotScheduler.moving){$u.moveShadow();};if(DayPilotScheduler.drag){if(DayPilotScheduler.gShadow){document.body.removeChild(DayPilotScheduler.gShadow);};DayPilotScheduler.gShadow=null;if(!DayPilotScheduler.movingShadow&&$u.coords&&$u.rows.length>0){DayPilotScheduler.movingShadow=$u.createShadow(DayPilotScheduler.drag.duration);if(DayPilotScheduler.movingShadow){DayPilotScheduler.moving={};DayPilotScheduler.moving.event=new DayPilot.Event(DayPilotScheduler.drag.id,DayPilotScheduler.drag.duration,DayPilotScheduler.drag.text);DayPilotScheduler.moving.event.root=$u;}};ev.cancelBubble=true;}};var loading=$0J.previousSibling;while(loading&&loading.tagName!=="DIV")$0f=$0f.previousSibling;if(loading){loading.style.display='none';}};this.cellClick=function(){var o=this.style.backgroundColor;this.style.backgroundColor='#316AC5';$u.timeRangeSelected(this.start,this.end,this.row);this.style.backgroundColor=o;};this.scroll=function(ev){var $0e=$u.$('scroll');$u.scrollPos=$0e.scrollLeft;$u.scrollTop=$0e.scrollTop;$u.scrollWidth=$0e.clientWidth;$u.$('timescroll').scrollLeft=$u.scrollPos;$u.$('resscroll').scrollTop=$u.scrollTop;$u.$('scrollpos').value=$u.scrollPos;$u.updateScrollIndicators();};this.updateScrollIndicators=function(){var $k=$u.$("left");if($k){if($u.minEnd<=$u.scrollPos){$k.style.display='';}else{$k.style.display='none';}};var $A=$u.$("right");if($A){if($u.maxStart>=$u.scrollPos+$u.scrollWidth){$A.style.display='';}else{$A.style.display='none';}}}};DayPilotScheduler.Event=function($q,$u){$q.event=this;this.root=$u;this.value=function(){return $q.data.Value;};this.text=function(){return $q.data.Text;};this.start=function(){return new Date($q.data.Start);};this.end=function(){return new Date($q.data.End);};this.partStart=function(){return new Date($q.data.PartStart);};this.partEnd=function(){return new Date($q.data.PartEnd);};this.row=function(){return DayPilotScheduler.getShadowRow($q).getAttribute("dpRow");};this.useBox=function(){return $q.data.Box;};this.tag=function($0R){var t=$q.data.Tag;if(!$0R){return t;};var $0S=$u.tagFields.split(",");var $0E=-1;for(var i=0;i<$0S.length;i++){if($0R===$0S[i])$0E=i;};if($0E==-1){throw "Field name not found.";};var $0T=t.split('&');return decodeURIComponent($0T[$0E]);};var $0U=function($0f,ev){var $0V=6;var $0W=8;if(typeof(DayPilotScheduler)==='undefined'){return;};var $03=DayPilot.mo($0f,ev);if(!$03)return;if(DayPilotScheduler.resizing){return;};var $0X=$0f.getAttribute("dpStart")==$0f.getAttribute("dpPartStart");var $0Y=$0f.getAttribute("dpEnd")==$0f.getAttribute("dpPartEnd");if($03.y<=$0W&&$q.data.MoveEnabled&&$u.eventMoveHandling!='Disabled'){if($0X){$0f.style.cursor='move';}else{$0f.style.cursor='not-allowed';}}else if($03.x<=$0V&&$q.data.ResizeEnabled&&$u.eventResizeHandling!='Disabled'){if($0X){$0f.style.cursor="w-resize";$0f.dpBorder='left';}else{$0f.style.cursor='not-allowed';}}else if($0f.offsetWidth-$03.x<=$0V&&$q.data.ResizeEnabled&&$u.eventResizeHandling!='Disabled'){if($0Y){$0f.style.cursor="e-resize";$0f.dpBorder='right';}else{$0f.style.cursor='not-allowed';}}else if(!DayPilotScheduler.resizing&&!DayPilotScheduler.moving){if($q.data.ClickEnabled&&$u.eventClickHandling!='Disabled'){$0f.style.cursor='pointer';}else{$0f.style.cursor='default';}};if(typeof(DayPilotBubble)!='undefined'&&$u.bubble){if($0f.style.cursor=='default'||$0f.style.cursor=='pointer'){$u.bubble.showEvent($u.uniqueID,$0f.event.value());}else{DayPilotBubble.hideActive();}}};$q.onmousemove=function(ev){$0U(this,ev);};$q.onmousedown=function(ev){ev=ev||window.event;var $0r=ev.which||ev.button;if((this.style.cursor=='w-resize'||this.style.cursor=='e-resize')&&$0r==1){DayPilotScheduler.resizing=this;DayPilotScheduler.originalMouse=DayPilot.mc(ev);DayPilotScheduler.originalWidth=this.offsetWidth;DayPilotScheduler.originalLeft=this.offsetLeft;DayPilotScheduler.resizingShadow=DayPilotScheduler.createShadow(this);document.body.style.cursor=this.style.cursor;this.onclickSave=this.onclick;this.onclick=null;}else if(this.style.cursor=='move'&&$0r==1){DayPilotScheduler.moving=this;DayPilotScheduler.originalMouse=DayPilot.mc(ev);DayPilotScheduler.originalLeft=this.offsetLeft;DayPilotScheduler.originalTop=this.offsetTop;DayPilotScheduler.moveOffsetX=DayPilot.mo(null,ev).x;var $d=DayPilotScheduler.moving.offsetWidth/$u.cellWidth*$u.cellDuration*60;DayPilotScheduler.movingShadow=$u.createShadow($d);$u.moveShadow();document.body.style.cursor='move';this.onclickSave=this.onclick;this.onclick=null;}else{if(this.onclickSave){this.onclick=this.onclickSave;}};return false;};};

Comment posted by John
11 years ago.

Any chance of documentation on how to get a popup window up and reporting back to the main window?

I see the note about the example with Ajax. However, I've not yet got into Ajax and I'm after a quick solution.

Thanks!

John

This question is more than 3 months old and has been closed. Please create a new question if you have anything to add.