diff options
author | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2014-06-10 20:50:30 +0300 |
---|---|---|
committer | AlexKlimenkov <shurick.klimenkov@gmail.com> | 2014-06-10 20:50:30 +0300 |
commit | b5a0589955460a44c5428c4cb5429fcfce265d23 (patch) | |
tree | 87db58400a3e036de646fb630cbb358beeac3bc1 /codebase/ext/dhtmlxscheduler_year_view.js | |
parent | e2aaaef8540fabd0b5200a4959c269d6f1ae352e (diff) | |
download | scheduler-b5a0589955460a44c5428c4cb5429fcfce265d23.zip scheduler-b5a0589955460a44c5428c4cb5429fcfce265d23.tar.gz scheduler-b5a0589955460a44c5428c4cb5429fcfce265d23.tar.bz2 |
[update] version 4.1.0
Diffstat (limited to 'codebase/ext/dhtmlxscheduler_year_view.js')
-rw-r--r-- | codebase/ext/dhtmlxscheduler_year_view.js | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/codebase/ext/dhtmlxscheduler_year_view.js b/codebase/ext/dhtmlxscheduler_year_view.js index bf36dd1..fcfb98c 100644 --- a/codebase/ext/dhtmlxscheduler_year_view.js +++ b/codebase/ext/dhtmlxscheduler_year_view.js @@ -1,20 +1,24 @@ /* -This software is allowed to use under GPL or you need to obtain Commercial or Enterise License -to use it in non-GPL project. Please contact sales@dhtmlx.com for details +dhtmlxScheduler v.4.1.0 Stardard + +This software is covered by GPL license. You also can obtain Commercial or Enterprise license to use it in non-GPL project - please contact sales@dhtmlx.com. Usage without proper license is prohibited. + +(c) Dinamenta, UAB. */ -scheduler.config.year_x=4;scheduler.config.year_y=3;scheduler.xy.year_top=0;scheduler.templates.year_date=function(n){return scheduler.date.date_to_str(scheduler.locale.labels.year_tab+" %Y")(n)};scheduler.templates.year_month=scheduler.date.date_to_str("%F");scheduler.templates.year_scale_date=scheduler.date.date_to_str("%D");scheduler.templates.year_tooltip=function(n,q,u){return u.text}; -(function(){function n(b){return m(b,function(a){return a.nodeName.toLowerCase()=="td"})}function q(b){return m(b,function(a){return a.nodeName.toLowerCase()=="table"})}function u(b){b=q(b);return m(b,function(a){return a.hasAttribute&&a.hasAttribute("date")})}function m(b,a){for(;b&&!a(b);)b=b.parentNode;return b}var k=function(){return scheduler._mode=="year"};scheduler.dblclick_dhx_month_head=function(b){if(k()){var a=b.target||b.srcElement;if(a.parentNode.className.indexOf("dhx_before")!=-1|| -a.parentNode.className.indexOf("dhx_after")!=-1)return!1;var c=this.templates.xml_date(a.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute("date"));c.setDate(parseInt(a.innerHTML,10));var e=this.date.add(c,1,"day");!this.config.readonly&&this.config.dblclick_create&&this.addEventNow(c.valueOf(),e.valueOf(),b)}};var v=scheduler.changeEventId;scheduler.changeEventId=function(){v.apply(this,arguments);k()&&this.year_view(!0)};var w=scheduler.render_data,x=scheduler.date.date_to_str("%Y/%m/%d"), -y=scheduler.date.str_to_date("%Y/%m/%d");scheduler.render_data=function(b){if(!k())return w.apply(this,arguments);for(var a=0;a<b.length;a++)this._year_render_event(b[a])};var z=scheduler.clear_view;scheduler.clear_view=function(){if(!k())return z.apply(this,arguments);for(var b in o)if(o.hasOwnProperty(b)){var a=o[b];a.className="dhx_month_head";a.setAttribute("date","")}o={}};scheduler._hideToolTip=function(){if(this._tooltip)this._tooltip.style.display="none",this._tooltip.date=new Date(9999,1, -1)};scheduler._showToolTip=function(b,a,c,e){if(this._tooltip){if(this._tooltip.date.valueOf()==b.valueOf())return;this._tooltip.innerHTML=""}else{var d=this._tooltip=document.createElement("DIV");d.className="dhx_year_tooltip";document.body.appendChild(d);d.onclick=scheduler._click.dhx_cal_data}for(var f=this.getEvents(b,this.date.add(b,1,"day")),l="",i=0;i<f.length;i++){var p=f[i],g=p.color?"background:"+p.color+";":"",j=p.textColor?"color:"+p.textColor+";":"";l+="<div class='dhx_tooltip_line' style='"+ -g+""+j+"' event_id='"+f[i].id+"'>";l+="<div class='dhx_tooltip_date' style='"+g+""+j+"'>"+(f[i]._timed?this.templates.event_date(f[i].start_date):"")+"</div>";l+="<div class='dhx_event_icon icon_details'> </div>";l+=this.templates.year_tooltip(f[i].start_date,f[i].end_date,f[i])+"</div>"}this._tooltip.style.display="";this._tooltip.style.top="0px";this._tooltip.style.left=document.body.offsetWidth-a.left-this._tooltip.offsetWidth<0?a.left-this._tooltip.offsetWidth+"px":a.left+e.offsetWidth+"px"; -this._tooltip.date=b;this._tooltip.innerHTML=l;this._tooltip.style.top=document.body.offsetHeight-a.top-this._tooltip.offsetHeight<0?a.top-this._tooltip.offsetHeight+e.offsetHeight+"px":a.top+"px"};scheduler._init_year_tooltip=function(){dhtmlxEvent(scheduler._els.dhx_cal_data[0],"mouseover",function(b){if(k()){var b=b||event,a=b.target||b.srcElement;if(a.tagName.toLowerCase()=="a")a=a.parentNode;(a.className||"").indexOf("dhx_year_event")!=-1?scheduler._showToolTip(y(a.getAttribute("date")),getOffset(a), -b,a):scheduler._hideToolTip()}});this._init_year_tooltip=function(){}};scheduler.attachEvent("onSchedulerResize",function(){return k()?(this.year_view(!0),!1):!0});scheduler._get_year_cell=function(b){var a=b.getMonth()+12*(b.getFullYear()-this._min_date.getFullYear())-this.week_starts._month,c=this._els.dhx_cal_data[0].childNodes[a],b=this.week_starts[a]+b.getDate()-1;return c.childNodes[2].firstChild.rows[Math.floor(b/7)].cells[b%7].firstChild};var o={};scheduler._mark_year_date=function(b,a){var c= -x(b),e=this._get_year_cell(b),d=this.templates.event_class(a.start_date,a.end_date,a);if(!o[c])e.className="dhx_month_head dhx_year_event",e.setAttribute("date",c),o[c]=e;e.className+=d?" "+d:""};scheduler._unmark_year_date=function(b){this._get_year_cell(b).className="dhx_month_head"};scheduler._year_render_event=function(b){for(var a=b.start_date,a=a.valueOf()<this._min_date.valueOf()?this._min_date:this.date.date_part(new Date(a));a<b.end_date;)if(this._mark_year_date(a,b),a=this.date.add(a,1, -"day"),a.valueOf()>=this._max_date.valueOf())break};scheduler.year_view=function(b){if(b){var a=scheduler.xy.scale_height;scheduler.xy.scale_height=-1}scheduler._els.dhx_cal_header[0].style.display=b?"none":"";scheduler.set_sizes();if(b)scheduler.xy.scale_height=a;scheduler._table_view=b;if(!this._load_mode||!this._load())if(b){scheduler._init_year_tooltip();scheduler._reset_year_scale();if(scheduler._load_mode&&scheduler._load())return scheduler._render_wait=!0;scheduler.render_view_data()}else scheduler._hideToolTip()}; -scheduler._reset_year_scale=function(){this._cols=[];this._colsS={};var b=[],a=this._els.dhx_cal_data[0],c=this.config;a.scrollTop=0;a.innerHTML="";var e=Math.floor(parseInt(a.style.width)/c.year_x),d=Math.floor((parseInt(a.style.height)-scheduler.xy.year_top)/c.year_y);d<190&&(d=190,e=Math.floor((parseInt(a.style.width)-scheduler.xy.scroll_width)/c.year_x));for(var f=e-11,l=0,i=document.createElement("div"),p=this.date.week_start(scheduler._currentDate()),g=0;g<7;g++)this._cols[g]=Math.floor(f/(7- -g)),this._render_x_header(g,l,p,i),p=this.date.add(p,1,"day"),f-=this._cols[g],l+=this._cols[g];i.lastChild.className+=" dhx_scale_bar_last";for(var j=this.date[this._mode+"_start"](this.date.copy(this._date)),k=j,g=0;g<c.year_y;g++)for(var t=0;t<c.year_x;t++){var h=document.createElement("DIV");h.style.cssText="position:absolute;";h.setAttribute("date",this.templates.xml_format(j));h.innerHTML="<div class='dhx_year_month'></div><div class='dhx_year_week'>"+i.innerHTML+"</div><div class='dhx_year_body'></div>"; -h.childNodes[0].innerHTML=this.templates.year_month(j);for(var o=this.date.week_start(j),n=this._reset_month_scale(h.childNodes[2],j,o),r=h.childNodes[2].firstChild.rows,s=r.length;s<6;s++){r[0].parentNode.appendChild(r[0].cloneNode(!0));for(var m=0;m<r[s].childNodes.length;m++)r[s].childNodes[m].className="dhx_after",r[s].childNodes[m].firstChild.innerHTML=scheduler.templates.month_day(n),n=scheduler.date.add(n,1,"day")}a.appendChild(h);h.childNodes[1].style.height=h.childNodes[1].childNodes[0].offsetHeight+ -"px";var q=Math.round((d-190)/2);h.style.marginTop=q+"px";this.set_xy(h,e-10,d-q-10,e*t+5,d*g+5+scheduler.xy.year_top);b[g*c.year_x+t]=(j.getDay()-(this.config.start_on_monday?1:0)+7)%7;j=this.date.add(j,1,"month")}this._els.dhx_cal_date[0].innerHTML=this.templates[this._mode+"_date"](k,j,this._mode);this.week_starts=b;b._month=k.getMonth();this._min_date=k;this._max_date=j};var A=scheduler.getActionData;scheduler.getActionData=function(b){function a(a){a=u(a);if(!a)return null;var b=a.getAttribute("date"); -return!b?null:scheduler.date.week_start(scheduler.templates.xml_date(b))}function c(a){var b=q(a);if(!b)return null;for(var d=0,c=0,d=0,e=b.rows.length;d<e;d++){for(var f=b.rows[d].getElementsByTagName("td"),c=0,h=f.length;c<h;c++)if(f[c]==a)break;if(c<h)break}return d<e?{day:c,week:d}:null}if(!k())return A.apply(scheduler,arguments);var e=b?b.target:event.srcElement,d=a(e),f=n(e),l=c(f);l&&d?(d=scheduler.date.add(d,l.week,"week"),d=scheduler.date.add(d,l.day,"day")):d=null;return{date:d,section:null}}; -var B=scheduler._locate_event;scheduler._locate_event=function(b){if(!k())return B.apply(scheduler,arguments);var a=m(b,function(a){return a.className&&a.className.indexOf("dhx_year_event")!=-1&&a.hasAttribute&&a.hasAttribute("date")});if(!a||!a.hasAttribute("date"))return null;var c=scheduler.templates.xml_date(a.getAttribute("date")),e=scheduler.getEvents(c,scheduler.date.add(c,1,"day"));return!e.length?null:e[0].id}})(); +scheduler.config.year_x=4,scheduler.config.year_y=3,scheduler.xy.year_top=0,scheduler.templates.year_date=function(e){return scheduler.date.date_to_str(scheduler.locale.labels.year_tab+" %Y")(e)},scheduler.templates.year_month=scheduler.date.date_to_str("%F"),scheduler.templates.year_scale_date=scheduler.date.date_to_str("%D"),scheduler.templates.year_tooltip=function(e,t,r){return r.text},function(){var e=function(){return"year"==scheduler._mode};scheduler.dblclick_dhx_month_head=function(t){if(e()){var r=t.target||t.srcElement; +if(-1!=r.parentNode.className.indexOf("dhx_before")||-1!=r.parentNode.className.indexOf("dhx_after"))return!1;var s=this.templates.xml_date(r.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.getAttribute("date"));s.setDate(parseInt(r.innerHTML,10));var a=this.date.add(s,1,"day");!this.config.readonly&&this.config.dblclick_create&&this.addEventNow(s.valueOf(),a.valueOf(),t)}};var t=scheduler.changeEventId;scheduler.changeEventId=function(){t.apply(this,arguments),e()&&this.year_view(!0) +};var r=scheduler.render_data,s=scheduler.date.date_to_str("%Y/%m/%d"),a=scheduler.date.str_to_date("%Y/%m/%d");scheduler.render_data=function(t){if(!e())return r.apply(this,arguments);for(var s=0;s<t.length;s++)this._year_render_event(t[s])};var d=scheduler.clear_view;scheduler.clear_view=function(){if(!e())return d.apply(this,arguments);var t=scheduler._year_marked_cells,r=null;for(var s in t)t.hasOwnProperty(s)&&(r=t[s],r.className="dhx_month_head",r.setAttribute("date",""));scheduler._year_marked_cells={} +},scheduler._hideToolTip=function(){this._tooltip&&(this._tooltip.style.display="none",this._tooltip.date=new Date(9999,1,1))},scheduler._showToolTip=function(e,t,r,s){if(this._tooltip){if(this._tooltip.date.valueOf()==e.valueOf())return;this._tooltip.innerHTML=""}else{var a=this._tooltip=document.createElement("DIV");a.className="dhx_year_tooltip",document.body.appendChild(a),a.onclick=scheduler._click.dhx_cal_data}for(var d=this.getEvents(e,this.date.add(e,1,"day")),n="",i=0;i<d.length;i++){var l=d[i]; +if(this.filter_event(l.id,l)){var _=l.color?"background:"+l.color+";":"",o=l.textColor?"color:"+l.textColor+";":"";n+="<div class='dhx_tooltip_line' style='"+_+o+"' event_id='"+d[i].id+"'>",n+="<div class='dhx_tooltip_date' style='"+_+o+"'>"+(d[i]._timed?this.templates.event_date(d[i].start_date):"")+"</div>",n+="<div class='dhx_event_icon icon_details'> </div>",n+=this.templates.year_tooltip(d[i].start_date,d[i].end_date,d[i])+"</div>"}}this._tooltip.style.display="",this._tooltip.style.top="0px",this._tooltip.style.left=document.body.offsetWidth-t.left-this._tooltip.offsetWidth<0?t.left-this._tooltip.offsetWidth+"px":t.left+s.offsetWidth+"px",this._tooltip.date=e,this._tooltip.innerHTML=n,this._tooltip.style.top=document.body.offsetHeight-t.top-this._tooltip.offsetHeight<0?t.top-this._tooltip.offsetHeight+s.offsetHeight+"px":t.top+"px" +},scheduler._year_view_tooltip_handler=function(t){if(e()){var t=t||event,r=t.target||t.srcElement;"a"==r.tagName.toLowerCase()&&(r=r.parentNode),-1!=(r.className||"").indexOf("dhx_year_event")?scheduler._showToolTip(a(r.getAttribute("date")),getOffset(r),t,r):scheduler._hideToolTip()}},scheduler._init_year_tooltip=function(){scheduler._detachDomEvent(scheduler._els.dhx_cal_data[0],"mouseover",scheduler._year_view_tooltip_handler),dhtmlxEvent(scheduler._els.dhx_cal_data[0],"mouseover",scheduler._year_view_tooltip_handler) +},scheduler.attachEvent("onSchedulerResize",function(){return e()?(this.year_view(!0),!1):!0}),scheduler._get_year_cell=function(e){var t=e.getMonth()+12*(e.getFullYear()-this._min_date.getFullYear())-this.week_starts._month,r=this._els.dhx_cal_data[0].childNodes[t],e=this.week_starts[t]+e.getDate()-1;return r.childNodes[2].firstChild.rows[Math.floor(e/7)].cells[e%7].firstChild},scheduler._year_marked_cells={},scheduler._mark_year_date=function(e,t){var r=s(e),a=this._get_year_cell(e),d=this.templates.event_class(t.start_date,t.end_date,t); +scheduler._year_marked_cells[r]||(a.className="dhx_month_head dhx_year_event",a.setAttribute("date",r),scheduler._year_marked_cells[r]=a),a.className+=d?" "+d:""},scheduler._unmark_year_date=function(e){this._get_year_cell(e).className="dhx_month_head"},scheduler._year_render_event=function(e){var t=e.start_date;for(t=t.valueOf()<this._min_date.valueOf()?this._min_date:this.date.date_part(new Date(t));t<e.end_date;)if(this._mark_year_date(t,e),t=this.date.add(t,1,"day"),t.valueOf()>=this._max_date.valueOf())return +},scheduler.year_view=function(e){var t;if(e&&(t=scheduler.xy.scale_height,scheduler.xy.scale_height=-1),scheduler._els.dhx_cal_header[0].style.display=e?"none":"",scheduler.set_sizes(),e&&(scheduler.xy.scale_height=t),scheduler._table_view=e,!this._load_mode||!this._load())if(e){if(scheduler._init_year_tooltip(),scheduler._reset_year_scale(),scheduler._load_mode&&scheduler._load())return void(scheduler._render_wait=!0);scheduler.render_view_data()}else scheduler._hideToolTip()},scheduler._reset_year_scale=function(){this._cols=[],this._colsS={}; +var e=[],t=this._els.dhx_cal_data[0],r=this.config;t.scrollTop=0,t.innerHTML="";var s=Math.floor(parseInt(t.style.width)/r.year_x),a=Math.floor((parseInt(t.style.height)-scheduler.xy.year_top)/r.year_y);190>a&&(a=190,s=Math.floor((parseInt(t.style.width)-scheduler.xy.scroll_width)/r.year_x));for(var d=s-11,n=0,i=document.createElement("div"),l=this.date.week_start(scheduler._currentDate()),_=0;7>_;_++)this._cols[_]=Math.floor(d/(7-_)),this._render_x_header(_,n,l,i),l=this.date.add(l,1,"day"),d-=this._cols[_],n+=this._cols[_]; +i.lastChild.className+=" dhx_scale_bar_last";for(var o=this.date[this._mode+"_start"](this.date.copy(this._date)),c=o,h=null,_=0;_<r.year_y;_++)for(var u=0;u<r.year_x;u++){h=document.createElement("DIV"),h.style.cssText="position:absolute;",h.setAttribute("date",this.templates.xml_format(o)),h.innerHTML="<div class='dhx_year_month'></div><div class='dhx_year_week'>"+i.innerHTML+"</div><div class='dhx_year_body'></div>",h.childNodes[0].innerHTML=this.templates.year_month(o);for(var v=this.date.week_start(o),f=this._reset_month_scale(h.childNodes[2],o,v),p=h.childNodes[2].firstChild.rows,g=p.length;6>g;g++){p[0].parentNode.appendChild(p[0].cloneNode(!0)); +for(var m=0,y=p[g].childNodes.length;y>m;m++)p[g].childNodes[m].className="dhx_after",p[g].childNodes[m].firstChild.innerHTML=scheduler.templates.month_day(f),f=scheduler.date.add(f,1,"day")}t.appendChild(h),h.childNodes[1].style.height=h.childNodes[1].childNodes[0].offsetHeight+"px";var x=Math.round((a-190)/2);h.style.marginTop=x+"px",this.set_xy(h,s-10,a-x-10,s*u+5,a*_+5+scheduler.xy.year_top),e[_*r.year_x+u]=(o.getDay()-(this.config.start_on_monday?1:0)+7)%7,o=this.date.add(o,1,"month")}this._els.dhx_cal_date[0].innerHTML=this.templates[this._mode+"_date"](c,o,this._mode),this.week_starts=e,e._month=c.getMonth(),this._min_date=c,this._max_date=o +};var n=scheduler.getActionData;scheduler.getActionData=function(t){if(!e())return n.apply(scheduler,arguments);var r=t?t.target:event.srcElement,s=scheduler._get_year_month_date(r),a=scheduler._get_year_month_cell(r),d=scheduler._get_year_day_indexes(a);return d&&s?(s=scheduler.date.add(s,d.week,"week"),s=scheduler.date.add(s,d.day,"day")):s=null,{date:s,section:null}},scheduler._get_year_day_indexes=function(e){var t=scheduler._locate_year_month_table(e);if(!t)return null;for(var r=0,s=0,r=0,a=t.rows.length;a>r;r++){for(var d=t.rows[r].getElementsByTagName("td"),s=0,n=d.length;n>s&&d[s]!=e;s++);if(n>s)break +}return a>r?{day:s,week:r}:null},scheduler._get_year_month_date=function(e){var e=scheduler._locate_year_month_root(e);if(!e)return null;var t=e.getAttribute("date");return t?scheduler.date.week_start(scheduler.templates.xml_date(t)):null},scheduler._locate_year_month_day=function(e){return e.className&&-1!=e.className.indexOf("dhx_year_event")&&e.hasAttribute&&e.hasAttribute("date")};var i=scheduler._locate_event;scheduler._locate_event=function(e){var t=i.apply(scheduler,arguments);if(!t){var r=scheduler._get_year_el_node(e,scheduler._locate_year_month_day); +if(!r||!r.hasAttribute("date"))return null;var s=scheduler.templates.xml_date(r.getAttribute("date")),a=scheduler.getEvents(s,scheduler.date.add(s,1,"day"));if(!a.length)return null;t=a[0].id}return t},scheduler._locate_year_month_cell=function(e){return"td"==e.nodeName.toLowerCase()},scheduler._locate_year_month_table=function(e){return"table"==e.nodeName.toLowerCase()},scheduler._locate_year_month_root=function(e){return e.hasAttribute&&e.hasAttribute("date")},scheduler._get_year_month_cell=function(e){return this._get_year_el_node(e,this._locate_year_month_cell) +},scheduler._get_year_month_table=function(e){return this._get_year_el_node(e,this._locate_year_month_table)},scheduler._get_year_month_root=function(e){return this._get_year_el_node(this._get_year_month_table(e),this._locate_year_month_root)},scheduler._get_year_el_node=function(e,t){for(;e&&!t(e);)e=e.parentNode;return e}}(); +//# sourceMappingURL=../sources/ext/dhtmlxscheduler_year_view.js.map
\ No newline at end of file |