зеркало из https://github.com/mozilla/pjs.git
Fixing bug 167653, datepicker should show the proper start date.
This commit is contained in:
Родитель
05210aefaf
Коммит
d139b1461b
|
@ -76,6 +76,7 @@ calendar {
|
||||||
.cal-header {
|
.cal-header {
|
||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
color: blue;
|
color: blue;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cal-row-body {
|
.cal-row-body {
|
||||||
|
@ -85,6 +86,7 @@ calendar {
|
||||||
font-family: Arial;
|
font-family: Arial;
|
||||||
color: #000000;
|
color: #000000;
|
||||||
border: 1px solid transparent;
|
border: 1px solid transparent;
|
||||||
|
text-align: center;
|
||||||
-moz-binding: url("calendar.xml#cal-day");
|
-moz-binding: url("calendar.xml#cal-day");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,13 +20,13 @@
|
||||||
</xul:hbox>
|
</xul:hbox>
|
||||||
<xul:vbox class="cal-cal-box" flex="1">
|
<xul:vbox class="cal-cal-box" flex="1">
|
||||||
<xul:hbox class="cal-row-head" equalsize="always">
|
<xul:hbox class="cal-row-head" equalsize="always">
|
||||||
<xul:text class="cal-header" flex="1" value="S"/>
|
<xul:text class="cal-header" flex="1"/>
|
||||||
<xul:text class="cal-header" flex="1" value="M"/>
|
<xul:text class="cal-header" flex="1"/>
|
||||||
<xul:text class="cal-header" flex="1" value="T"/>
|
<xul:text class="cal-header" flex="1"/>
|
||||||
<xul:text class="cal-header" flex="1" value="W"/>
|
<xul:text class="cal-header" flex="1"/>
|
||||||
<xul:text class="cal-header" flex="1" value="T"/>
|
<xul:text class="cal-header" flex="1"/>
|
||||||
<xul:text class="cal-header" flex="1" value="F"/>
|
<xul:text class="cal-header" flex="1"/>
|
||||||
<xul:text class="cal-header" flex="1" value="S"/>
|
<xul:text class="cal-header" flex="1"/>
|
||||||
</xul:hbox>
|
</xul:hbox>
|
||||||
<xul:hbox class="cal-row-body" equalsize="always" flex="1">
|
<xul:hbox class="cal-row-body" equalsize="always" flex="1">
|
||||||
<xul:text class="cal-day" flex="1" />
|
<xul:text class="cal-day" flex="1" />
|
||||||
|
@ -102,6 +102,19 @@
|
||||||
if (!this.mInitialized) {
|
if (!this.mInitialized) {
|
||||||
this.mInitialized = true;
|
this.mInitialized = true;
|
||||||
|
|
||||||
|
// Find out which should be the first day of the week
|
||||||
|
var pref = Components.classes[
|
||||||
|
"@mozilla.org/preferences-service;1"
|
||||||
|
].getService(Components.interfaces.nsIPrefBranch);
|
||||||
|
|
||||||
|
this.weekStart;
|
||||||
|
try {
|
||||||
|
this.weekStart = pref.getIntPref("calendar.week.start");
|
||||||
|
}
|
||||||
|
catch (e) {
|
||||||
|
this.weekStart = 0;
|
||||||
|
}
|
||||||
|
|
||||||
// save references for convenience
|
// save references for convenience
|
||||||
var monthbox = document.getAnonymousNodes(this)[0].childNodes[0];
|
var monthbox = document.getAnonymousNodes(this)[0].childNodes[0];
|
||||||
this.mLeftBtn = monthbox.childNodes[0];
|
this.mLeftBtn = monthbox.childNodes[0];
|
||||||
|
@ -119,11 +132,50 @@
|
||||||
var monthchange = this.getAttribute("onmonthchange");
|
var monthchange = this.getAttribute("onmonthchange");
|
||||||
if (monthchange) this.onmonthchange = new Function(monthchange);
|
if (monthchange) this.onmonthchange = new Function(monthchange);
|
||||||
|
|
||||||
|
this.setHeader();
|
||||||
this.showMonth(this.mValue);
|
this.showMonth(this.mValue);
|
||||||
}
|
}
|
||||||
]]>
|
]]>
|
||||||
</constructor>
|
</constructor>
|
||||||
|
|
||||||
|
<method name="setHeader">
|
||||||
|
<body><![CDATA[
|
||||||
|
// need to create string bundle manually instead of
|
||||||
|
// using <xul:stringbundle/> see bug 63370 for details
|
||||||
|
|
||||||
|
var localeService = Components.classes[
|
||||||
|
"@mozilla.org/intl/nslocaleservice;1"
|
||||||
|
].getService(Components.interfaces.nsILocaleService);
|
||||||
|
|
||||||
|
var stringBundleService = Components.classes[
|
||||||
|
"@mozilla.org/intl/stringbundle;1"
|
||||||
|
].getService(Components.interfaces.nsIStringBundleService);
|
||||||
|
|
||||||
|
var bundleURL = "chrome://calendar/locale/dateFormat.properties";
|
||||||
|
var dateBundle = stringBundleService.createBundle(
|
||||||
|
bundleURL, localeService.GetApplicationLocale()
|
||||||
|
);
|
||||||
|
|
||||||
|
// Reset the headers
|
||||||
|
var header = document.getAnonymousNodes(this)[0].
|
||||||
|
childNodes[1].childNodes[0]
|
||||||
|
;
|
||||||
|
|
||||||
|
for (var column = 0; column < header.childNodes.length; column++) {
|
||||||
|
|
||||||
|
header.childNodes[column].setAttribute( "value",
|
||||||
|
dateBundle.GetStringFromName(
|
||||||
|
"day."+
|
||||||
|
((this.weekStart + column) % 7 + 1) +
|
||||||
|
".short"
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
]]></body>
|
||||||
|
</method>
|
||||||
|
|
||||||
|
|
||||||
<method name="showMonth">
|
<method name="showMonth">
|
||||||
<parameter name="aDate"/>
|
<parameter name="aDate"/>
|
||||||
<body><![CDATA[
|
<body><![CDATA[
|
||||||
|
@ -149,7 +201,7 @@
|
||||||
var calbox = document.getAnonymousNodes(this)[0].childNodes[1];
|
var calbox = document.getAnonymousNodes(this)[0].childNodes[1];
|
||||||
|
|
||||||
var daytime = 86400000; // milliseconds in a day
|
var daytime = 86400000; // milliseconds in a day
|
||||||
var firstWeekday = aDate.getDay();
|
var firstWeekday = (7 + aDate.getDay() - this.weekStart) % 7;
|
||||||
var date = new Date((aDate.getTime() - (firstWeekday*daytime)));
|
var date = new Date((aDate.getTime() - (firstWeekday*daytime)));
|
||||||
|
|
||||||
for (var k = 1; k < calbox.childNodes.length; k++) {
|
for (var k = 1; k < calbox.childNodes.length; k++) {
|
||||||
|
|
|
@ -79,5 +79,14 @@ day.5.Mmm=Thu
|
||||||
day.6.Mmm=Fri
|
day.6.Mmm=Fri
|
||||||
day.7.Mmm=Sat
|
day.7.Mmm=Sat
|
||||||
|
|
||||||
|
# Can someone tell me why were not counting from zero?
|
||||||
|
day.1.short=S
|
||||||
|
day.2.short=M
|
||||||
|
day.3.short=T
|
||||||
|
day.4.short=W
|
||||||
|
day.5.short=T
|
||||||
|
day.6.short=F
|
||||||
|
day.7.short=S
|
||||||
|
|
||||||
am-string=AM
|
am-string=AM
|
||||||
pm-string=PM
|
pm-string=PM
|
||||||
|
|
Загрузка…
Ссылка в новой задаче