New date picker

Removed the old popup calendar (Tigra) by an inline version
(bootstrap-datepicker). Also revamped the time picker and the dialog
boxes to fit the new look.
This commit is contained in:
Francis Lachapelle
2012-09-21 22:05:07 -04:00
parent 0181ec606d
commit b15234c26e
19 changed files with 1348 additions and 620 deletions
@@ -10,7 +10,8 @@
className="UIxPageFrame"
title="title"
const:popup="YES"
const:jsFiles="RowEditionController.js,PasswordPolicy.js,ckeditor/ckeditor.js,skycalendar.js"
const:cssFiles="datepicker.css"
const:jsFiles="RowEditionController.js,PasswordPolicy.js,ckeditor/ckeditor.js,datepicker.js"
>
<script type="text/javascript">
var localeCode = '<var:string value="localeCode"/>';
@@ -418,14 +419,14 @@
<label class="timeDate"><input var:checked="enableVacationEndDate"
const:name="enableVacationEndDate" const:id="enableVacationEndDate" type="checkbox" class="checkBox"
/><var:string label:value="Disable auto reply on" /><var:component className="UIxTimeDateControl"
/><var:string label:value="Disable auto reply on" /></label><var:component className="UIxTimeDateControl"
const:displayTimeControl="0"
var:disabled="disableVacationEndDate"
const:controlID="vacationEndDate"
date="vacationEndDate"
const:dayStartHour="0"
const:dayEndHour="23"
/></label>
/>
</div>
</div>
@@ -10,7 +10,8 @@
className="UIxPageFrame"
const:toolbar="none"
const:popup="YES"
const:jsFiles="skycalendar.js,SOGoTimePicker.js">
const:cssFiles="datepicker.css,SOGoTimePicker.css"
const:jsFiles="datepicker.js,SOGoTimePicker.js">
<div class="popupMenu" id="attendeesMenu">
<ul><!-- space --></ul>
</div>
@@ -11,8 +11,8 @@
const:popup="YES"
title="name"
var:toolbar="toolbar"
const:cssFiles="UIxComponentEditor.css"
const:jsFiles="skycalendar.js,UIxComponentEditor.js,SOGoAutoCompletion.js,SOGoTimePicker.js">
const:cssFiles="datepicker.css,SOGoTimePicker.css,UIxComponentEditor.css"
const:jsFiles="datepicker.js,UIxComponentEditor.js,SOGoAutoCompletion.js,SOGoTimePicker.js">
<script type="text/javascript">
var activeCalendar = '<var:string value="componentCalendar.nameInContainer"/>';
+5 -5
View File
@@ -3,20 +3,20 @@
xmlns:var="http://www.skyrix.com/od/binding"
xmlns:const="http://www.skyrix.com/od/constant"
xmlns:rsrc="OGo:url"
class="datePicker"
class="datePicker date"
var:data-date-format="jsDateFormat"
var:data-date-weekstart="jsWeekStart"
><input type="text"
var:disabled="disabled"
class="textField"
var:name="dateID"
var:id="dateID"
var:dateFormat="jsDateFormat"
var:name="dateID"
var:shadow-value="formattedDateString"
var:value="formattedDateString"
size="12"
/><a href="#"
class="calendarButton"
class="calendarButton add-on"
var:inputId="dateID"
onclick="return popupCalendar(this);"
><span><img rsrc:src="choose-date.png"
var:title="label"
var:alt="label"
+134
View File
@@ -0,0 +1,134 @@
.SOGoTimePickerMenu
{ position: absolute;
z-index: 1000;
background-color: #fff;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
*border-right-width: 2px;
*border-bottom-width: 2px;
color: #000;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 11px;
line-height: 18px;
text-align: center; }
.SOGoTimePickerMenu > DIV
{ padding: 5px; }
.SOGoTimePickerMenu.bellow > DIV:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-bottom-color: rgba(0, 0, 0, 0.2);
position: absolute;
top: -7px;
left: 6px;
left: 35px;
}
.SOGoTimePickerMenu.bellow > DIV:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
position: absolute;
top: -6px;
left: 7px;
left: 36px;
}
.SOGoTimePickerMenu.above > DIV:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-top: 7px solid #ccc;
border-top-color: rgba(0, 0, 0, 0.2);
position: absolute;
bottom: -7px;
right: 35px;
}
.SOGoTimePickerMenu.above > DIV:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid #ffffff;
position: absolute;
bottom: -6px;
right: 36px;
}
.SOGoTimePickerMenu .hours,
.SOGoTimePickerMenu .minutes,
.SOGoTimePickerMenu .button
{ clear: both; /* Opera fix */ }
.SOGoTimePickerMenu SPAN DIV
{ padding: 2px; }
.SOGoTimePickerMenu DIV.hours SPAN
{ float: left;
width: 25px; }
.SOGoTimePickerMenu DIV.hours SPAN DIV
{ -webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px; }
.SOGoTimePickerMenu DIV.min5 SPAN
{ float: left;
width: 50px; }
.SOGoTimePickerMenu DIV.min1 SPAN
{ float: left;
width: 60px; }
.SOGoTimePickerMenu DIV.minutes SPAN DIV
{ -webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px; }
.SOGoTimePickerMenu DIV.hours SPAN DIV:hover,
.SOGoTimePickerMenu DIV.minutes SPAN DIV:hover
{ background-color: #eee;
color: #333;
cursor: pointer; }
.SOGoTimePickerMenu DIV.hours SPAN DIV.selected,
.SOGoTimePickerMenu DIV.minutes SPAN DIV.selected,
.SOGoTimePickerMenu DIV.hours SPAN DIV.selected:hover,
.SOGoTimePickerMenu DIV.minutes SPAN DIV.selected:hover
{ background-color: #006dcc;
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
background-image: linear-gradient(top, #0088cc, #0044cc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
border-color: #0044cc #0044cc #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25); }
.SOGoTimePickerMenu HR
{ clear: both;
height: 0px;
margin: 0px;
padding: 0px;
color: #fff;
border: 0px; }
+20 -3
View File
@@ -11,6 +11,8 @@ var SOGoTimePickerInterface = {
div: null,
extendedButton: null,
pos: 'bellow',
minutes: '00',
hours: '00',
@@ -21,7 +23,7 @@ var SOGoTimePickerInterface = {
bind: function () {
// Build widget
this.div = new Element("div", {'class': 'SOGoTimePickerMenu'});
this.div = new Element("div", {'class': 'SOGoTimePickerMenu ' + this.pos});
this.div.hide();
document.body.appendChild(this.div);
var inner = new Element("div");
@@ -99,6 +101,15 @@ var SOGoTimePickerInterface = {
this.onChange();
},
setPosition: function (newPos) {
if (newPos == 'bellow' || newPos == 'above') {
this.div.removeClassName(this.pos);
this.div.addClassName(newPos);
this.pos = newPos;
this.position();
}
},
position: function () {
var inputPosition = this.cumulativeOffset();
var inputDimensions = this.getDimensions();
@@ -107,10 +118,14 @@ var SOGoTimePickerInterface = {
var left = inputPosition[0];
var arrow = -1000 + inputDimensions['width'] - 10;
if (left + divWidth > windowWidth) {
left = windowWidth - divWidth - 2;
left = windowWidth - divWidth - 4;
arrow += (inputPosition[0] - left);
}
var top = inputPosition[1] + 12;
var top = inputPosition[1];
if (this.pos == 'bellow')
top += 22;
else
top -= this.div.getHeight();
this.div.setStyle({ top: top+"px",
left: left+"px",
backgroundPosition: arrow+'px top'});
@@ -143,6 +158,8 @@ var SOGoTimePickerInterface = {
this.div.select("DIV.min1").invoke('hide');
this.div.select("DIV.min5").invoke('show');
}
if (this.pos == 'above')
this.position();
},
toggleVisibility: function (event) {
+1 -1
View File
@@ -291,7 +291,7 @@ DIV#eventDialog
DIV#eventDialog H1,
DIV#eventDialog P
{ font-size: 10px;
{ font-size: 13px;
margin: 0;
padding: 0; }
+31 -16
View File
@@ -125,6 +125,8 @@ function onAttendeesMenuPrepareVisibility()
composeToUndecidedAttendees.addClassName("disabled");
else
composeToUndecidedAttendees.removeClassName("disabled");
return true;
}
function onComposeToAllAttendees()
@@ -264,8 +266,14 @@ function getShadowEndDate() {
}
function _setDate(which, newDate) {
window.timeWidgets[which]['date'].setInputAsDate(newDate);
window.timeWidgets[which]['time'].value = newDate.getDisplayHoursString();
if (newDate) {
window.timeWidgets[which]['date'].setInputAsDate(newDate);
window.timeWidgets[which]['time'].value = newDate.getDisplayHoursString();
}
// Update date picker
var dateComponent = jQuery(window.timeWidgets[which]['date']).closest('.date');
dateComponent.data('date', window.timeWidgets[which]['date'].value);
dateComponent.datepicker('update');
}
function setStartDate(newStartDate) {
@@ -283,14 +291,19 @@ function onAdjustTime(event) {
if ($(this).readAttribute("id").startsWith("start")) {
// Start date was changed
var delta = window.getShadowStartDate().valueOf() - startDate.valueOf();
var newEndDate = new Date(endDate.valueOf() - delta);
window.setEndDate(newEndDate);
window.setStartDate();
if (delta != 0) {
var newEndDate = new Date(endDate.valueOf() - delta);
window.setEndDate(newEndDate);
window.setStartDate();
window.timeWidgets['end']['date'].updateShadowValue();
window.timeWidgets['end']['time'].updateShadowValue();
window.timeWidgets['start']['date'].updateShadowValue();
window.timeWidgets['start']['time'].updateShadowValue();
if (window.timeWidgets['end']['time'].onChange) window.timeWidgets['end']['time'].onChange(); // method from SOGoTimePicker
window.timeWidgets['end']['date'].updateShadowValue();
window.timeWidgets['end']['time'].updateShadowValue();
window.timeWidgets['start']['date'].updateShadowValue();
window.timeWidgets['start']['time'].updateShadowValue();
if (window.timeWidgets['end']['time'].onChange)
window.timeWidgets['end']['time'].onChange(); // method from SOGoTimePicker
}
}
else {
// End date was changed
@@ -304,6 +317,9 @@ function onAdjustTime(event) {
window.timeWidgets['end']['time'].updateShadowValue();
window.timeWidgets['end']['time'].onChange(); // method from SOGoTimePicker
}
else {
window.setEndDate();
}
}
}
@@ -316,14 +332,16 @@ function initTimeWidgets(widgets) {
this.timeWidgets = widgets;
if (widgets['start']['date']) {
widgets['start']['date'].observe("change", this.onAdjustTime, false);
widgets['start']['time'].observe("time:change", this.onAdjustTime, false);
jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true});
jQuery(widgets['start']['date']).change(onAdjustTime);
widgets['start']['time'].on("time:change", onAdjustTime);
widgets['start']['time'].addInterface(SOGoTimePickerInterface);
}
if (widgets['end']['date']) {
widgets['end']['date'].observe("change", this.onAdjustTime, false);
widgets['end']['time'].observe("time:change", this.onAdjustTime, false);
jQuery(widgets['end']['date']).closest('.date').datepicker({autoclose: true});
jQuery(widgets['end']['date']).change(onAdjustTime);
widgets['end']['time'].on("time:change", onAdjustTime);
widgets['end']['time'].addInterface(SOGoTimePickerInterface);
}
@@ -484,9 +502,6 @@ function getMenus() {
function onAppointmentEditorLoad() {
if (readOnly == false) {
assignCalendar('startTime_date');
assignCalendar('endTime_date');
var widgets = {'start': {'date': $("startTime_date"),
'time': $("startTime_time")},
'end': {'date': $("endTime_date"),
@@ -282,74 +282,3 @@ SPAN.timeDateControl SELECT,
SPAN.timeDateControl SPAN,
DIV#freeBusyReplicas SPAN
{ vertical-align: top; }
/* SOGoTimePicker */
.SOGoTimePickerMenu
{ position: absolute;
z-index: 1000;
background-image: url("dialog-top.png");
background-repeat: no-repeat;
color: #000;
font-family: sans-serif;
font-size: 11px;
text-align: center; }
.SOGoTimePickerMenu > DIV
{ background-color: #fff;
border: 1px solid #444;
border-top: 0px;
margin-top: 19px;
padding: 5px; }
.SOGoTimePickerMenu .hours,
.SOGoTimePickerMenu .minutes,
.SOGoTimePickerMenu .button
{ clear: both; /* Opera fix */ }
.SOGoTimePickerMenu SPAN DIV
{ padding: 2px; }
.SOGoTimePickerMenu DIV.hours SPAN
{ float: left;
width: 25px; }
.SOGoTimePickerMenu DIV.hours SPAN DIV
{ background-color: #ddd;
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc; }
.SOGoTimePickerMenu DIV.min5 SPAN
{ float: left;
width: 50px; }
.SOGoTimePickerMenu DIV.min1 SPAN
{ float: left;
width: 60px; }
.SOGoTimePickerMenu DIV.minutes SPAN DIV
{ border-right: 1px solid #fff;
border-bottom: 1px solid #fff; }
.SOGoTimePickerMenu DIV.hours SPAN DIV:hover,
.SOGoTimePickerMenu DIV.minutes SPAN DIV:hover
{ background-color: #eee;
border-right: 1px solid #eee;
border-bottom: 1px solid #eee;
color: #333;
cursor: pointer; }
.SOGoTimePickerMenu DIV.hours SPAN DIV.selected,
.SOGoTimePickerMenu DIV.minutes SPAN DIV.selected
{ background-color: #9ABCD8;
border-right: 1px solid #9ABCD8;
border-bottom: 1px solid #9ABCD8;
color: #fff; }
.SOGoTimePickerMenu HR
{ clear: both;
height: 0px;
margin: 0px;
padding: 0px;
color: #fff;
border: 0px; }
+8 -7
View File
@@ -1644,16 +1644,17 @@ document.observe("dom:loaded", onFreeBusyLoadHandler);
function initTimeWidgets(widgets) {
this.timeWidgets = widgets;
assignCalendar('startTime_date');
assignCalendar('endTime_date');
widgets['start']['date'].observe("change", this.onAdjustTime, false);
widgets['start']['time'].observe("time:change", this.onAdjustTime, false);
jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true, position: 'above'});
jQuery(widgets['start']['date']).change(onAdjustTime);
widgets['start']['time'].on("time:change", onAdjustTime);
widgets['start']['time'].addInterface(SOGoTimePickerInterface);
widgets['start']['time'].setPosition('above');
widgets['end']['date'].observe("change", this.onAdjustTime, false);
widgets['end']['time'].observe("time:change", this.onAdjustTime, false);
jQuery(widgets['end']['date']).closest('.date').datepicker({autoclose: true, position: 'above'});
jQuery(widgets['end']['date']).change(onAdjustTime);
widgets['end']['time'].on("time:change", onAdjustTime);
widgets['end']['time'].addInterface(SOGoTimePickerInterface);
widgets['end']['time'].setPosition('above');
var allDayLabel = $("allDay");
if (allDayLabel) {
@@ -134,74 +134,3 @@ SPAN.timeDateControl INPUT,
SPAN.timeDateControl SELECT,
SPAN.timeDateControl SPAN
{ vertical-align: top; }
/* SOGoTimePicker */
.SOGoTimePickerMenu
{ position: absolute;
z-index: 1000;
background-image: url("dialog-top.png");
background-repeat: no-repeat;
color: #000;
font-family: sans-serif;
font-size: 11px;
text-align: center; }
.SOGoTimePickerMenu > DIV
{ background-color: #fff;
border: 1px solid #444;
border-top: 0px;
margin-top: 19px;
padding: 5px; }
.SOGoTimePickerMenu .hours,
.SOGoTimePickerMenu .minutes,
.SOGoTimePickerMenu .button
{ clear: both; /* Opera fix */ }
.SOGoTimePickerMenu SPAN DIV
{ padding: 2px; }
.SOGoTimePickerMenu DIV.hours SPAN
{ float: left;
width: 25px; }
.SOGoTimePickerMenu DIV.hours SPAN DIV
{ background-color: #ddd;
border-right: 1px solid #ccc;
border-bottom: 1px solid #ccc; }
.SOGoTimePickerMenu DIV.min5 SPAN
{ float: left;
width: 50px; }
.SOGoTimePickerMenu DIV.min1 SPAN
{ float: left;
width: 60px; }
.SOGoTimePickerMenu DIV.minutes SPAN DIV
{ border-right: 1px solid #fff;
border-bottom: 1px solid #fff; }
.SOGoTimePickerMenu DIV.hours SPAN DIV:hover,
.SOGoTimePickerMenu DIV.minutes SPAN DIV:hover
{ background-color: #eee;
border-right: 1px solid #eee;
border-bottom: 1px solid #eee;
color: #333;
cursor: pointer; }
.SOGoTimePickerMenu DIV.hours SPAN DIV.selected,
.SOGoTimePickerMenu DIV.minutes SPAN DIV.selected
{ background-color: #9ABCD8;
border-right: 1px solid #9ABCD8;
border-bottom: 1px solid #9ABCD8;
color: #fff; }
.SOGoTimePickerMenu HR
{ clear: both;
height: 0px;
margin: 0px;
padding: 0px;
color: #fff;
border: 0px; }
+2 -10
View File
@@ -71,15 +71,6 @@ SPAN.timeDateControl INPUT.textField
{ width: 7em;
vertical-align: text-bottom; }
#vacation LABEL.timeDate,
#vacation LABEL.timeDate input.checkBox
{ line-height: 2.0em;
}
#vacation LABEL.timeDate,
#vacation LABEL.timeDate input.checkBox,
SPAN.timeDateControl SPAN
{ vertical-align: text-top; }
/* vacation, forward */
#vacation, #forward
{ padding-left: 2.5em; }
@@ -97,7 +88,8 @@ SPAN.timeDateControl SPAN
{ float: right; }
#vacation SPAN.timeDateControl,
#vacation SPAN.timeDateControl SPAN
{ float: none; }
{ float: none;
vertical-align: middle; }
#vacation BR,
#passwordView BR
{ clear: both; }
+2 -2
View File
@@ -240,8 +240,8 @@ function initPreferences() {
button = $("enableVacationEndDate");
if (button) {
assignCalendar('vacationEndDate_date');
button.on("change", function(event) {
jQuery("#vacationEndDate_date").closest(".date").datepicker({autoclose: true, position: 'above'});
button.on("click", function(event) {
if (this.checked)
$("vacationEndDate_date").enable();
else
+4 -4
View File
@@ -264,6 +264,10 @@ this.onAdjustDueTime = function(event) {
this.initTimeWidgets = function (widgets) {
this.timeWidgets = widgets;
jQuery(widgets['start']['date']).closest('.date').datepicker({autoclose: true});
jQuery(widgets['due']['date']).closest('.date').datepicker({autoclose: true});
jQuery('#statusTime_date').closest('.date').datepicker({autoclose: true});
widgets['start']['date'].observe("change", this.onAdjustDueTime, false);
widgets['start']['time'].observe("time:change", this.onAdjustDueTime, false);
widgets['start']['time'].addInterface(SOGoTimePickerInterface);
@@ -310,10 +314,6 @@ function initializeStatusLine() {
}
function onTaskEditorLoad() {
assignCalendar('startTime_date');
assignCalendar('dueTime_date');
assignCalendar('statusTime_date');
if (readOnly == false) {
var widgets = {'start': {'date': $("startTime_date"),
'time': $("startTime_time")},
+282
View File
@@ -0,0 +1,282 @@
/*!
* Datepicker for Bootstrap
*
* Copyright 2012 Stefan Petre
* Improvements by Andrew Rowls
* Licensed under the Apache License v2.0
* http://www.apache.org/licenses/LICENSE-2.0
*
*/
.datepicker {
top: 0;
left: 0;
padding: 4px;
margin-top: 1px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.datepicker.bellow:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-bottom: 7px solid #ccc;
border-bottom-color: rgba(0, 0, 0, 0.2);
position: absolute;
top: -7px;
left: 6px;
}
.datepicker.bellow:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-bottom: 6px solid #ffffff;
position: absolute;
top: -6px;
left: 7px;
}
.datepicker.above:before {
content: '';
display: inline-block;
border-left: 7px solid transparent;
border-right: 7px solid transparent;
border-top: 7px solid #ccc;
border-top-color: rgba(0, 0, 0, 0.2);
position: absolute;
bottom: -7px;
right: 6px;
}
.datepicker.above:after {
content: '';
display: inline-block;
border-left: 6px solid transparent;
border-right: 6px solid transparent;
border-top: 6px solid #ffffff;
position: absolute;
bottom: -6px;
right: 7px;
}
.datepicker > div {
display: none;
}
.datepicker.days div.datepicker-days {
display: block;
}
.datepicker.months div.datepicker-months {
display: block;
}
.datepicker.years div.datepicker-years {
display: block;
}
.datepicker table {
margin: 0;
}
.datepicker td,
.datepicker th {
text-align: center;
width: 20px;
height: 20px;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.datepicker td.day:hover {
background: #eeeeee;
cursor: pointer;
}
.datepicker td.old,
.datepicker td.new {
color: #999999;
}
.datepicker td.disabled,
.datepicker td.disabled:hover {
background: none;
color: #999999;
cursor: default;
}
.datepicker td.active,
.datepicker td.active:hover,
.datepicker td.active.disabled,
.datepicker td.active.disabled:hover {
background-color: #006dcc;
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
background-image: linear-gradient(top, #0088cc, #0044cc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
border-color: #0044cc #0044cc #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.datepicker td.active:hover,
.datepicker td.active:hover:hover,
.datepicker td.active.disabled:hover,
.datepicker td.active.disabled:hover:hover,
.datepicker td.active:active,
.datepicker td.active:hover:active,
.datepicker td.active.disabled:active,
.datepicker td.active.disabled:hover:active,
.datepicker td.active.active,
.datepicker td.active:hover.active,
.datepicker td.active.disabled.active,
.datepicker td.active.disabled:hover.active,
.datepicker td.active.disabled,
.datepicker td.active:hover.disabled,
.datepicker td.active.disabled.disabled,
.datepicker td.active.disabled:hover.disabled,
.datepicker td.active[disabled],
.datepicker td.active:hover[disabled],
.datepicker td.active.disabled[disabled],
.datepicker td.active.disabled:hover[disabled] {
background-color: #0044cc;
}
.datepicker td.active:active,
.datepicker td.active:hover:active,
.datepicker td.active.disabled:active,
.datepicker td.active.disabled:hover:active,
.datepicker td.active.active,
.datepicker td.active:hover.active,
.datepicker td.active.disabled.active,
.datepicker td.active.disabled:hover.active {
background-color: #003399 \9;
}
.datepicker td span {
display: block;
width: 23%;
height: 54px;
line-height: 54px;
float: left;
margin: 1%;
cursor: pointer;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
}
.datepicker td span:hover {
background: #eeeeee;
}
.datepicker td span.disabled,
.datepicker td span.disabled:hover {
background: none;
color: #999999;
cursor: default;
}
.datepicker td span.active,
.datepicker td span.active:hover,
.datepicker td span.active.disabled,
.datepicker td span.active.disabled:hover {
background-color: #006dcc;
background-image: -moz-linear-gradient(top, #0088cc, #0044cc);
background-image: -ms-linear-gradient(top, #0088cc, #0044cc);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#0088cc), to(#0044cc));
background-image: -webkit-linear-gradient(top, #0088cc, #0044cc);
background-image: -o-linear-gradient(top, #0088cc, #0044cc);
background-image: linear-gradient(top, #0088cc, #0044cc);
background-repeat: repeat-x;
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#0088cc', endColorstr='#0044cc', GradientType=0);
border-color: #0044cc #0044cc #002a80;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
filter: progid:dximagetransform.microsoft.gradient(enabled=false);
color: #fff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.datepicker td span.active:hover,
.datepicker td span.active:hover:hover,
.datepicker td span.active.disabled:hover,
.datepicker td span.active.disabled:hover:hover,
.datepicker td span.active:active,
.datepicker td span.active:hover:active,
.datepicker td span.active.disabled:active,
.datepicker td span.active.disabled:hover:active,
.datepicker td span.active.active,
.datepicker td span.active:hover.active,
.datepicker td span.active.disabled.active,
.datepicker td span.active.disabled:hover.active,
.datepicker td span.active.disabled,
.datepicker td span.active:hover.disabled,
.datepicker td span.active.disabled.disabled,
.datepicker td span.active.disabled:hover.disabled,
.datepicker td span.active[disabled],
.datepicker td span.active:hover[disabled],
.datepicker td span.active.disabled[disabled],
.datepicker td span.active.disabled:hover[disabled] {
background-color: #0044cc;
}
.datepicker td span.active:active,
.datepicker td span.active:hover:active,
.datepicker td span.active.disabled:active,
.datepicker td span.active.disabled:hover:active,
.datepicker td span.active.active,
.datepicker td span.active:hover.active,
.datepicker td span.active.disabled.active,
.datepicker td span.active.disabled:hover.active {
background-color: #003399 \9;
}
.datepicker td span.old {
color: #999999;
}
.datepicker th.switch {
width: 145px;
}
.datepicker thead tr:first-child th {
cursor: pointer;
}
.datepicker thead tr:first-child th:hover {
background: #eeeeee;
}
.input-append.date .add-on i,
.input-prepend.date .add-on i {
display: block;
cursor: pointer;
width: 16px;
height: 16px;
}
.datepicker.dropdown-menu {
position: absolute;
top: 100%;
left: 0;
z-index: 1000;
float: left;
display: none;
min-width: 160px;
list-style: none;
background-color: #ffffff;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
*border-right-width: 2px;
*border-bottom-width: 2px;
color: #333333;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
line-height: 18px;
}
.datepicker.dropdown-menu th,
.datepicker.dropdown-menu td {
padding: 2px 1px;
}
.datepicker .prev,
.datepicker .next {
font-style: normal;
}
.datepicker .prev:after {
content: "«";
}
.datepicker .next:after {
content: "»";
}
+784
View File
@@ -0,0 +1,784 @@
/* =========================================================
* bootstrap-datepicker.js
* http://www.eyecon.ro/bootstrap-datepicker
* =========================================================
* Copyright 2012 Stefan Petre
* Improvements by Andrew Rowls
* Adapted for SOGo translation by Francis Lachapelle
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
* ========================================================= */
!function( $ ) {
function UTCDate(){
return new Date(Date.UTC.apply(Date, arguments));
}
// Picker object
var Datepicker = function(element, options) {
var that = this;
this.element = $(element);
this.position = options.position||this.element.data('position')||"bellow";
this.format = DPGlobal.parseFormat(options.format||this.element.data('date-format')||'mm/dd/yyyy');
this.picker = $(DPGlobal.template)
.addClass(this.position)
.appendTo('body')
.on({
click: $.proxy(this.click, this)
});
this.isInput = this.element.is('input');
this.component = this.element.is('.date') ? this.element.find('.add-on') : false;
this.hasInput = this.component && this.element.find('input').length;
if(this.component && this.component.length === 0)
this.component = false;
if (this.isInput) {
this.element.on({
focus: $.proxy(this.show, this),
keyup: $.proxy(this.update, this),
keydown: $.proxy(this.keydown, this)
});
} else {
if (this.component && this.hasInput){
// For components that are not readonly, allow keyboard nav
this.element.find('input').on({
focus: $.proxy(this.show, this),
keyup: $.proxy(this.update, this),
keydown: $.proxy(this.keydown, this)
});
this.component.on('click', $.proxy(this.show, this));
} else {
this.element.on('click', $.proxy(this.show, this));
}
}
$(document).on('mousedown', function (e) {
// Clicked outside the datepicker, hide it
if ($(e.target).closest('.datepicker').length == 0) {
that.hide();
}
});
this.autoclose = false;
if ('autoclose' in options) {
this.autoclose = options.autoclose;
} else if ('dateAutoclose' in this.element.data()) {
this.autoclose = this.element.data('date-autoclose');
}
this.keyboardNavigation = true;
if ('keyboardNavigation' in options) {
this.keyboardNavigation = options.keyboardNavigation;
} else if ('dateKeyboardNavigation' in this.element.data()) {
this.keyboardNavigation = this.element.data('date-keyboard-navigation');
}
switch(options.startView || this.element.data('date-start-view')){
case 2:
case 'decade':
this.viewMode = this.startViewMode = 2;
break;
case 1:
case 'year':
this.viewMode = this.startViewMode = 1;
break;
case 0:
case 'month':
default:
this.viewMode = this.startViewMode = 0;
break;
}
this.weekStart = ((options.weekStart||this.element.data('date-weekstart')||0) % 7);
this.weekEnd = ((this.weekStart + 6) % 7);
this.startDate = -Infinity;
this.endDate = Infinity;
this.setStartDate(options.startDate||this.element.data('date-startdate'));
this.setEndDate(options.endDate||this.element.data('date-enddate'));
this.fillDow();
this.fillMonths();
this.update();
this.showMode();
};
Datepicker.prototype = {
constructor: Datepicker,
show: function(e) {
this.picker.show();
this.height = this.component ? this.component.outerHeight() : this.element.outerHeight();
this.update();
this.place();
$(window).on('resize', $.proxy(this.place, this));
if (e ) {
e.stopPropagation();
e.preventDefault();
}
this.element.trigger({
type: 'show',
date: this.date
});
},
hide: function(e){
this.picker.hide();
$(window).off('resize', this.place);
this.viewMode = this.startViewMode;
this.showMode();
if (!this.isInput) {
$(document).off('mousedown', this.hide);
}
if (e && e.currentTarget.value)
this.setValue();
},
setValue: function() {
var formatted = DPGlobal.formatDate(this.date, this.format);
if (!this.isInput) {
if (this.component){
this.element.find('input').prop('value', formatted);
}
this.element.data('date', formatted);
} else {
this.element.prop('value', formatted);
}
},
setStartDate: function(startDate){
this.startDate = startDate||-Infinity;
if (this.startDate !== -Infinity) {
this.startDate = DPGlobal.parseDate(this.startDate, this.format);
}
this.update();
this.updateNavArrows();
},
setEndDate: function(endDate){
this.endDate = endDate||Infinity;
if (this.endDate !== Infinity) {
this.endDate = DPGlobal.parseDate(this.endDate, this.format);
}
this.update();
this.updateNavArrows();
},
place: function(){
var zIndex = parseInt(this.element.parents().filter(function() {
return $(this).css('z-index') != 'auto';
}).first().css('z-index'))+10;
var offset = this.component ? this.component.offset() : this.element.offset();
var width = this.component ? this.component.width() : this.element.width();
if (this.position == 'bellow')
this.picker.css({
top: offset.top + this.height,
left: offset.left,
right: 'auto',
zIndex: zIndex
});
else // above
this.picker.css({
top: offset.top - this.height - this.picker.outerHeight(),
right: window.width() - offset.left - width,
left: 'auto',
zIndex: zIndex
});
},
update: function(){
this.date = DPGlobal.parseDate(
this.isInput ? this.element.prop('value') : this.element.data('date') || this.element.find('input').prop('value'),
this.format
);
if (this.date < this.startDate) {
this.viewDate = new Date(this.startDate);
} else if (this.date > this.endDate) {
this.viewDate = new Date(this.endDate);
} else {
this.viewDate = new Date(this.date);
}
this.fill();
},
fillDow: function(){
var dowCnt = this.weekStart;
var html = '<tr>';
while (dowCnt < this.weekStart + 7) {
html += '<th class="dow">'+_('a2_'+dates.days[(dowCnt++)%7])+'</th>';
}
html += '</tr>';
this.picker.find('.datepicker-days thead').append(html);
},
fillMonths: function(){
var html = '';
var i = 0
while (i < 12) {
html += '<span class="month">'+_(dates.monthsShort[i++])+'</span>';
}
this.picker.find('.datepicker-months td').html(html);
},
fill: function() {
var d = new Date(this.viewDate),
year = d.getUTCFullYear(),
month = d.getUTCMonth(),
startYear = this.startDate !== -Infinity ? this.startDate.getUTCFullYear() : -Infinity,
startMonth = this.startDate !== -Infinity ? this.startDate.getUTCMonth() : -Infinity,
endYear = this.endDate !== Infinity ? this.endDate.getUTCFullYear() : Infinity,
endMonth = this.endDate !== Infinity ? this.endDate.getUTCMonth() : Infinity,
currentDate = this.date.valueOf();
this.picker.find('.datepicker-days th:eq(1)')
.text(_(dates.months[month])+' '+year);
this.updateNavArrows();
this.fillMonths();
var prevMonth = UTCDate(year, month-1, 28,0,0,0,0),
day = DPGlobal.getDaysInMonth(prevMonth.getUTCFullYear(), prevMonth.getUTCMonth());
prevMonth.setUTCDate(day);
prevMonth.setUTCDate(day - (prevMonth.getUTCDay() - this.weekStart + 7)%7);
var nextMonth = new Date(prevMonth);
nextMonth.setUTCDate(nextMonth.getUTCDate() + 42);
nextMonth = nextMonth.valueOf();
var html = [];
var clsName;
while(prevMonth.valueOf() < nextMonth) {
if (prevMonth.getUTCDay() == this.weekStart) {
html.push('<tr>');
}
clsName = '';
if (prevMonth.getUTCFullYear() < year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() < month)) {
clsName += ' old';
} else if (prevMonth.getUTCFullYear() > year || (prevMonth.getUTCFullYear() == year && prevMonth.getUTCMonth() > month)) {
clsName += ' new';
}
if (prevMonth.valueOf() == currentDate) {
clsName += ' active';
}
if (prevMonth.valueOf() < this.startDate || prevMonth.valueOf() > this.endDate) {
clsName += ' disabled';
}
html.push('<td class="day'+clsName+'">'+prevMonth.getUTCDate() + '</td>');
if (prevMonth.getUTCDay() == this.weekEnd) {
html.push('</tr>');
}
prevMonth.setUTCDate(prevMonth.getUTCDate()+1);
}
this.picker.find('.datepicker-days tbody').empty().append(html.join(''));
var currentYear = this.date.getUTCFullYear();
var months = this.picker.find('.datepicker-months')
.find('th:eq(1)')
.text(year)
.end()
.find('span').removeClass('active');
if (currentYear == year) {
months.eq(this.date.getUTCMonth()).addClass('active');
}
if (year < startYear || year > endYear) {
months.addClass('disabled');
}
if (year == startYear) {
months.slice(0, startMonth).addClass('disabled');
}
if (year == endYear) {
months.slice(endMonth+1).addClass('disabled');
}
html = '';
year = parseInt(year/10, 10) * 10;
var yearCont = this.picker.find('.datepicker-years')
.find('th:eq(1)')
.text(year + '-' + (year + 9))
.end()
.find('td');
year -= 1;
for (var i = -1; i < 11; i++) {
html += '<span class="year'+(i == -1 || i == 10 ? ' old' : '')+(currentYear == year ? ' active' : '')+(year < startYear || year > endYear ? ' disabled' : '')+'">'+year+'</span>';
year += 1;
}
yearCont.html(html);
},
updateNavArrows: function() {
var d = new Date(this.viewDate),
year = d.getUTCFullYear(),
month = d.getUTCMonth();
switch (this.viewMode) {
case 0:
if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear() && month <= this.startDate.getUTCMonth()) {
this.picker.find('.prev').css({visibility: 'hidden'});
} else {
this.picker.find('.prev').css({visibility: 'visible'});
}
if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear() && month >= this.endDate.getUTCMonth()) {
this.picker.find('.next').css({visibility: 'hidden'});
} else {
this.picker.find('.next').css({visibility: 'visible'});
}
break;
case 1:
case 2:
if (this.startDate !== -Infinity && year <= this.startDate.getUTCFullYear()) {
this.picker.find('.prev').css({visibility: 'hidden'});
} else {
this.picker.find('.prev').css({visibility: 'visible'});
}
if (this.endDate !== Infinity && year >= this.endDate.getUTCFullYear()) {
this.picker.find('.next').css({visibility: 'hidden'});
} else {
this.picker.find('.next').css({visibility: 'visible'});
}
break;
}
},
click: function(e) {
e.stopPropagation();
e.preventDefault();
var target = $(e.target).closest('span, td, th');
if (target.length == 1) {
switch(target[0].nodeName.toLowerCase()) {
case 'th':
switch(target[0].className) {
case 'switch':
this.showMode(1);
break;
case 'prev':
case 'next':
var dir = DPGlobal.modes[this.viewMode].navStep * (target[0].className == 'prev' ? -1 : 1);
switch(this.viewMode){
case 0:
this.viewDate = this.moveMonth(this.viewDate, dir);
break;
case 1:
case 2:
this.viewDate = this.moveYear(this.viewDate, dir);
break;
}
this.fill();
break;
}
break;
case 'span':
if (!target.is('.disabled')) {
this.viewDate.setUTCDate(1);
if (target.is('.month')) {
var month = target.parent().find('span').index(target);
this.viewDate.setUTCMonth(month);
this.element.trigger({
type: 'changeMonth',
date: this.viewDate
});
} else {
var year = parseInt(target.text(), 10)||0;
this.viewDate.setUTCFullYear(year);
this.element.trigger({
type: 'changeYear',
date: this.viewDate
});
}
this.showMode(-1);
this.fill();
}
break;
case 'td':
if (target.is('.day') && !target.is('.disabled')){
var day = parseInt(target.text(), 10)||1;
var year = this.viewDate.getUTCFullYear(),
month = this.viewDate.getUTCMonth();
if (target.is('.old')) {
if (month == 0) {
month = 11;
year -= 1;
} else {
month -= 1;
}
} else if (target.is('.new')) {
if (month == 11) {
month = 0;
year += 1;
} else {
month += 1;
}
}
this.date = UTCDate(year, month, day,0,0,0,0);
this.viewDate = UTCDate(year, month, day,0,0,0,0);
this.fill();
this.setValue();
this.element.trigger({
type: 'changeDate',
date: this.date
});
var element;
if (this.isInput) {
element = this.element;
} else if (this.component){
element = this.element.find('input');
}
if (element) {
element.change();
if (this.autoclose) {
this.hide();
}
}
}
break;
}
}
},
moveMonth: function(date, dir){
if (!dir) return date;
var new_date = new Date(date.valueOf()),
day = new_date.getUTCDate(),
month = new_date.getUTCMonth(),
mag = Math.abs(dir),
new_month, test;
dir = dir > 0 ? 1 : -1;
if (mag == 1){
test = dir == -1
// If going back one month, make sure month is not current month
// (eg, Mar 31 -> Feb 31 == Feb 28, not Mar 02)
? function(){ return new_date.getUTCMonth() == month; }
// If going forward one month, make sure month is as expected
// (eg, Jan 31 -> Feb 31 == Feb 28, not Mar 02)
: function(){ return new_date.getUTCMonth() != new_month; };
new_month = month + dir;
new_date.setUTCMonth(new_month);
// Dec -> Jan (12) or Jan -> Dec (-1) -- limit expected date to 0-11
if (new_month < 0 || new_month > 11)
new_month = (new_month + 12) % 12;
} else {
// For magnitudes >1, move one month at a time...
for (var i=0; i<mag; i++)
// ...which might decrease the day (eg, Jan 31 to Feb 28, etc)...
new_date = this.moveMonth(new_date, dir);
// ...then reset the day, keeping it in the new month
new_month = new_date.getUTCMonth();
new_date.setUTCDate(day);
test = function(){ return new_month != new_date.getUTCMonth(); };
}
// Common date-resetting loop -- if date is beyond end of month, make it
// end of month
while (test()){
new_date.setUTCDate(--day);
new_date.setUTCMonth(new_month);
}
return new_date;
},
moveYear: function(date, dir){
return this.moveMonth(date, dir*12);
},
dateWithinRange: function(date){
return date >= this.startDate && date <= this.endDate;
},
keydown: function(e){
if (this.picker.is(':not(:visible)')){
if (e.keyCode == 27) // allow escape to hide and re-show picker
this.show();
return;
}
var dateChanged = false,
dir, day, month,
newDate, newViewDate;
switch(e.keyCode){
case 27: // escape
this.hide();
e.preventDefault();
break;
case 37: // left
case 39: // right
if (!this.keyboardNavigation) break;
dir = e.keyCode == 37 ? -1 : 1;
if (e.ctrlKey){
newDate = this.moveYear(this.date, dir);
newViewDate = this.moveYear(this.viewDate, dir);
} else if (e.shiftKey){
newDate = this.moveMonth(this.date, dir);
newViewDate = this.moveMonth(this.viewDate, dir);
} else {
newDate = new Date(this.date);
newDate.setUTCDate(this.date.getUTCDate() + dir);
newViewDate = new Date(this.viewDate);
newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir);
}
if (this.dateWithinRange(newDate)){
this.date = newDate;
this.viewDate = newViewDate;
this.setValue();
this.update();
e.preventDefault();
dateChanged = true;
}
break;
case 38: // up
case 40: // down
if (!this.keyboardNavigation) break;
dir = e.keyCode == 38 ? -1 : 1;
if (e.ctrlKey){
newDate = this.moveYear(this.date, dir);
newViewDate = this.moveYear(this.viewDate, dir);
} else if (e.shiftKey){
newDate = this.moveMonth(this.date, dir);
newViewDate = this.moveMonth(this.viewDate, dir);
} else {
newDate = new Date(this.date);
newDate.setUTCDate(this.date.getUTCDate() + dir * 7);
newViewDate = new Date(this.viewDate);
newViewDate.setUTCDate(this.viewDate.getUTCDate() + dir * 7);
}
if (this.dateWithinRange(newDate)){
this.date = newDate;
this.viewDate = newViewDate;
this.setValue();
this.update();
e.preventDefault();
dateChanged = true;
}
break;
case 13: // enter
this.hide();
e.preventDefault();
break;
case 9: // tab
this.hide();
break;
}
if (dateChanged){
this.element.trigger({
type: 'changeDate',
date: this.date
});
var element;
if (this.isInput) {
element = this.element;
} else if (this.component){
element = this.element.find('input');
}
if (element) {
element.change();
}
}
},
showMode: function(dir) {
if (dir) {
this.viewMode = Math.max(0, Math.min(2, this.viewMode + dir));
}
this.picker.find('>div').hide().filter('.datepicker-'+DPGlobal.modes[this.viewMode].clsName).show();
this.updateNavArrows();
}
};
$.fn.datepicker = function ( option ) {
var args = Array.apply(null, arguments);
args.shift();
return this.each(function () {
var $this = $(this),
data = $this.data('datepicker'),
options = typeof option == 'object' && option;
if (!data) {
$this.data('datepicker', (data = new Datepicker(this, $.extend({}, $.fn.datepicker.defaults,options))));
}
if (typeof option == 'string' && typeof data[option] == 'function') {
data[option].apply(data, args);
}
});
};
$.fn.datepicker.defaults = {
};
$.fn.datepicker.Constructor = Datepicker;
var dates = $.fn.datepicker.dates = {
days: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday"],
daysShort: ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"],
daysMin: ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"],
months: ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"],
monthsShort: ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
}
var DPGlobal = {
modes: [
{
clsName: 'days',
navFnc: 'Month',
navStep: 1
},
{
clsName: 'months',
navFnc: 'FullYear',
navStep: 1
},
{
clsName: 'years',
navFnc: 'FullYear',
navStep: 10
}],
isLeapYear: function (year) {
return (((year % 4 === 0) && (year % 100 !== 0)) || (year % 400 === 0))
},
getDaysInMonth: function (year, month) {
return [31, (DPGlobal.isLeapYear(year) ? 29 : 28), 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][month]
},
validParts: /dd?|mm?|MM?|yy(?:yy)?/g,
nonpunctuation: /[^ -\/:-@\[-`{-~\t\n\r]+/g,
parseFormat: function(format){
// IE treats \0 as a string end in inputs (truncating the value),
// so it's a bad format delimiter, anyway
var separators = format.replace(this.validParts, '\0').split('\0'),
parts = format.match(this.validParts);
if (!separators || !separators.length || !parts || parts.length == 0){
throw new Error("Invalid date format.");
}
return {separators: separators, parts: parts};
},
parseDate: function(date, format) {
if (date instanceof Date) return date;
if (/^[-+]\d+[dmwy]([\s,]+[-+]\d+[dmwy])*$/.test(date)) {
var part_re = /([-+]\d+)([dmwy])/,
parts = date.match(/([-+]\d+)([dmwy])/g),
part, dir;
date = new Date();
for (var i=0; i<parts.length; i++) {
part = part_re.exec(parts[i]);
dir = parseInt(part[1]);
switch(part[2]){
case 'd':
date.setUTCDate(date.getUTCDate() + dir);
break;
case 'm':
date = Datepicker.prototype.moveMonth.call(Datepicker.prototype, date, dir);
break;
case 'w':
date.setUTCDate(date.getUTCDate() + dir * 7);
break;
case 'y':
date = Datepicker.prototype.moveYear.call(Datepicker.prototype, date, dir);
break;
}
}
return UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
}
var parts = date && date.match(this.nonpunctuation) || [],
date = new Date(),
parsed = {},
setters_order = ['yyyy', 'yy', 'M', 'MM', 'm', 'mm', 'd', 'dd'],
setters_map = {
yyyy: function(d,v){ return d.setUTCFullYear(v); },
yy: function(d,v){ return d.setUTCFullYear(2000+v); },
m: function(d,v){
v -= 1;
while (v<0) v += 12;
v %= 12;
d.setUTCMonth(v);
while (d.getUTCMonth() != v)
d.setUTCDate(d.getUTCDate()-1);
return d;
},
d: function(d,v){ return d.setUTCDate(v); }
},
val, filtered, part;
setters_map['M'] = setters_map['MM'] = setters_map['mm'] = setters_map['m'];
setters_map['dd'] = setters_map['d'];
date = UTCDate(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0);
if (parts.length == format.parts.length) {
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
val = parseInt(parts[i], 10);
part = format.parts[i];
if (isNaN(val)) {
switch(part) {
case 'MM':
filtered = $(dates.months).filter(function(){
var m = this.slice(0, parts[i].length),
p = parts[i].slice(0, m.length);
return m == p;
});
val = $.inArray(filtered[0], dates.months) + 1;
break;
case 'M':
filtered = $(dates.monthsShort).filter(function(){
var m = this.slice(0, parts[i].length),
p = parts[i].slice(0, m.length);
return m == p;
});
val = $.inArray(filtered[0], dates.monthsShort) + 1;
break;
}
}
parsed[part] = val;
}
for (var i=0, s; i<setters_order.length; i++){
s = setters_order[i];
if (s in parsed)
setters_map[s](date, parsed[s])
}
}
return date;
},
formatDate: function(date, format){
var val = {
d: date.getUTCDate(),
m: date.getUTCMonth() + 1,
M: dates.monthsShort[date.getUTCMonth()],
MM: dates.months[date.getUTCMonth()],
yy: date.getUTCFullYear().toString().substring(2),
yyyy: date.getUTCFullYear()
};
val.dd = (val.d < 10 ? '0' : '') + val.d;
val.mm = (val.m < 10 ? '0' : '') + val.m;
var date = [],
seps = $.extend([], format.separators);
for (var i=0, cnt = format.parts.length; i < cnt; i++) {
if (seps.length)
date.push(seps.shift())
date.push(val[format.parts[i]]);
}
return date.join('');
},
headTemplate: '<thead>'+
'<tr>'+
'<th class="prev"><i class="icon-arrow-left"/></th>'+
'<th colspan="5" class="switch"></th>'+
'<th class="next"><i class="icon-arrow-right"/></th>'+
'</tr>'+
'</thead>',
contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>'
};
DPGlobal.template = '<div class="datepicker dropdown-menu">'+
'<div class="datepicker-days">'+
'<table class=" table-condensed">'+
DPGlobal.headTemplate+
'<tbody></tbody>'+
'</table>'+
'</div>'+
'<div class="datepicker-months">'+
'<table class="table-condensed">'+
DPGlobal.headTemplate+
DPGlobal.contTemplate+
'</table>'+
'</div>'+
'<div class="datepicker-years">'+
'<table class="table-condensed">'+
DPGlobal.headTemplate+
DPGlobal.contTemplate+
'</table>'+
'</div>'+
'</div>';
}( window.jQuery );
+67 -25
View File
@@ -573,35 +573,72 @@ DIV.resize-handle
DIV.dialog
{ position: absolute;
width: 350px;
z-index: 50; }
z-index: 1000;
background-color: #fff;
border: 1px solid #ccc;
border: 1px solid rgba(0, 0, 0, 0.2);
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
-webkit-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-moz-box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
-webkit-background-clip: padding-box;
-moz-background-clip: padding;
background-clip: padding-box;
*border-right-width: 2px;
*border-bottom-width: 2px;
color: #000;
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 13px;
line-height: 18px; }
DIV.dialog > DIV
{ border: 1px solid #444;
-webkit-box-shadow: 0 5px 10px rgba(0,0,0,.5);
box-shadow: 0 5px 10px rgba(0,0,0,.5);
background-color: #fff;
padding: 5px;
padding-bottom: 26px; }
{ padding: 5px 10px; }
DIV.dialog.left
{ background-image: url("dialog-left.png");
background-repeat: no-repeat;
background-position: top left; }
.dialog.left > DIV:before {
content: '';
display: inline-block;
border-top: 7px solid transparent;
border-bottom: 7px solid transparent;
border-right: 7px solid #ccc;
border-right-color: rgba(0, 0, 0, 0.2);
position: absolute;
left: -7px;
top: 6px;
}
.dialog.left > DIV:after {
content: '';
display: inline-block;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-right: 6px solid #ffffff;
position: absolute;
left: -6px;
top: 7px;
}
DIV.dialog.left DIV
{ border-left: 0px;
margin-left: 19px;
text-align: left; }
DIV.dialog.right
{ background-image: url("dialog-right.png");
background-repeat: no-repeat;
background-position: top right; }
DIV.dialog.right DIV
{ border-right: 0px;
margin-right: 19px;
text-align: right; }
.dialog.right > DIV:before {
content: '';
display: inline-block;
border-top: 7px solid transparent;
border-bottom: 7px solid transparent;
border-left: 7px solid #ccc;
border-left-color: rgba(0, 0, 0, 0.2);
position: absolute;
right: -7px;
top: 6px;
}
.dialog.right > DIV:after {
content: '';
display: inline-block;
border-top: 6px solid transparent;
border-bottom: 6px solid transparent;
border-left: 6px solid #ffffff;
position: absolute;
right: -6px;
top: 7px;
}
DIV.dialog.none
{ position: relative;
@@ -635,6 +672,11 @@ DIV.dialog P.list
{ max-height: 200px;
overflow-y: auto; }
DIV.dialog .button
{ font-family: Lucida Grande, Bitstream VeraSans, Tahoma, sans-serif;
font-size: 8pt;
margin-top: 10px; }
DIV#bgFrameDiv
{ position: absolute;
top: 0px; left: 0px;
-187
View File
@@ -1,187 +0,0 @@
<!--
Title: Tigra Calendar
Description: See the demo at url
URL: http://www.softcomplex.com/products/tigra_calendar/
Version: 3.1
Date: 08-08-2002 (mm-dd-yyyy)
Feedback: feedback@softcomplex.com (specify product title in the subject)
Note: Permission given to use this script in ANY kind of applications if
header lines are left unchanged.
Note: Script consists of two files: calendar?.js and calendar.html
About us: Our company provides offshore IT consulting services.
Contact us at sales@softcomplex.com if you have any programming task you
want to be handled by professionals. Our typical hourly rate is $20.
modified by Martin Hoerning, mh@skyrix.com, 2002-12-05
-->
<html>
<head>
<title>Select Date, Please.</title>
<style>
td {font-family: Tahoma, Verdana, sans-serif; font-size: 12px;}
</style>
<script src="/SOGo.woa/WebServerResources/prototype.js" type="text/javascript"></script>
<script language="JavaScript">
// months as they appear in the calendar's title
var ARR_MONTHS = ["January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"];
// week day titles as they appear on the calendar
var ARR_WEEKDAYS = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"];
// day week starts from (normally 0-Mo or 1-Su)
var NUM_WEEKSTART = 1;
// path to the directory where calendar images are stored. trailing slash req.
var STR_ICONPATH = '';
var labels = window.opener.labels;
if (labels) {
for (var i = 0; i < ARR_MONTHS.length; i++) {
var string = ARR_MONTHS[i];
if (labels[string])
ARR_MONTHS[i] = labels[string];
}
if (labels['a2_Sunday'])
ARR_WEEKDAYS[0] = labels['a2_Sunday'];
if (labels['a2_Monday'])
ARR_WEEKDAYS[1] = labels['a2_Monday'];
if (labels['a2_Tuesday'])
ARR_WEEKDAYS[2] = labels['a2_Tuesday'];
if (labels['a2_Wednesday'])
ARR_WEEKDAYS[3] = labels['a2_Wednesday'];
if (labels['a2_Thursday'])
ARR_WEEKDAYS[4] = labels['a2_Thursday'];
if (labels['a2_Friday'])
ARR_WEEKDAYS[5] = labels['a2_Friday'];
if (labels['a2_Saturday'])
ARR_WEEKDAYS[6] = labels['a2_Saturday'];
}
var re_url = new RegExp('datetime=(\\-?\\d+)');
var dt_current = (re_url.exec(String(window.location))
? new Date(new Number(RegExp.$1)) : new Date());
var re_id = new RegExp('id=(\\d+)');
var num_id = (re_id.exec(String(window.location))
? new Number(RegExp.$1) : 0);
var obj_caller = (window.opener ? window.opener.calendars[num_id] : null);
if (obj_caller && obj_caller.year_scroll) {
// get same date in the previous year
var dt_prev_year = new Date(dt_current);
dt_prev_year.setFullYear(dt_prev_year.getFullYear() - 1);
if (dt_prev_year.getDate() != dt_current.getDate())
dt_prev_year.setDate(0);
// get same date in the next year
var dt_next_year = new Date(dt_current);
dt_next_year.setFullYear(dt_next_year.getFullYear() + 1);
if (dt_next_year.getDate() != dt_current.getDate())
dt_next_year.setDate(0);
}
// get same date in the previous month
var dt_prev_month = new Date(dt_current);
dt_prev_month.setMonth(dt_prev_month.getMonth() - 1);
if (dt_prev_month.getDate() != dt_current.getDate())
dt_prev_month.setDate(0);
// get same date in the next month
var dt_next_month = new Date(dt_current);
dt_next_month.setMonth(dt_next_month.getMonth() + 1);
if (dt_next_month.getDate() != dt_current.getDate())
dt_next_month.setDate(0);
// get first day to display in the grid for current month
var dt_firstday = new Date(dt_current);
dt_firstday.setDate(1);
dt_firstday.setDate(1 - (7 + dt_firstday.getDay() - NUM_WEEKSTART) % 7);
// function passing selected date to calling window
function set_datetime(n_datetime, b_close) {
if (!obj_caller) return;
var dt_datetime = new Date(n_datetime);
if (!dt_datetime) {
alert('failed to generate date string');
return;
}
if (b_close) { // only set value when closing window
obj_caller.target.value = (document.cal
? obj_caller.gen_tsmp(dt_datetime)
: obj_caller.gen_date(dt_datetime)
);
var adjustTime = window.opener.onAdjustTime.bind(obj_caller.target);
adjustTime();
}
if (b_close) window.close();
else obj_caller.popup(dt_datetime.valueOf());
}
</script>
</head>
<body bgcolor="#FFFFFF" marginheight="5" marginwidth="5" topmargin="5" leftmargin="5" rightmargin="5">
<table class="clsOTable" cellspacing="0" border="0" width="100%">
<tr><td bgcolor="#E8E8E0">
<table cellspacing="1" cellpadding="3" border="0" width="100%">
<tr><td colspan="7" bgcolor="#D0D0D0"><table cellspacing="0" cellpadding="0" border="0" width="100%">
<tr>
<script language="JavaScript">
document.write(
'<td>'+(obj_caller&&obj_caller.year_scroll?'<a href="javascript:set_datetime('+dt_prev_year.valueOf()+')"><img src="'+STR_ICONPATH+'first.gif" width="15" height="15" border="0" alt="previous year" title="previous year"></a>&nbsp;':'')+'<a href="javascript:set_datetime('+dt_prev_month.valueOf()+')"><img src="'+STR_ICONPATH+'previous.gif" width="15" height="15" border="0" alt="previous month" title="previous month"></a></td>'+
'<td align="center" width="100%"><font color="#000000">'+ARR_MONTHS[dt_current.getMonth()]+' '+dt_current.getFullYear() + '</font></td>'+
'<td><a href="javascript:set_datetime('+dt_next_month.valueOf()+')"><img src="'+STR_ICONPATH+'next.gif" width="15" height="15" border="0" alt="next month" title="next month"></a>'+(obj_caller && obj_caller.year_scroll?'&nbsp;<a href="javascript:set_datetime('+dt_next_year.valueOf()+')"><img src="'+STR_ICONPATH+'last.gif" width="15" height="15" border="0" alt="next year" title="next year"></a>':'')+'</td>'
);
</script>
</tr>
</table></td></tr>
<tr>
<script language="JavaScript">
// print weekdays titles
for (var n=0; n<7; n++)
document.write('<td bgcolor="#D0D0D0" align="center"><font color="#000000">'+ARR_WEEKDAYS[(NUM_WEEKSTART+n)%7]+'</font></td>');
document.write('</tr>');
// print calendar table
var dt_current_day = new Date(dt_firstday);
while (dt_current_day.getMonth() == dt_current.getMonth() ||
dt_current_day.getMonth() == dt_firstday.getMonth()) {
// print row heder
document.write('<tr>');
for (var n_current_wday=0; n_current_wday<7; n_current_wday++) {
if (dt_current_day.getDate() == dt_current.getDate() &&
dt_current_day.getMonth() == dt_current.getMonth())
// print current date
document.write('<td bgcolor="#F18D39" align="center" width="14%">');
//else if (dt_current_day.getDay() == 0 || dt_current_day.getDay() == 6)
else if (dt_current_day.getMonth() != dt_current.getMonth())
// old: weekend days // new: other month
document.write('<td bgcolor="#D0D0D0" align="center" width="14%">');
else
// print working days of current month
document.write('<td bgcolor="#E0E0E0" align="center" width="14%">');
document.write('<a href="javascript:set_datetime('+dt_current_day.valueOf() +', true);">');
if (dt_current_day.getMonth() == this.dt_current.getMonth())
// print days of current month
document.write('<font color="#000000">');
else
// print days of other months
document.write('<font color="#555555">');
document.write(dt_current_day.getDate()+'</font></a></td>');
dt_current_day.setDate(dt_current_day.getDate()+1);
}
// print row footer
document.write('</tr>');
}
//if (obj_caller && obj_caller.time_comp)
// document.write('<form onsubmit="javascript:set_datetime('+dt_current.valueOf()+', true)" name="cal"><tr><td colspan="7" bgcolor="#87CEFA"><font color="White" face="tahoma, verdana" size="2">Time: <input type="text" name="time" value="'+obj_caller.gen_time(this.dt_current)+'" size="8" maxlength="8"></font></td></tr></form>');
</script>
</table></tr></td>
</table>
</body>
</html>
-212
View File
@@ -1,212 +0,0 @@
/* -*- Mode: java; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// Title: Tigra Calendar
// Description: See the demo at url
// URL: http://www.softcomplex.com/products/tigra_calendar/
// Version: 3.1 (European date format)
// Date: 08-08-2002 (mm-dd-yyyy)
// Feedback: feedback@softcomplex.com (specify product title in the subject)
// Note: Permission given to use this script in ANY kind of applications if
// header lines are left unchanged.
// Note: Script consists of two files: calendar?.js and calendar.html
// About us: Our company provides offshore IT consulting services.
// Contact us at sales@softcomplex.com if you have any programming task you
// want to be handled by professionals. Our typical hourly rate is $20.
// modified by Martin Hoerning, mh@skyrix.com, 2002-12-05
// 2003-01-23 added date format support (Martin Hoerning)
// if two digit year input dates after this year considered 20 century.
var NUM_CENTYEAR = 30;
// are year scrolling buttons required by default
var BUL_YEARSCROLL = true;
var DEF_CALPAGE = 'skycalendar.html';
var calendars = [];
var RE_NUM = /^\-?\d+$/;
var dateFormat = "yyyy-mm-dd";
function assignCalendar(name) {
if (typeof(skycalendar) != "undefined") {
var node = $(name);
if (node) {
node.calendar = new skycalendar(node);
node.calendar.setCalendarPage(ResourcesURL + "/skycalendar.html");
var dateFormat = node.getAttribute("dateFormat");
if (dateFormat)
node.calendar.setDateFormat(dateFormat);
}
}
}
function popupCalendar(node) {
var nodeId = $(node).readAttribute("inputId");
var input = $(nodeId);
input.calendar.popup();
return false;
}
function skycalendar(obj_target) {
// assing methods
this.gen_date = cal_gen_date1;
this.gen_tsmp = cal_gen_tsmp1;
this.prs_date = cal_prs_date1;
this.prs_tsmp = cal_prs_tsmp1;
this.popup = cal_popup1;
this.setCalendarPage = cal_setcalpage1;
this.setDateFormat = cal_setdateformat1;
// validate input parameters
if (!obj_target)
return cal_error("Error calling the calendar: no target control specified");
if (obj_target.value == null)
return cal_error("Error calling the calendar: parameter specified is not valid tardet control");
this.target = obj_target;
this.year_scroll = BUL_YEARSCROLL;
this.calpage = DEF_CALPAGE;
// register in global collections
this.id = calendars.length;
calendars[this.id] = this;
}
function cal_setcalpage1(str_page) {
this.calpage = str_page;
}
function cal_setdateformat1(str_dateformat) {
this.dateFormat = str_dateformat;
}
function cal_popup1(str_datetime) {
this.dt_current = this.prs_tsmp(str_datetime ? str_datetime : this.target.value);
if (!this.dt_current) return;
var obj_calwindow = window.open(
this.calpage+'?datetime=' + this.dt_current.valueOf()+ '&id=' + this.id,
'Calendar', 'width=253,height=190'+
',status=no,resizable=no,top=200,left=200,dependent=yes,alwaysRaised=yes'
);
obj_calwindow.opener = window;
obj_calwindow.focus();
}
// timestamp generating function
function cal_gen_tsmp1(dt_datetime) {
return this.gen_date(dt_datetime);
}
// date generating function
function cal_gen_date1(dt_datetime) {
var out = this.dateFormat;
var idx;
if (out.indexOf("yyyy") != 1) {
t = out.split("yyyy");
out = t.join(dt_datetime.getFullYear());
}
else {
return cal_error("Missing year-part 'yyyy' in format: '"+this.dateFormat);
}
if (out.indexOf("mm") != 1) {
t = out.split("mm");
out = t.join((dt_datetime.getMonth() < 9 ? '0' : '')+
(dt_datetime.getMonth()+1));
}
else {
return cal_error("Missing month-part 'mm' in format: '"+this.dateFormat);
}
if (out.indexOf("dd") != 1) {
t = out.split("dd");
out = t.join((dt_datetime.getDate() < 10 ? '0' : '')+
dt_datetime.getDate());
}
else {
return cal_error("Missing day-part 'dd' in format: '"+this.dateFormat);
}
return out;
}
// timestamp parsing function
function cal_prs_tsmp1(str_datetime) {
// if no parameter specified return current timestamp
if (!str_datetime)
return (new Date());
// if positive integer treat as milliseconds from epoch
if (RE_NUM.exec(str_datetime))
return new Date(str_datetime);
return this.prs_date(str_datetime);
}
// date parsing function
function cal_prs_date1(str_date) {
var idx;
var year = null;
var month = null;
var day = null;
if (str_date.length != this.dateFormat.length) {
return cal_error ("Invalid date format: '"+str_date+
"'.\nFormat accepted is '"+this.dateFormat+"'.");
}
if ((idx = this.dateFormat.indexOf("yyyy")) != 1) {
year = str_date.substring(idx, idx+4);
}
else {
return cal_error("Missing year-part 'yyyy' in format: '"+this.dateFormat);
}
if ((idx = this.dateFormat.indexOf("mm")) != 1) {
month = str_date.substring(idx, idx+2);
}
else {
return cal_error("Missing month-part 'mm' in format: '"+this.dateFormat);
}
if ((idx = this.dateFormat.indexOf("dd")) != 1) {
day = str_date.substring(idx, idx+2);
}
else {
return cal_error("Missing day-part 'dd' in format: '"+this.dateFormat);
}
if (!day) return cal_error("Invalid date format: '"+str_date+
"'.\nNo day of month value can be found.");
if (!RE_NUM.exec(day))
return cal_error("Invalid day of month value: '"+day+
"'.\nAllowed values are unsigned integers.");
if (!month) return cal_error("Invalid date format: '"+str_date+
"'.\nNo month of year value can be found.");
if (!RE_NUM.exec(month))
return cal_error("Invalid month of year value: '"+month+
"'.\nAllowed values are unsigned integers.");
if (!year) return cal_error("Invalid date format: '"+str_date+
"'.\nNo year value can be found.");
if (!RE_NUM.exec(year))
return cal_error("Invalid year value: '"+year+
"'.\nAllowed values are unsigned integers.");
var dt_date = new Date();
dt_date.setDate(1);
if (month < 1 || month > 12)
return cal_error("Invalid month value: '"+month+
"'.\nAllowed range is 01-12.");
dt_date.setMonth(month-1);
if (year < 100) year = Number(year)+(year < NUM_CENTYEAR ? 2000 : 1900);
dt_date.setFullYear(year);
var dt_numdays = new Date(year, month, 0);
dt_date.setDate(day);
if (dt_date.getMonth() != (month-1))
return cal_error("Invalid day of month value: '"+day+
"'.\nAllowed range is 01-"+dt_numdays.getDate()+".");
return (dt_date);
}
function cal_error(str_message) {
alert (str_message);
return null;
}