4 * base class for bootstrap elements.
8 Roo.bootstrap = Roo.bootstrap || {};
10 * @class Roo.bootstrap.Component
11 * @extends Roo.Component
12 * Bootstrap Component base class
13 * @cfg {String} cls css class
14 * @cfg {String} style any extra css
15 * @cfg {Object} xattr extra attributes to add to 'element' (used by builder to store stuff.)
16 * @cfg {Boolean} can_build_overlaid True if element can be rebuild from a HTML page
17 * @cfg {string} dataId cutomer id
18 * @cfg {string} name Specifies name attribute
19 * @cfg {string} tooltip Text for the tooltip
20 * @cfg {string} container_method method to fetch parents container element (used by NavHeaderbar - getHeaderChildContainer)
21 * @cfg {string|object} visibilityEl (el|parent) What element to use for visibility (@see getVisibilityEl())
24 * Do not use directly - it does not do anything..
25 * @param {Object} config The config object
30 Roo.bootstrap.Component = function(config){
31 Roo.bootstrap.Component.superclass.constructor.call(this, config);
35 * @event childrenrendered
36 * Fires when the children have been rendered..
37 * @param {Roo.bootstrap.Component} this
39 "childrenrendered" : true
48 Roo.extend(Roo.bootstrap.Component, Roo.BoxComponent, {
51 allowDomMove : false, // to stop relocations in parent onRender...
61 * Initialize Events for the element
63 initEvents : function() { },
69 can_build_overlaid : true,
71 container_method : false,
78 // returns the parent component..
79 return Roo.ComponentMgr.get(this.parentId)
85 onRender : function(ct, position)
87 // Roo.log("Call onRender: " + this.xtype);
89 Roo.bootstrap.Component.superclass.onRender.call(this, ct, position);
92 if (this.el.attr('xtype')) {
93 this.el.attr('xtypex', this.el.attr('xtype'));
94 this.el.dom.removeAttribute('xtype');
104 var cfg = Roo.apply({}, this.getAutoCreate());
106 cfg.id = this.id || Roo.id();
108 // fill in the extra attributes
109 if (this.xattr && typeof(this.xattr) =='object') {
110 for (var i in this.xattr) {
111 cfg[i] = this.xattr[i];
116 cfg.dataId = this.dataId;
120 cfg.cls = (typeof(cfg.cls) == 'undefined' ? this.cls : cfg.cls) + ' ' + this.cls;
123 if (this.style) { // fixme needs to support more complex style data.
124 cfg.style = (typeof(cfg.style) == 'undefined' ? this.style : cfg.style) + '; ' + this.style;
128 cfg.name = this.name;
131 this.el = ct.createChild(cfg, position);
134 this.tooltipEl().attr('tooltip', this.tooltip);
137 if(this.tabIndex !== undefined){
138 this.el.dom.setAttribute('tabIndex', this.tabIndex);
145 * Fetch the element to add children to
146 * @return {Roo.Element} defaults to this.el
148 getChildContainer : function()
152 getDocumentBody : function() // used by menus - as they are attached to the body so zIndexes work
154 return Roo.get(document.body);
158 * Fetch the element to display the tooltip on.
159 * @return {Roo.Element} defaults to this.el
161 tooltipEl : function()
166 addxtype : function(tree,cntr)
170 cn = Roo.factory(tree);
171 //Roo.log(['addxtype', cn]);
173 cn.parentType = this.xtype; //??
174 cn.parentId = this.id;
176 cntr = (typeof(cntr) == 'undefined' ) ? 'getChildContainer' : cntr;
177 if (typeof(cn.container_method) == 'string') {
178 cntr = cn.container_method;
182 var has_flexy_each = (typeof(tree['flexy:foreach']) != 'undefined');
184 var has_flexy_if = (typeof(tree['flexy:if']) != 'undefined');
186 var build_from_html = Roo.XComponent.build_from_html;
188 var is_body = (tree.xtype == 'Body') ;
190 var page_has_body = (Roo.get(document.body).attr('xtype') == 'Roo.bootstrap.Body');
192 var self_cntr_el = Roo.get(this[cntr](false));
194 // do not try and build conditional elements
195 if ((has_flexy_each || has_flexy_if || this.can_build_overlaid == false ) && build_from_html) {
199 if (!has_flexy_each || !build_from_html || is_body || !page_has_body) {
200 if(!has_flexy_if || typeof(tree.name) == 'undefined' || !build_from_html || is_body || !page_has_body){
201 return this.addxtypeChild(tree,cntr, is_body);
204 var echild =self_cntr_el ? self_cntr_el.child('>*[name=' + tree.name + ']') : false;
207 return this.addxtypeChild(Roo.apply({}, tree),cntr);
210 Roo.log('skipping render');
216 if (!build_from_html) {
220 // this i think handles overlaying multiple children of the same type
221 // with the sam eelement.. - which might be buggy..
223 var echild =self_cntr_el ? self_cntr_el.child('>*[xtype]') : false;
229 if (echild && echild.attr('xtype').split('.').pop() != cn.xtype) {
233 ret = this.addxtypeChild(Roo.apply({}, tree),cntr);
240 addxtypeChild : function (tree, cntr, is_body)
242 Roo.debug && Roo.log('addxtypeChild:' + cntr);
244 cntr = (typeof(cntr) == 'undefined' ) ? 'getChildContainer' : cntr;
247 var has_flexy = (typeof(tree['flexy:if']) != 'undefined') ||
248 (typeof(tree['flexy:foreach']) != 'undefined');
252 skip_children = false;
253 // render the element if it's not BODY.
256 // if parent was disabled, then do not try and create the children..
257 if(!this[cntr](true)){
262 cn = Roo.factory(tree);
264 cn.parentType = this.xtype; //??
265 cn.parentId = this.id;
267 var build_from_html = Roo.XComponent.build_from_html;
270 // does the container contain child eleemnts with 'xtype' attributes.
271 // that match this xtype..
272 // note - when we render we create these as well..
273 // so we should check to see if body has xtype set.
274 if (build_from_html && Roo.get(document.body).attr('xtype') == 'Roo.bootstrap.Body') {
276 var self_cntr_el = Roo.get(this[cntr](false));
277 var echild =self_cntr_el ? self_cntr_el.child('>*[xtype]') : false;
279 //Roo.log(Roo.XComponent.build_from_html);
280 //Roo.log("got echild:");
283 // there is a scenario where some of the child elements are flexy:if (and all of the same type)
284 // and are not displayed -this causes this to use up the wrong element when matching.
285 // at present the only work around for this is to nest flexy:if elements in another element that is always rendered.
288 if (echild && echild.attr('xtype').split('.').pop() == cn.xtype) {
289 // Roo.log("found child for " + this.xtype +": " + echild.attr('xtype') );
295 //echild.dom.removeAttribute('xtype');
297 Roo.debug && Roo.log("MISSING " + cn.xtype + " on child of " + (this.el ? this.el.attr('xbuilderid') : 'no parent'));
298 Roo.debug && Roo.log(self_cntr_el);
299 Roo.debug && Roo.log(echild);
300 Roo.debug && Roo.log(cn);
306 // if object has flexy:if - then it may or may not be rendered.
307 if (build_from_html && has_flexy && !cn.el && cn.can_build_overlaid) {
308 // skip a flexy if element.
309 Roo.debug && Roo.log('skipping render');
310 Roo.debug && Roo.log(tree);
312 Roo.debug && Roo.log('skipping all children');
313 skip_children = true;
318 // actually if flexy:foreach is found, we really want to create
319 // multiple copies here...
321 //Roo.log(this[cntr]());
322 // some elements do not have render methods.. like the layouts...
324 if(this[cntr](true) === false){
329 cn.render && cn.render(this[cntr](true));
332 // then add the element..
339 if (typeof (tree.menu) != 'undefined') {
340 tree.menu.parentType = cn.xtype;
341 tree.menu.triggerEl = cn.el;
342 nitems.push(cn.addxtype(Roo.apply({}, tree.menu)));
346 if (!tree.items || !tree.items.length) {
348 //Roo.log(["no children", this]);
353 var items = tree.items;
356 //Roo.log(items.length);
358 if (!skip_children) {
359 for(var i =0;i < items.length;i++) {
360 // Roo.log(['add child', items[i]]);
361 nitems.push(cn.addxtype(Roo.apply({}, items[i])));
367 //Roo.log("fire childrenrendered");
369 cn.fireEvent('childrenrendered', this);
375 * Set the element that will be used to show or hide
377 setVisibilityEl : function(el)
379 this.visibilityEl = el;
383 * Get the element that will be used to show or hide
385 getVisibilityEl : function()
387 if (typeof(this.visibilityEl) == 'object') {
388 return this.visibilityEl;
391 if (typeof(this.visibilityEl) == 'string') {
392 return this.visibilityEl == 'parent' ? this.parent().getEl() : this.getEl();
399 * Show a component - removes 'hidden' class
403 if(!this.getVisibilityEl()){
407 this.getVisibilityEl().removeClass(['hidden','d-none']);
409 this.fireEvent('show', this);
414 * Hide a component - adds 'hidden' class
418 if(!this.getVisibilityEl()){
422 this.getVisibilityEl().addClass(['hidden','d-none']);
424 this.fireEvent('hide', this);
432 * based on jquery fullcalendar
436 Roo.bootstrap = Roo.bootstrap || {};
438 * @class Roo.bootstrap.Calendar
439 * @extends Roo.bootstrap.Component
440 * Bootstrap Calendar class
441 * @cfg {Boolean} loadMask (true|false) default false
442 * @cfg {Object} header generate the user specific header of the calendar, default false
445 * Create a new Container
446 * @param {Object} config The config object
451 Roo.bootstrap.Calendar = function(config){
452 Roo.bootstrap.Calendar.superclass.constructor.call(this, config);
456 * Fires when a date is selected
457 * @param {DatePicker} this
458 * @param {Date} date The selected date
463 * Fires when the displayed month changes
464 * @param {DatePicker} this
465 * @param {Date} date The selected month
470 * Fires when mouse over an event
471 * @param {Calendar} this
472 * @param {event} Event
477 * Fires when the mouse leaves an
478 * @param {Calendar} this
484 * Fires when the mouse click an
485 * @param {Calendar} this
494 Roo.extend(Roo.bootstrap.Calendar, Roo.bootstrap.Component, {
497 * @cfg {Number} startDay
498 * Day index at which the week should begin, 0-based (defaults to 0, which is Sunday)
506 getAutoCreate : function(){
509 var fc_button = function(name, corner, style, content ) {
510 return Roo.apply({},{
512 cls : 'fc-button fc-button-'+name+' fc-state-default ' +
514 'fc-corner-' + corner.split(' ').join(' fc-corner-') :
517 html : '<SPAN class="fc-text-'+style+ '">'+content +'</SPAN>',
528 style : 'width:100%',
535 cls : 'fc-header-left',
537 fc_button('prev', 'left', 'arrow', '‹' ),
538 fc_button('next', 'right', 'arrow', '›' ),
539 { tag: 'span', cls: 'fc-header-space' },
540 fc_button('today', 'left right', '', 'today' ) // neds state disabled..
548 cls : 'fc-header-center',
552 cls: 'fc-header-title',
555 html : 'month / year'
563 cls : 'fc-header-right',
565 /* fc_button('month', 'left', '', 'month' ),
566 fc_button('week', '', '', 'week' ),
567 fc_button('day', 'right', '', 'day' )
579 header = this.header;
582 var cal_heads = function() {
584 // fixme - handle this.
586 for (var i =0; i < Date.dayNames.length; i++) {
587 var d = Date.dayNames[i];
590 cls : 'fc-day-header fc-' + d.substring(0,3).toLowerCase() + ' fc-widget-header',
591 html : d.substring(0,3)
595 ret[0].cls += ' fc-first';
596 ret[6].cls += ' fc-last';
599 var cal_cell = function(n) {
602 cls : 'fc-day fc-'+n + ' fc-widget-content', ///fc-other-month fc-past
607 cls: 'fc-day-number',
611 cls: 'fc-day-content',
615 style: 'position: relative;' // height: 17px;
627 var cal_rows = function() {
630 for (var r = 0; r < 6; r++) {
637 for (var i =0; i < Date.dayNames.length; i++) {
638 var d = Date.dayNames[i];
639 row.cn.push(cal_cell(d.substring(0,3).toLowerCase()));
642 row.cn[0].cls+=' fc-first';
643 row.cn[0].cn[0].style = 'min-height:90px';
644 row.cn[6].cls+=' fc-last';
648 ret[0].cls += ' fc-first';
649 ret[4].cls += ' fc-prev-last';
650 ret[5].cls += ' fc-last';
657 cls: 'fc-border-separate',
658 style : 'width:100%',
666 cls : 'fc-first fc-last',
685 style : "position: relative;",
688 cls : 'fc-view fc-view-month fc-grid',
689 style : 'position: relative',
693 cls : 'fc-event-container',
694 style : 'position:absolute;z-index:8;top:0;left:0;'
712 initEvents : function()
715 throw "can not find store for calendar";
721 style: "text-align:center",
725 style: "background-color:white;width:50%;margin:250 auto",
729 src: Roo.rootURL + '/images/ux/lightbox/loading.gif'
740 this.maskEl = Roo.DomHelper.append(this.el.select('.fc-content', true).first(), mark, true);
742 var size = this.el.select('.fc-content', true).first().getSize();
743 this.maskEl.setSize(size.width, size.height);
744 this.maskEl.enableDisplayMode("block");
749 this.store = Roo.factory(this.store, Roo.data);
750 this.store.on('load', this.onLoad, this);
751 this.store.on('beforeload', this.onBeforeLoad, this);
755 this.cells = this.el.select('.fc-day',true);
756 //Roo.log(this.cells);
757 this.textNodes = this.el.query('.fc-day-number');
758 this.cells.addClassOnOver('fc-state-hover');
760 this.el.select('.fc-button-prev',true).on('click', this.showPrevMonth, this);
761 this.el.select('.fc-button-next',true).on('click', this.showNextMonth, this);
762 this.el.select('.fc-button-today',true).on('click', this.showToday, this);
763 this.el.select('.fc-button',true).addClassOnOver('fc-state-hover');
765 this.on('monthchange', this.onMonthChange, this);
767 this.update(new Date().clearTime());
770 resize : function() {
771 var sz = this.el.getSize();
773 this.el.select('.fc-day-header',true).setWidth(sz.width / 7);
774 this.el.select('.fc-day-content div',true).setHeight(34);
779 showPrevMonth : function(e){
780 this.update(this.activeDate.add("mo", -1));
782 showToday : function(e){
783 this.update(new Date().clearTime());
786 showNextMonth : function(e){
787 this.update(this.activeDate.add("mo", 1));
791 showPrevYear : function(){
792 this.update(this.activeDate.add("y", -1));
796 showNextYear : function(){
797 this.update(this.activeDate.add("y", 1));
802 update : function(date)
804 var vd = this.activeDate;
805 this.activeDate = date;
806 // if(vd && this.el){
807 // var t = date.getTime();
808 // if(vd.getMonth() == date.getMonth() && vd.getFullYear() == date.getFullYear()){
809 // Roo.log('using add remove');
811 // this.fireEvent('monthchange', this, date);
813 // this.cells.removeClass("fc-state-highlight");
814 // this.cells.each(function(c){
815 // if(c.dateValue == t){
816 // c.addClass("fc-state-highlight");
817 // setTimeout(function(){
818 // try{c.dom.firstChild.focus();}catch(e){}
828 var days = date.getDaysInMonth();
830 var firstOfMonth = date.getFirstDateOfMonth();
831 var startingPos = firstOfMonth.getDay()-this.startDay;
833 if(startingPos < this.startDay){
837 var pm = date.add(Date.MONTH, -1);
838 var prevStart = pm.getDaysInMonth()-startingPos;
840 this.cells = this.el.select('.fc-day',true);
841 this.textNodes = this.el.query('.fc-day-number');
842 this.cells.addClassOnOver('fc-state-hover');
844 var cells = this.cells.elements;
845 var textEls = this.textNodes;
847 Roo.each(cells, function(cell){
848 cell.removeClass([ 'fc-past', 'fc-other-month', 'fc-future', 'fc-state-highlight', 'fc-state-disabled']);
853 // convert everything to numbers so it's fast
855 var d = (new Date(pm.getFullYear(), pm.getMonth(), prevStart)).clearTime();
858 //Roo.log(prevStart);
860 var today = new Date().clearTime().getTime();
861 var sel = date.clearTime().getTime();
862 var min = this.minDate ? this.minDate.clearTime() : Number.NEGATIVE_INFINITY;
863 var max = this.maxDate ? this.maxDate.clearTime() : Number.POSITIVE_INFINITY;
864 var ddMatch = this.disabledDatesRE;
865 var ddText = this.disabledDatesText;
866 var ddays = this.disabledDays ? this.disabledDays.join("") : false;
867 var ddaysText = this.disabledDaysText;
868 var format = this.format;
870 var setCellClass = function(cal, cell){
874 //Roo.log('set Cell Class');
882 cell.className += " fc-today";
883 cell.className += " fc-state-highlight";
884 cell.title = cal.todayText;
887 // disable highlight in other month..
888 //cell.className += " fc-state-highlight";
893 cell.className = " fc-state-disabled";
894 cell.title = cal.minText;
898 cell.className = " fc-state-disabled";
899 cell.title = cal.maxText;
903 if(ddays.indexOf(d.getDay()) != -1){
904 cell.title = ddaysText;
905 cell.className = " fc-state-disabled";
908 if(ddMatch && format){
909 var fvalue = d.dateFormat(format);
910 if(ddMatch.test(fvalue)){
911 cell.title = ddText.replace("%0", fvalue);
912 cell.className = " fc-state-disabled";
916 if (!cell.initialClassName) {
917 cell.initialClassName = cell.dom.className;
920 cell.dom.className = cell.initialClassName + ' ' + cell.className;
925 for(; i < startingPos; i++) {
926 textEls[i].innerHTML = (++prevStart);
927 d.setDate(d.getDate()+1);
929 cells[i].className = "fc-past fc-other-month";
930 setCellClass(this, cells[i]);
935 for(; i < days; i++){
936 intDay = i - startingPos + 1;
937 textEls[i].innerHTML = (intDay);
938 d.setDate(d.getDate()+1);
940 cells[i].className = ''; // "x-date-active";
941 setCellClass(this, cells[i]);
946 textEls[i].innerHTML = (++extraDays);
947 d.setDate(d.getDate()+1);
949 cells[i].className = "fc-future fc-other-month";
950 setCellClass(this, cells[i]);
953 this.el.select('.fc-header-title h2',true).update(Date.monthNames[date.getMonth()] + " " + date.getFullYear());
955 var totalRows = Math.ceil((date.getDaysInMonth() + date.getFirstDateOfMonth().getDay()) / 7);
957 this.el.select('tr.fc-week.fc-prev-last',true).removeClass('fc-last');
958 this.el.select('tr.fc-week.fc-next-last',true).addClass('fc-last').show();
961 this.el.select('tr.fc-week.fc-last',true).removeClass('fc-last').addClass('fc-next-last').hide();
962 this.el.select('tr.fc-week.fc-prev-last',true).addClass('fc-last');
965 this.fireEvent('monthchange', this, date);
969 if(!this.internalRender){
970 var main = this.el.dom.firstChild;
971 var w = main.offsetWidth;
972 this.el.setWidth(w + this.el.getBorderWidth("lr"));
973 Roo.fly(main).setWidth(w);
974 this.internalRender = true;
975 // opera does not respect the auto grow header center column
976 // then, after it gets a width opera refuses to recalculate
977 // without a second pass
978 if(Roo.isOpera && !this.secondPass){
979 main.rows[0].cells[1].style.width = (w - (main.rows[0].cells[0].offsetWidth+main.rows[0].cells[2].offsetWidth)) + "px";
980 this.secondPass = true;
981 this.update.defer(10, this, [date]);
988 findCell : function(dt) {
989 dt = dt.clearTime().getTime();
991 this.cells.each(function(c){
992 //Roo.log("check " +c.dateValue + '?=' + dt);
993 if(c.dateValue == dt){
1003 findCells : function(ev) {
1004 var s = ev.start.clone().clearTime().getTime();
1006 var e= ev.end.clone().clearTime().getTime();
1009 this.cells.each(function(c){
1010 ////Roo.log("check " +c.dateValue + '<' + e + ' > ' + s);
1012 if(c.dateValue > e){
1015 if(c.dateValue < s){
1024 // findBestRow: function(cells)
1028 // for (var i =0 ; i < cells.length;i++) {
1029 // ret = Math.max(cells[i].rows || 0,ret);
1036 addItem : function(ev)
1038 // look for vertical location slot in
1039 var cells = this.findCells(ev);
1041 // ev.row = this.findBestRow(cells);
1043 // work out the location.
1047 for(var i =0; i < cells.length; i++) {
1049 cells[i].row = cells[0].row;
1052 cells[i].row = cells[i].row + 1;
1062 if (crow.start.getY() == cells[i].getY()) {
1064 crow.end = cells[i];
1081 cells[0].events.push(ev);
1083 this.calevents.push(ev);
1086 clearEvents: function() {
1088 if(!this.calevents){
1092 Roo.each(this.cells.elements, function(c){
1098 Roo.each(this.calevents, function(e) {
1099 Roo.each(e.els, function(el) {
1100 el.un('mouseenter' ,this.onEventEnter, this);
1101 el.un('mouseleave' ,this.onEventLeave, this);
1106 Roo.each(Roo.select('.fc-more-event', true).elements, function(e){
1112 renderEvents: function()
1116 this.cells.each(function(c) {
1125 if(c.row != c.events.length){
1126 r = 4 - (4 - (c.row - c.events.length));
1129 c.events = ev.slice(0, r);
1130 c.more = ev.slice(r);
1132 if(c.more.length && c.more.length == 1){
1133 c.events.push(c.more.pop());
1136 c.row = (c.row - ev.length) + c.events.length + ((c.more.length) ? 1 : 0);
1140 this.cells.each(function(c) {
1142 c.select('.fc-day-content div',true).first().setHeight(Math.max(34, c.row * 20));
1145 for (var e = 0; e < c.events.length; e++){
1146 var ev = c.events[e];
1149 for(var i = 0; i < rows.length; i++) {
1151 // how many rows should it span..
1154 cls : 'roo-dynamic fc-event fc-event-hori fc-event-draggable ui-draggable',
1155 style : 'position: absolute', // left: 387px; width: 121px; top: 359px;
1157 unselectable : "on",
1160 cls: 'fc-event-inner',
1164 // cls: 'fc-event-time',
1165 // html : cells.length > 1 ? '' : ev.time
1169 cls: 'fc-event-title',
1170 html : String.format('{0}', ev.title)
1177 cls: 'ui-resizable-handle ui-resizable-e',
1178 html : '  '
1185 cfg.cls += ' fc-event-start';
1187 if ((i+1) == rows.length) {
1188 cfg.cls += ' fc-event-end';
1191 var ctr = _this.el.select('.fc-event-container',true).first();
1192 var cg = ctr.createChild(cfg);
1194 var sbox = rows[i].start.select('.fc-day-content',true).first().getBox();
1195 var ebox = rows[i].end.select('.fc-day-content',true).first().getBox();
1197 var r = (c.more.length) ? 1 : 0;
1198 cg.setXY([sbox.x +2, sbox.y + ((c.row - c.events.length - r + e) * 20)]);
1199 cg.setWidth(ebox.right - sbox.x -2);
1201 cg.on('mouseenter' ,_this.onEventEnter, _this, ev);
1202 cg.on('mouseleave' ,_this.onEventLeave, _this, ev);
1203 cg.on('click', _this.onEventClick, _this, ev);
1214 cls : 'fc-more-event roo-dynamic fc-event fc-event-hori fc-event-draggable ui-draggable fc-event-start fc-event-end',
1215 style : 'position: absolute',
1216 unselectable : "on",
1219 cls: 'fc-event-inner',
1223 cls: 'fc-event-title',
1231 cls: 'ui-resizable-handle ui-resizable-e',
1232 html : '  '
1238 var ctr = _this.el.select('.fc-event-container',true).first();
1239 var cg = ctr.createChild(cfg);
1241 var sbox = c.select('.fc-day-content',true).first().getBox();
1242 var ebox = c.select('.fc-day-content',true).first().getBox();
1244 cg.setXY([sbox.x +2, sbox.y +((c.row - 1) * 20)]);
1245 cg.setWidth(ebox.right - sbox.x -2);
1247 cg.on('click', _this.onMoreEventClick, _this, c.more);
1257 onEventEnter: function (e, el,event,d) {
1258 this.fireEvent('evententer', this, el, event);
1261 onEventLeave: function (e, el,event,d) {
1262 this.fireEvent('eventleave', this, el, event);
1265 onEventClick: function (e, el,event,d) {
1266 this.fireEvent('eventclick', this, el, event);
1269 onMonthChange: function () {
1273 onMoreEventClick: function(e, el, more)
1277 this.calpopover.placement = 'right';
1278 this.calpopover.setTitle('More');
1280 this.calpopover.setContent('');
1282 var ctr = this.calpopover.el.select('.popover-content', true).first();
1284 Roo.each(more, function(m){
1286 cls : 'fc-event-hori fc-event-draggable',
1289 var cg = ctr.createChild(cfg);
1291 cg.on('click', _this.onEventClick, _this, m);
1294 this.calpopover.show(el);
1301 this.calevents = [];
1304 if(this.store.getCount() > 0){
1305 this.store.data.each(function(d){
1308 start: (typeof(d.data.start_dt) === 'string') ? new Date.parseDate(d.data.start_dt, 'Y-m-d H:i:s') : d.data.start_dt,
1309 end : (typeof(d.data.end_dt) === 'string') ? new Date.parseDate(d.data.end_dt, 'Y-m-d H:i:s') : d.data.end_dt,
1310 time : d.data.start_time,
1311 title : d.data.title,
1312 description : d.data.description,
1313 venue : d.data.venue
1318 this.renderEvents();
1320 if(this.calevents.length && this.loadMask){
1325 onBeforeLoad: function()
1338 * based on jquery fullcalendar
1344 * @class Roo.Calendar
1345 * @extends Roo.Component
1346 * Bootstrap Calendar class
1349 * Create a new Container
1350 * @param {Object} config The config object
1353 Roo.CalendarPanel = function(config){
1355 Roo.log("cal panel ctr");
1357 this.wrapper = Roo.DomHelper.append(document.body, // wrapper for IE7 strict & safari scroll issue
1358 {tag: "div", cls: "x-layout-grid-wrapper x-layout-inactive-content"}, true);
1360 //this.wrapper.dom.appendChild(grid.getGridEl().dom);
1362 Roo.CalendarPanel.superclass.constructor.call(this, this.wrapper, config);
1367 this.toolbar.el.insertBefore(this.wrapper.dom.firstChild);
1369 // xtype created footer. - not sure if will work as we normally have to render first..
1370 if (this.footer && !this.footer.el && this.footer.xtype) {
1372 //this.footer.container = this.grid.getView().getFooterPanel(true);
1373 //this.footer.dataSource = this.grid.dataSource;
1374 //this.footer = Roo.factory(this.footer, Roo);
1377 this.view = new Roo.calendar.View(Roo.apply({
1378 skipNavHeader : true,
1379 skipMonthHeader : false
1384 this.on('activate', function()
1386 Roo.log('activate');
1388 //console.log('render tree');
1395 * Fires when a date is selected
1396 * @param {DatePicker} this
1397 * @param {Date} date The selected date
1401 * @event monthchange
1402 * Fires when the displayed month changes
1403 * @param {DatePicker} this
1404 * @param {Date} date The selected month
1406 'monthchange': true,
1409 * Fires when mouse over an event
1410 * @param {Calendar} this
1411 * @param {event} Event
1416 * Fires when the mouse leaves an
1417 * @param {Calendar} this
1423 * Fires when the mouse click an
1424 * @param {Calendar} this
1430 * Fires when the grid is rendered
1431 * @param {Calendar} this
1438 this.relayEvents(this.view, ["select","monthchange","evententer","eventleave","rendered"]);
1441 //this.grid.getGridEl().replaceClass("x-layout-inactive-content", "x-layout-component-panel");
1445 Roo.extend(Roo.CalendarPanel, Roo.ContentPanel, {
1450 var ct = this.el.appendChild(document.createElement("div"));
1451 this.onRender(this.el, false)
1454 onRender : function(ct, position)
1456 if (this.rendered) {
1459 this.rendered = true;
1461 Roo.log("render calendar");
1464 //Roo.bootstrap.Component.superclass.onRender.call(this, ct, position);
1467 var cfg = Roo.apply({}, this.view.getAutoCreate());
1470 // fill in the extra attributes
1471 if (this.xattr && typeof(this.xattr) =='object') {
1472 for (var i in this.xattr) {
1473 cfg[i] = this.xattr[i];
1478 cfg.dataId = this.dataId;
1482 cfg.cls = (typeof(cfg.cls) == 'undefined') ? this.cls : cfg.cls + ' ' + this.cls;
1485 if (this.style) { // fixme needs to support more complex style data.
1486 cfg.style = this.style;
1490 cfg.name = this.name;
1493 this.view.el = ct.createChild(cfg, position);
1495 //if(this.tabIndex !== undefined){
1496 // this.el.dom.setAttribute('tabIndex', this.tabIndex);
1500 this.view.initEvents();
1501 this.fireEvent('rendered');