Author: pyaschenko
Date: 2007-08-31 08:14:57 -0400 (Fri, 31 Aug 2007)
New Revision: 2645
Modified:
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js
trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
Log:
RF-788 fixed
RF-695 fixed
Modified:
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js
===================================================================
---
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2007-08-31
11:41:11 UTC (rev 2644)
+++
trunk/framework/impl/src/main/resources/org/richfaces/renderkit/html/scripts/utils.js 2007-08-31
12:14:57 UTC (rev 2645)
@@ -147,7 +147,10 @@
}
}
-Richfaces.browser={isIE6: (!window.opera &&
/MSIE\s*[6][\d,\.]+;/.test(navigator.userAgent))};
+Richfaces.browser= {
+ isIE6: (!window.opera && /MSIE\s*[6][\d,\.]+;/.test(navigator.userAgent)),
+ isSafari: /Safari/.test(navigator.userAgent)
+};
Richfaces.eval = function(template, object) {
var value = '';
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-08-31
11:41:11 UTC (rev 2644)
+++
trunk/ui/calendar/src/main/resources/org/richfaces/renderkit/html/scripts/calendar.js 2007-08-31
12:14:57 UTC (rev 2645)
@@ -6,6 +6,7 @@
throw("calendar.js requires including script.aculo.us' effects.js
library");
if (!window.Richfaces) window.Richfaces={};
+
Richfaces.Calendar={};
Richfaces.Calendar.setElementPosition = function(element, baseElement, jointPoint,
direction, offset)
{
@@ -549,6 +550,14 @@
if (this.invokeEvent("collapse", element))
{
+ Event.stopObserving(window.document, "click", this.eventOnCollapse, false);
+
+ if (this.eventOnCollapseFlag)
+ {
+ Event.stopObserving(window.document, "click", this.eventOnCollapse,
false);
+ this.eventOnCollapseFlag = false;
+ }
+
if (Richfaces.browser.isIE6) Element.hide(this.IFRAME_ID);
Element.hide(element);
this.isVisible = false;
@@ -573,9 +582,6 @@
var iframe = $(this.IFRAME_ID);
- var a = this;
- setTimeout(function () { Event.observe(window.document, "click",
a.eventOnCollapse, false); }, 50);
-
/*this.setPopupEvents(e);
this.setPopupEvents(base);*/
@@ -610,13 +616,25 @@
Element.show(element);
this.isVisible = true;
+
+ Event.observe(window.document, "click", this.eventOnCollapse, false);
}
},
doSwitch: function() {
- this.isVisible ? this.doCollapse() : this.doExpand();
+ this.isVisible ? this.doCollapse() : this.doExpand();
},
+ eventOnCollapse: function (e) {
+ if (Event.element(e).id == this.POPUP_BUTTON_ID) return true;
+
+ Position.prepare();
+ if (Position.withinIncludingScrolloffsets($(this.id), Event.pointerX(e),
Event.pointerY(e))) return true;
+ this.doCollapse();
+
+ return true;
+ },
+
getWeekDayComponentId: function (v) {
return this.id+"WeekDay"+v;
},
@@ -637,7 +655,7 @@
},
getSelectedDateString: function(pattern) {
if (!this.selectedDate) return "";
- if (!pattern) pattern = "dd/MM/y";
+ if (!pattern) pattern = "dd/MM/yyyy";
return this.selectedDate.format(pattern, this.params.monthLabels,
this.params.monthLabelsShort);
},
@@ -689,13 +707,6 @@
//this.eventOnMouseOut = this.eventOnMouseOut.bindAsEventListener(this);
},
- eventOnCollapse: function (e) {
- Position.prepare();
- if (Position.withinIncludingScrolloffsets($(this.id), Event.pointerX(e),
Event.pointerY(e))) return;
- Event.stopObserving(window.document, "click", this.eventOnCollapse, false);
- this.doCollapse();
- },
-
/* setPopupEvents: function(obj) {
Event.observe(obj, "mouseover", this.eventOnMouseOver, false);
Event.observe(obj, "mouseout", this.eventOnMouseOut, false);
@@ -1032,7 +1043,23 @@
if (todayflag && dataobj._month==0 && dataobj.day==todaydate)
{
this.todayCellId = element.id;
- this.todayCellColor = Element.getStyle(element,
'background-color').parseColor();
+
+ if (Richfaces.browser.isSafari && this.params.popup &&
!this.isVisible)
+ {
+ // Safari 2.0 fix
+ // if [display:none] Element.getStyle() function returns null;
+ var els = $(this.id).style;
+ var originalVisibility = els.visibility;
+ var originalDisplay = els.display;
+ els.visibility = 'hidden';
+ els.display = '';
+ this.todayCellColor = Element.getStyle(element,
'background-color').parseColor();
+ els.display = originalDisplay;
+ els.visibility = originalVisibility;
+ } else
+ {
+ this.todayCellColor = Element.getStyle(element,
'background-color').parseColor();
+ }
e.add("rich-calendar-today");
}
else
Modified: trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx
===================================================================
--- trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-08-31
11:41:11 UTC (rev 2644)
+++ trunk/ui/calendar/src/main/templates/org/richfaces/htmlCalendar.jspx 2007-08-31
12:14:57 UTC (rev 2645)
@@ -150,7 +150,7 @@
src="#{icon}"
accesskey="#{component.attributes['accesskey']}"
name="#{clientId}"
- onclick="$('#{clientId}').component.doExpand();return false;"
+ onclick="$('#{clientId}').component.doSwitch();return true;"
style="vertical-align: middle"
tabindex="#{component.attributes['tabindex']}">
</img>