Author: pyaschenko
Date: 2007-10-31 10:16:27 -0400 (Wed, 31 Oct 2007)
New Revision: 3635
Modified:
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
Log:
markup refactoring in progress
Modified:
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
===================================================================
---
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-10-31
14:08:03 UTC (rev 3634)
+++
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-10-31
14:16:27 UTC (rev 3635)
@@ -424,7 +424,12 @@
// isDayEnabled - end-developer JS function
// dayStyleClass - end-developer JS function that provide style class for day's
cells.
+ // dayCellClass - add div to day cell with class 'rich-calendar-cell-div' and
add this class to TD if defined
+ // style - table style
+ // className - table class
+
+
this.id = id;
this.params = parameters;
if (!this.params.showWeekDaysBar) this.params.showWeekDaysBar = true;
@@ -479,10 +484,21 @@
this.selectedDateCellColor = "";
var obj=$(id);
+ var span=$(this.POPUP_ID);
+ var popupStyles = "";
+ this.isVisible = true;
+ if (this.params.popup==true)
+ {
+ // popup mode initialisation
+ popupStyles = "display:none; position:absolute;"
+ this.isVisible = false;
+ }
+
var htmlTextHeader = (!this.params.popup ? '<input
id="'+this.INPUT_DATE_ID+'"
name="'+this.INPUT_DATE_ID+'" type="hidden"
style="display:none"
value="'+this.getSelectedDateString(this.params.datePattern)+'"/>\n'
: '') +
'<input id="'+this.id+'InputCurrentDate"
name="'+this.id+'InputCurrentDate" type="hidden"
style="display:none"
value="'+this.getCurrentDate().format("MM/yyyy")+'"/>\n'
+
- '<table border="0" cellpadding="0"
cellspacing="0"
class="rich-calendar-exterior"><tbody>\n';
+ (this.params.popup && Richfaces.browser.isIE6 ? '<iframe
src="javascript:\'\'" frameborder="0" scrolling="no"
id="' + this.IFRAME_ID + '" style="display:none; position:
absolute; width: 1px; height: 1px;
background-color:white;">'+'</iframe>\n' : '' )+
+ '<table id="'+this.id+'" border="0"
cellpadding="0" cellspacing="0" class="rich-calendar-exterior
rich-calendar-popup'+(this.params.className ? ' '+this.params.className :
'')+'"
style="'+popupStyles+this.params.style+'"><tbody>\n';
var colspan = (this.params.showWeeksBar ? "8" : "7");
var htmlHeaderOptional = (this.params.optionalHeaderMarkup) ? '<tr><td
class="rich-calendar-header-optional" colspan="'+colspan+'"
id="'+this.id+'HeaderOptional"></td></tr>' :
'';
var htmlFooterOptional = (this.params.optionalFooterMarkup) ? '<tr><td
class="rich-calendar-footer-optional" colspan="'+colspan+'"
id="'+this.id+'FooterOptional"></td></tr>' :
'';
@@ -491,24 +507,6 @@
var htmlTextFooter = '</tbody></table>\n'
var htmlTextIFrame = '';
- this.isVisible = true;
- if (this.params.popup==true)
- {
- // popup mode initialisation
- var e = $(this.id);
- if (e)
- {
- e.style.display='none';
- e.style.position = 'absolute';
- this.isVisible = false;
- if (Richfaces.browser.isIE6)
- {
- new Insertion.Before(obj,'<iframe src="javascript:\'\'"
frameborder="0" scrolling="no" id="' + this.IFRAME_ID +
'"' +
- 'style="display:none; position: absolute; width: 1px; height: 1px;
background-color:white;">'+'</iframe>');
- }
- }
- }
-
// days bar creation
var styleClass;
var bottomStyleClass;
@@ -564,10 +562,11 @@
htmlTextWeek+='</tr>';
}
+ //obj.innerHTML =
htmlTextIFrame+htmlTextHeader+htmlHeaderOptional+htmlControlsHeader+htmlTextWeekDayBar+htmlTextWeek+htmlControlsFooter+htmlFooterOptional+htmlTextFooter;
+ new
Insertion.After(span,htmlTextIFrame+htmlTextHeader+htmlHeaderOptional+htmlControlsHeader+htmlTextWeekDayBar+htmlTextWeek+htmlControlsFooter+htmlFooterOptional+htmlTextFooter);
// set content
obj.component = this;
obj.richfacesComponent="richfaces:calendar";
- obj.innerHTML =
htmlTextIFrame+htmlTextHeader+htmlHeaderOptional+htmlControlsHeader+htmlTextWeekDayBar+htmlTextWeek+htmlControlsFooter+htmlFooterOptional+htmlTextFooter;
if(this.params.submitFunction) this.submitFunction =
this.params.submitFunction.bind(this);
this.prepareEvents();
@@ -603,9 +602,26 @@
this.eventOnCollapseFlag = false;
}
- if (Richfaces.browser.isIE6) Element.hide(this.IFRAME_ID);
+ var iframe=null;
+ if (Richfaces.browser.isIE6) iframe = $(this.IFRAME_ID);
+ if (iframe) Element.hide(iframe);
+
Element.hide(element);
this.isVisible = false;
+
+ /*if (this.floatedToBody && this.parent)
+ {
+ if (iframe)
+ {
+ document.body.removeChild(iframe);
+ this.parent.appendChild(iframe);
+ }
+ document.body.removeChild(element);
+ this.parent.appendChild(element);
+ this.floatedToBody = false;
+ this.parent = null;
+ }*/
+
}
},
@@ -616,6 +632,17 @@
if (this.invokeEvent("expand", element))
{
+
+ var iframe=null;
+ if (Richfaces.browser.isIE6) iframe = $(this.IFRAME_ID);
+
+ /*if (!this.floatedToBody) {
+ this.parent = element.parentNode;
+ if (iframe) document.body.insertBefore(this.parent.removeChild(iframe), null);
+ document.body.insertBefore(this.parent.removeChild(element), null);
+ this.floatedToBody = true;
+ }*/
+
var base = $(this.POPUP_ID)
var baseInput = base.firstChild;
var baseButton = baseInput.nextSibling;
@@ -625,8 +652,6 @@
this.selectDate(baseInput.value);
}
- var iframe = $(this.IFRAME_ID);
-
/*this.setPopupEvents(e);
this.setPopupEvents(base);*/
@@ -652,7 +677,7 @@
Richfaces.Calendar.setElementPosition(element, o, this.params.jointPoint,
this.params.direction, this.popupOffset);
- if (Richfaces.browser.isIE6)
+ if (iframe)
{
iframe.style.left = element.style.left;
iframe.style.top = element.style.top;
@@ -1513,7 +1538,7 @@
]
)];
-CalendarView.dayList = [new ET(function (context) { return context.day})];
+CalendarView.dayList = [new
E('div',{'style':'overflow:hidden;width:100%;height:100%;'},[new
ET(function (context) { return context.day})])];
CalendarView.weekNumber = [new ET(function (context) { return context.weekNumber})];
CalendarView.weekDay = [new ET(function (context) { return context.weekDayLabelShort})];
Show replies by date