diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-11-22 14:08:20 -0800 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-11-22 14:08:20 -0800 |
commit | 6f27e8db38c148172017255f9fe442c15b6a843a (patch) | |
tree | 3fe23e767da49448be5d199c405ff1f5d6bf0f4d | |
parent | 292b02b58ccb18d10de948d30ccc0cc6ba345d5e (diff) | |
parent | 4c84a2ce615be12adfbeb1067b5c6652330027bb (diff) | |
download | volse-hubzilla-6f27e8db38c148172017255f9fe442c15b6a843a.tar.gz volse-hubzilla-6f27e8db38c148172017255f9fe442c15b6a843a.tar.bz2 volse-hubzilla-6f27e8db38c148172017255f9fe442c15b6a843a.zip |
Merge https://github.com/redmatrix/hubzilla into pending_merge
Conflicts:
version.inc
-rw-r--r-- | include/datetime.php | 4 | ||||
-rw-r--r-- | include/network.php | 25 | ||||
-rw-r--r-- | include/system_unavailable.php | 4 | ||||
-rw-r--r-- | library/datetimepicker/jquery.datetimepicker.css | 645 | ||||
-rw-r--r-- | library/datetimepicker/jquery.datetimepicker.js | 576 | ||||
-rwxr-xr-x | mod/events.php | 10 | ||||
-rw-r--r-- | mod/settings.php | 5 | ||||
-rwxr-xr-x | view/tpl/event_head.tpl | 2 | ||||
-rwxr-xr-x | view/tpl/settings.tpl | 1 |
9 files changed, 920 insertions, 352 deletions
diff --git a/include/datetime.php b/include/datetime.php index b0167edb2..63287d023 100644 --- a/include/datetime.php +++ b/include/datetime.php @@ -198,7 +198,7 @@ function timesel($format, $h, $m, $id='timepicker') { * @todo Once browser support is better this could probably be replaced with * native HTML5 date picker. */ -function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false) { +function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false, $first_day = 0) { $o = ''; $dateformat = ''; @@ -234,7 +234,7 @@ function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pic $o .= "<div class='date'><input type='text' placeholder='$readable_format' name='$id' id='$id' $input_text />"; $o .= (($required) ? '<span class="required" title="' . t('Required') . '" >*</span>' : ''); $o .= '</div>'; - $o .= "<script type='text/javascript'>\$(function () {var picker = \$('#$id').datetimepicker({step:5,format:'$dateformat' $minjs $maxjs $pickers $defaultdatejs}); $extra_js})</script>"; + $o .= "<script type='text/javascript'>\$(function () {var picker = \$('#$id').datetimepicker({step:5,format:'$dateformat' $minjs $maxjs $pickers $defaultdatejs,dayOfWeekStart:$first_day}); $extra_js})</script>"; return $o; } diff --git a/include/network.php b/include/network.php index 65599bd05..026f5ee0a 100644 --- a/include/network.php +++ b/include/network.php @@ -320,17 +320,18 @@ function xml_status($st, $message = '') { killme(); } + + /** - * @brief Send HTTP status header and exit. + * @brief Send HTTP status header * * @param int $val * integer HTTP status result value * @param string $msg * optional message - * @returns (does not return, process is terminated) + * @returns nil */ -function http_status_exit($val, $msg = '') { - +function http_status($val, $msg = '') { if ($val >= 400) $msg = (($msg) ? $msg : 'Error'); if ($val >= 200 && $val < 300) @@ -338,10 +339,26 @@ function http_status_exit($val, $msg = '') { logger('http_status_exit ' . $val . ' ' . $msg); header($_SERVER['SERVER_PROTOCOL'] . ' ' . $val . ' ' . $msg); +} + + + +/** + * @brief Send HTTP status header and exit. + * + * @param int $val + * integer HTTP status result value + * @param string $msg + * optional message + * @returns (does not return, process is terminated) + */ +function http_status_exit($val, $msg = '') { + http_status($val, $msg); killme(); } + // convert an XML document to a normalised, case-corrected array // used by webfinger diff --git a/include/system_unavailable.php b/include/system_unavailable.php index 00a73fc38..4e0e6717b 100644 --- a/include/system_unavailable.php +++ b/include/system_unavailable.php @@ -1,7 +1,9 @@ <?php /** @file */ +require_once("include/network.php"); + function system_down() { -header('HTTP/1.0 503 Service Unavailable'); +http_status(503, 'Service Unavailable'); echo <<< EOT <html> <head><title>System Unavailable</title></head> diff --git a/library/datetimepicker/jquery.datetimepicker.css b/library/datetimepicker/jquery.datetimepicker.css index acf674af7..a26fccec4 100644 --- a/library/datetimepicker/jquery.datetimepicker.css +++ b/library/datetimepicker/jquery.datetimepicker.css @@ -1,37 +1,38 @@ -.xdsoft_datetimepicker{ - box-shadow: 0px 5px 15px -5px rgba(0, 0, 0, 0.506); - background: #FFFFFF; - border-bottom: 1px solid #BBBBBB; - border-left: 1px solid #CCCCCC; - border-right: 1px solid #CCCCCC; - border-top: 1px solid #CCCCCC; - color: #333333; - font-family: "Helvetica Neue", "Helvetica", "Arial", sans-serif; +.xdsoft_datetimepicker { + box-shadow: 0 5px 15px -5px rgba(0, 0, 0, 0.506); + background: #fff; + border-bottom: 1px solid #bbb; + border-left: 1px solid #ccc; + border-right: 1px solid #ccc; + border-top: 1px solid #ccc; + color: #333; + font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; padding: 8px; - padding-left: 0px; + padding-left: 0; padding-top: 2px; position: absolute; z-index: 9999; -moz-box-sizing: border-box; box-sizing: border-box; - display:none; + display: none; } .xdsoft_datetimepicker iframe { - position: absolute; - left: 0; - top: 0; - width: 75px; - height: 210px; - background: transparent; - border:none; + position: absolute; + left: 0; + top: 0; + width: 75px; + height: 210px; + background: transparent; + border: none; } + /*For IE8 or lower*/ .xdsoft_datetimepicker button { - border:none !important; + border: none !important; } -.xdsoft_noselect{ +.xdsoft_noselect { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; @@ -40,379 +41,505 @@ -o-user-select: none; user-select: none; } -.xdsoft_noselect::selection { background: transparent; } -.xdsoft_noselect::-moz-selection { background: transparent; } -.xdsoft_datetimepicker.xdsoft_inline{ + +.xdsoft_noselect::selection { background: transparent } +.xdsoft_noselect::-moz-selection { background: transparent } + +.xdsoft_datetimepicker.xdsoft_inline { display: inline-block; position: static; box-shadow: none; } -.xdsoft_datetimepicker *{ + +.xdsoft_datetimepicker * { -moz-box-sizing: border-box; box-sizing: border-box; - padding:0px; - margin:0px; + padding: 0; + margin: 0; } -.xdsoft_datetimepicker .xdsoft_datepicker, .xdsoft_datetimepicker .xdsoft_timepicker{ - display:none; + +.xdsoft_datetimepicker .xdsoft_datepicker, .xdsoft_datetimepicker .xdsoft_timepicker { + display: none; } -.xdsoft_datetimepicker .xdsoft_datepicker.active, .xdsoft_datetimepicker .xdsoft_timepicker.active{ - display:block; + +.xdsoft_datetimepicker .xdsoft_datepicker.active, .xdsoft_datetimepicker .xdsoft_timepicker.active { + display: block; } -.xdsoft_datetimepicker .xdsoft_datepicker{ + +.xdsoft_datetimepicker .xdsoft_datepicker { width: 224px; - float:left; - margin-left:8px; + float: left; + margin-left: 8px; } -.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_datepicker{ + +.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_datepicker { width: 256px; } -.xdsoft_datetimepicker .xdsoft_timepicker{ + +.xdsoft_datetimepicker .xdsoft_timepicker { width: 58px; - float:left; - text-align:center; - margin-left:8px; - margin-top:0px; + float: left; + text-align: center; + margin-left: 8px; + margin-top: 0; } -.xdsoft_datetimepicker .xdsoft_datepicker.active+.xdsoft_timepicker{ - margin-top:8px; - margin-bottom:3px + +.xdsoft_datetimepicker .xdsoft_datepicker.active+.xdsoft_timepicker { + margin-top: 8px; + margin-bottom: 3px } -.xdsoft_datetimepicker .xdsoft_mounthpicker{ + +.xdsoft_datetimepicker .xdsoft_mounthpicker { position: relative; text-align: center; } .xdsoft_datetimepicker .xdsoft_label i, -.xdsoft_datetimepicker .xdsoft_prev, -.xdsoft_datetimepicker .xdsoft_next, -.xdsoft_datetimepicker .xdsoft_today_button{ +.xdsoft_datetimepicker .xdsoft_prev, +.xdsoft_datetimepicker .xdsoft_next, +.xdsoft_datetimepicker .xdsoft_today_button { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6Q0NBRjI1NjM0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6Q0NBRjI1NjQ0M0UwMTFFNDk4NkFGMzJFQkQzQjEwRUIiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpDQ0FGMjU2MTQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpDQ0FGMjU2MjQzRTAxMUU0OTg2QUYzMkVCRDNCMTBFQiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/PoNEP54AAAIOSURBVHja7Jq9TsMwEMcxrZD4WpBYeKUCe+kTMCACHZh4BFfHO/AAIHZGFhYkBBsSEqxsLCAgXKhbXYOTxh9pfJVP+qutnZ5s/5Lz2Y5I03QhWji2GIcgAokWgfCxNvcOCCGKqiSqhUp0laHOne05vdEyGMfkdxJDVjgwDlEQgYQBgx+ULJaWSXXS6r/ER5FBVR8VfGftTKcITNs+a1XpcFoExREIDF14AVIFxgQUS+h520cdud6wNkC0UBw6BCO/HoCYwBhD8QCkQ/x1mwDyD4plh4D6DDV0TAGyo4HcawLIBBSLDkHeH0Mg2yVP3l4TQMZQDDsEOl/MgHQqhMNuE0D+oBh0CIr8MAKyazBH9WyBuKxDWgbXfjNf32TZ1KWm/Ap1oSk/R53UtQ5xTh3LUlMmT8gt6g51Q9p+SobxgJQ/qmsfZhWywGFSl0yBjCLJCMgXail3b7+rumdVJ2YRss4cN+r6qAHDkPWjPjdJCF4n9RmAD/V9A/Wp4NQassDjwlB6XBiCxcJQWmZZb8THFilfy/lfrTvLghq2TqTHrRMTKNJ0sIhdo15RT+RpyWwFdY96UZ/LdQKBGjcXpcc1AlSFEfLmouD+1knuxBDUVrvOBmoOC/rEcN7OQxKVeJTCiAdUzUJhA2Oez9QTkp72OTVcxDcXY8iKNkxGAJXmJCOQwOa6dhyXsOa6XwEGAKdeb5ET3rQdAAAAAElFTkSuQmCC); } -.xdsoft_datetimepicker .xdsoft_label i{ - opacity:0.5; - background-position:-92px -19px; +.xdsoft_datetimepicker .xdsoft_label i { + opacity: 0.5; + background-position: -92px -19px; display: inline-block; width: 9px; height: 20px; vertical-align: middle; } -.xdsoft_datetimepicker .xdsoft_prev{ - float: left; - background-position:-20px 0px; +.xdsoft_datetimepicker .xdsoft_prev { + float: left; + background-position: -20px 0; } -.xdsoft_datetimepicker .xdsoft_today_button{ - float: left; - background-position:-70px 0px; - margin-left:5px; +.xdsoft_datetimepicker .xdsoft_today_button { + float: left; + background-position: -70px 0; + margin-left: 5px; } -.xdsoft_datetimepicker .xdsoft_next{ - float: right; - background-position:0px 0px; +.xdsoft_datetimepicker .xdsoft_next { + float: right; + background-position: 0 0; } -.xdsoft_datetimepicker .xdsoft_next, -.xdsoft_datetimepicker .xdsoft_prev , -.xdsoft_datetimepicker .xdsoft_today_button{ +.xdsoft_datetimepicker .xdsoft_next, +.xdsoft_datetimepicker .xdsoft_prev , +.xdsoft_datetimepicker .xdsoft_today_button { background-color: transparent; background-repeat: no-repeat; - border: 0px none currentColor; + border: 0 none; cursor: pointer; display: block; height: 30px; opacity: 0.5; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; - outline: medium none currentColor; + outline: medium none; overflow: hidden; - padding: 0px; + padding: 0; position: relative; text-indent: 100%; white-space: nowrap; width: 20px; + min-width: 0; } -.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev, -.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_next{ - float:none; - background-position:-40px -15px; + +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev, +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_next { + float: none; + background-position: -40px -15px; height: 15px; width: 30px; display: block; - margin-left:14px; - margin-top:7px; -} -.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev{ - background-position:-40px 0px; - margin-bottom:7px; - margin-top:0px; -} -.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box{ - height:151px; - overflow:hidden; - border-bottom:1px solid #DDDDDD; -} -.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div{ - background: #F5F5F5; - border-top:1px solid #DDDDDD; - color: #666666; + margin-left: 14px; + margin-top: 7px; +} + +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_prev { + background-position: -40px 0; + margin-bottom: 7px; + margin-top: 0; +} + +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box { + height: 151px; + overflow: hidden; + border-bottom: 1px solid #ddd; +} + +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div { + background: #f5f5f5; + border-top: 1px solid #ddd; + color: #666; font-size: 12px; text-align: center; - border-collapse:collapse; - cursor:pointer; - border-bottom-width:0px; - height:25px; - line-height:25px; + border-collapse: collapse; + cursor: pointer; + border-bottom-width: 0; + height: 25px; + line-height: 25px; } -.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div > div:first-child{ - border-top-width:0px; +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div > div:first-child { + border-top-width: 0; } -.xdsoft_datetimepicker .xdsoft_today_button:hover, -.xdsoft_datetimepicker .xdsoft_next:hover, -.xdsoft_datetimepicker .xdsoft_prev:hover { - opacity: 1; - -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; + +.xdsoft_datetimepicker .xdsoft_today_button:hover, +.xdsoft_datetimepicker .xdsoft_next:hover, +.xdsoft_datetimepicker .xdsoft_prev:hover { + opacity: 1; + -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=100)"; } -.xdsoft_datetimepicker .xdsoft_label{ + +.xdsoft_datetimepicker .xdsoft_label { display: inline; - position: relative; - z-index: 9999; - margin: 0; - padding: 5px 3px; - font-size: 14px; - line-height: 20px; - font-weight: bold; - background-color: #fff; - float:left; - width:182px; - text-align:center; - cursor:pointer; -} -.xdsoft_datetimepicker .xdsoft_label:hover>span{ - text-decoration:underline; -} -.xdsoft_datetimepicker .xdsoft_label:hover i{ - opacity:1.0; -} -.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select{ - border:1px solid #ccc; - position:absolute; - right:0px; - top:30px; - z-index:101; - display:none; - background:#fff; - max-height:160px; - overflow-y:hidden; -} -.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_monthselect{right:-7px;} -.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_yearselect{right:2px;} -.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover{ + position: relative; + z-index: 9999; + margin: 0; + padding: 5px 3px; + font-size: 14px; + line-height: 20px; + font-weight: bold; + background-color: #fff; + float: left; + width: 182px; + text-align: center; + cursor: pointer; +} + +.xdsoft_datetimepicker .xdsoft_label:hover>span { + text-decoration: underline; +} + +.xdsoft_datetimepicker .xdsoft_label:hover i { + opacity: 1.0; +} + +.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select { + border: 1px solid #ccc; + position: absolute; + right: 0; + top: 30px; + z-index: 101; + display: none; + background: #fff; + max-height: 160px; + overflow-y: hidden; +} + +.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_monthselect{ right: -7px } +.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select.xdsoft_yearselect{ right: 2px } +.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover { color: #fff; - background: #ff8000; + background: #ff8000; } -.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option{ - padding:2px 10px 2px 5px; - text-decoration:none !important; + +.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option { + padding: 2px 10px 2px 5px; + text-decoration: none !important; } -.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current{ - background: #33AAFF; - box-shadow: #178FE5 0px 1px 3px 0px inset; - color:#fff; + +.xdsoft_datetimepicker .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current { + background: #33aaff; + box-shadow: #178fe5 0 1px 3px 0 inset; + color: #fff; font-weight: 700; } -.xdsoft_datetimepicker .xdsoft_month{ - width:100px; - text-align:right; + +.xdsoft_datetimepicker .xdsoft_month { + width: 100px; + text-align: right; } -.xdsoft_datetimepicker .xdsoft_calendar{ - clear:both; + +.xdsoft_datetimepicker .xdsoft_calendar { + clear: both; } -.xdsoft_datetimepicker .xdsoft_year{ + +.xdsoft_datetimepicker .xdsoft_year{ width: 48px; margin-left: 5px; } -.xdsoft_datetimepicker .xdsoft_calendar table{ - border-collapse:collapse; - width:100%; - + +.xdsoft_datetimepicker .xdsoft_calendar table { + border-collapse: collapse; + width: 100%; + } -.xdsoft_datetimepicker .xdsoft_calendar td > div{ - padding-right:5px; + +.xdsoft_datetimepicker .xdsoft_calendar td > div { + padding-right: 5px; } -.xdsoft_datetimepicker .xdsoft_calendar th{ + +.xdsoft_datetimepicker .xdsoft_calendar th { height: 25px; } -.xdsoft_datetimepicker .xdsoft_calendar td,.xdsoft_datetimepicker .xdsoft_calendar th{ - width:14.2857142%; - background: #F5F5F5; - border:1px solid #DDDDDD; - color: #666666; + +.xdsoft_datetimepicker .xdsoft_calendar td,.xdsoft_datetimepicker .xdsoft_calendar th { + width: 14.2857142%; + background: #f5f5f5; + border: 1px solid #ddd; + color: #666; font-size: 12px; text-align: right; vertical-align: middle; - padding:0px; - border-collapse:collapse; - cursor:pointer; + padding: 0; + border-collapse: collapse; + cursor: pointer; height: 25px; } -.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar td,.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar th{ - width:12.5%; +.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar td,.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_calendar th { + width: 12.5%; } -.xdsoft_datetimepicker .xdsoft_calendar th{ - background: #F1F1F1; + +.xdsoft_datetimepicker .xdsoft_calendar th { + background: #f1f1f1; +} + +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today { + color: #33aaff; } -.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today{ - color:#33AAFF; + +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_highlighted_default { + background: #ffe9d2; + box-shadow: #ffb871 0 1px 4px 0 inset; + color: #000; } -.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default, -.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current, -.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current{ - background: #33AAFF; - box-shadow: #178FE5 0px 1px 3px 0px inset; - color:#fff; +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_highlighted_mint { + background: #c1ffc9; + box-shadow: #00dd1c 0 1px 4px 0 inset; + color: #000; +} + +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_default, +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current, +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current { + background: #33aaff; + box-shadow: #178fe5 0 1px 3px 0 inset; + color: #fff; font-weight: 700; } -.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month, -.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled, -.xdsoft_datetimepicker .xdsoft_time_box >div >div.xdsoft_disabled{ - opacity:0.5; + +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month, +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled, +.xdsoft_datetimepicker .xdsoft_time_box >div >div.xdsoft_disabled { + opacity: 0.5; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)"; + cursor: default; } -.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled{ - opacity:0.2; + +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_other_month.xdsoft_disabled { + opacity: 0.2; -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=20)"; } -.xdsoft_datetimepicker .xdsoft_calendar td:hover, -.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div:hover{ + +.xdsoft_datetimepicker .xdsoft_calendar td:hover, +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div:hover { + color: #fff !important; + background: #ff8000 !important; + box-shadow: none !important; +} + +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_current.xdsoft_disabled:hover, +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box>div>div.xdsoft_current.xdsoft_disabled:hover { + background: #33aaff !important; + box-shadow: #178fe5 0 1px 3px 0 inset !important; color: #fff !important; - background: #ff8000 !important; - box-shadow: none !important; } -.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled:hover, -.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_disabled:hover{ + +.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_disabled:hover, +.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_disabled:hover { color: inherit !important; - background: inherit !important; - box-shadow: inherit !important; + background: inherit !important; + box-shadow: inherit !important; } -.xdsoft_datetimepicker .xdsoft_calendar th{ + +.xdsoft_datetimepicker .xdsoft_calendar th { font-weight: 700; text-align: center; color: #999; - cursor:default; + cursor: default; } -.xdsoft_datetimepicker .xdsoft_copyright{ color:#ccc !important; font-size:10px;clear:both;float:none;margin-left:8px;} -.xdsoft_datetimepicker .xdsoft_copyright a{ color:#eee !important;} -.xdsoft_datetimepicker .xdsoft_copyright a:hover{ color:#aaa !important;} +.xdsoft_datetimepicker .xdsoft_copyright { + color: #ccc !important; + font-size: 10px; + clear: both; + float: none; + margin-left: 8px; +} + +.xdsoft_datetimepicker .xdsoft_copyright a { color: #eee !important } +.xdsoft_datetimepicker .xdsoft_copyright a:hover { color: #aaa !important } -.xdsoft_time_box{ - position:relative; - border:1px solid #ccc; +.xdsoft_time_box { + position: relative; + border: 1px solid #ccc; } -.xdsoft_scrollbar >.xdsoft_scroller{ - background:#ccc !important; - height:20px; - border-radius:3px; +.xdsoft_scrollbar >.xdsoft_scroller { + background: #ccc !important; + height: 20px; + border-radius: 3px; } -.xdsoft_scrollbar{ - position:absolute; - width:7px; - right:0px; - top:0px; - bottom:0px; - cursor:pointer; +.xdsoft_scrollbar { + position: absolute; + width: 7px; + right: 0; + top: 0; + bottom: 0; + cursor: pointer; } -.xdsoft_scroller_box{ -position:relative; +.xdsoft_scroller_box { + position: relative; } - -.xdsoft_datetimepicker.xdsoft_dark{ - box-shadow: 0px 5px 15px -5px rgba(255, 255, 255, 0.506); - background: #000000; - border-bottom: 1px solid #444444; - border-left: 1px solid #333333; - border-right: 1px solid #333333; - border-top: 1px solid #333333; - color: #cccccc; +.xdsoft_datetimepicker.xdsoft_dark { + box-shadow: 0 5px 15px -5px rgba(255, 255, 255, 0.506); + background: #000; + border-bottom: 1px solid #444; + border-left: 1px solid #333; + border-right: 1px solid #333; + border-top: 1px solid #333; + color: #ccc; } -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box{ - border-bottom:1px solid #222222; +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box { + border-bottom: 1px solid #222; } -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div{ +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div { background: #0a0a0a; - border-top:1px solid #222222; - color: #999999; + border-top: 1px solid #222; + color: #999; } -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label{ - background-color: #000; +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label { + background-color: #000; } -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select{ - border:1px solid #333; - background:#000; +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select { + border: 1px solid #333; + background: #000; } -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover{ +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option:hover { color: #000; - background: #007fff; + background: #007fff; } -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current{ +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label > .xdsoft_select > div > .xdsoft_option.xdsoft_current { background: #cc5500; - box-shadow: #b03e00 0px 1px 3px 0px inset; - color:#000; + box-shadow: #b03e00 0 1px 3px 0 inset; + color: #000; } -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label i, -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_prev, -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_next, -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_today_button{ +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_label i, +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_prev, +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_next, +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_today_button { background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoV2luZG93cykiIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUExQUUzOTA0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUExQUUzOTE0M0UyMTFFNDlBM0FFQTJENTExRDVBODYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQTFBRTM4RTQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQTFBRTM4RjQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pp0VxGEAAAIASURBVHja7JrNSgMxEMebtgh+3MSLr1T1Xn2CHoSKB08+QmR8Bx9A8e7RixdB9CKCoNdexIugxFlJa7rNZneTbLIpM/CnNLsdMvNjM8l0mRCiQ9Ye61IKCAgZAUnH+mU3MMZaHYChBnJUDzWOFZdVfc5+ZFLbrWDeXPwbxIqrLLfaeS0hEBVGIRQCEiZoHQwtlGSByCCdYBl8g8egTTAWoKQMRBRBcZxYlhzhKegqMOageErsCHVkk3hXIFooDgHB1KkHIHVgzKB4ADJQ/A1jAFmAYhkQqA5TOBtocrKrgXwQA8gcFIuAIO8sQSA7hidvPwaQGZSaAYHOUWJABhWWw2EMIH9QagQERU4SArJXo0ZZL18uvaxejXt/Em8xjVBXmvFr1KVm/AJ10tRe2XnraNqaJvKE3KHuUbfK1E+VHB0q40/y3sdQSxY4FHWeKJCunP8UyDdqJZenT3ntVV5jIYCAh20vT7ioP8tpf6E2lfEMwERe+whV1MHjwZB7PBiCxcGQWwKZKD62lfGNnP/1poFAA60T7rF1UgcKd2id3KDeUS+oLWV8DfWAepOfq00CgQabi9zjcgJVYVD7PVzQUAUGAQkbNJTBICDhgwYTjDYD6XeW08ZKh+A4pYkzenOxXUbvZcWz7E8ykRMnIHGX1XPl+1m2vPYpL+2qdb8CDAARlKFEz/ZVkAAAAABJRU5ErkJggg==); } -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td, -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th{ +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td, +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th { background: #0a0a0a; - border:1px solid #222222; - color: #999999; + border: 1px solid #222; + color: #999; } -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th{ +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th { background: #0e0e0e; } -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_today{ - color:#cc5500; + +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_today { + color: #cc5500; } -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_default, -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_current, -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current{ - background: #cc5500; - box-shadow: #b03e00 0px 1px 3px 0px inset; + +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_highlighted_default { + background: #ffe9d2; + box-shadow: #ffb871 0 1px 4px 0 inset; color:#000; } +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_highlighted_mint { + background: #c1ffc9; + box-shadow: #00dd1c 0 1px 4px 0 inset; + color:#000; +} + +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_default, +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td.xdsoft_current, +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div.xdsoft_current { + background: #cc5500; + box-shadow: #b03e00 0 1px 3px 0 inset; + color: #000; +} -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td:hover, -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div:hover{ +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar td:hover, +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div:hover { color: #000 !important; - background: #007fff !important; + background: #007fff !important; } -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th{ +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_calendar th { color: #666; } -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright{ color:#333 !important;} -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a{ color:#111 !important;} -.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a:hover{ color:#555 !important;} +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright { color: #333 !important } +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a { color: #111 !important } +.xdsoft_datetimepicker.xdsoft_dark .xdsoft_copyright a:hover { color: #555 !important } -.xdsoft_dark .xdsoft_time_box{ - border:1px solid #333; +.xdsoft_dark .xdsoft_time_box { + border: 1px solid #333; } -.xdsoft_dark .xdsoft_scrollbar >.xdsoft_scroller{ - background:#333 !important; + +.xdsoft_dark .xdsoft_scrollbar >.xdsoft_scroller { + background: #333 !important; +} +.xdsoft_datetimepicker .xdsoft_save_selected { + display: block; + border: 1px solid #dddddd !important; + margin-top: 5px; + width: 100%; + color: #454551; + font-size: 13px; +} +.xdsoft_datetimepicker .blue-gradient-button { + font-family: "museo-sans", "Book Antiqua", sans-serif; + font-size: 12px; + font-weight: 300; + color: #82878c; + height: 28px; + position: relative; + padding: 4px 17px 4px 33px; + border: 1px solid #d7d8da; + background: -moz-linear-gradient(top, #fff 0%, #f4f8fa 73%); + /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #fff), color-stop(73%, #f4f8fa)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #fff 0%, #f4f8fa 73%); + /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #fff 0%, #f4f8fa 73%); + /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #fff 0%, #f4f8fa 73%); + /* IE10+ */ + background: linear-gradient(to bottom, #fff 0%, #f4f8fa 73%); + /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#fff', endColorstr='#f4f8fa',GradientType=0 ); +/* IE6-9 */ +} +.xdsoft_datetimepicker .blue-gradient-button:hover, .xdsoft_datetimepicker .blue-gradient-button:focus, .xdsoft_datetimepicker .blue-gradient-button:hover span, .xdsoft_datetimepicker .blue-gradient-button:focus span { + color: #454551; + background: -moz-linear-gradient(top, #f4f8fa 0%, #FFF 73%); + /* FF3.6+ */ + background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #f4f8fa), color-stop(73%, #FFF)); + /* Chrome,Safari4+ */ + background: -webkit-linear-gradient(top, #f4f8fa 0%, #FFF 73%); + /* Chrome10+,Safari5.1+ */ + background: -o-linear-gradient(top, #f4f8fa 0%, #FFF 73%); + /* Opera 11.10+ */ + background: -ms-linear-gradient(top, #f4f8fa 0%, #FFF 73%); + /* IE10+ */ + background: linear-gradient(to bottom, #f4f8fa 0%, #FFF 73%); + /* W3C */ + filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#f4f8fa', endColorstr='#FFF',GradientType=0 ); + /* IE6-9 */ } diff --git a/library/datetimepicker/jquery.datetimepicker.js b/library/datetimepicker/jquery.datetimepicker.js index d4e93dd13..9c00413c2 100644 --- a/library/datetimepicker/jquery.datetimepicker.js +++ b/library/datetimepicker/jquery.datetimepicker.js @@ -1,9 +1,9 @@ /** - * @preserve jQuery DateTimePicker plugin v2.4.0 + * @preserve jQuery DateTimePicker plugin v2.4.5 * @homepage http://xdsoft.net/jqplugins/datetimepicker/ * (c) 2014, Chupurnov Valeriy. */ -/*global document,window,jQuery,setTimeout,clearTimeout*/ +/*global document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/ (function ($) { 'use strict'; var default_options = { @@ -29,7 +29,15 @@ "Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember" ], dayOfWeek: [ - "Sen", "Sel", "Rab", "Kam", "Jum", "Sab", "Min" + "Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab" + ] + }, + is: { // Icelandic + months: [ + "Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember" + ], + dayOfWeek: [ + "Sun", "Mán", "Þrið", "Mið", "Fim", "Fös", "Lau" ] }, bg: { // Bulgarian @@ -231,7 +239,207 @@ dayOfWeek: [ "Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo" ] - } + }, + az: { //Azerbaijanian (Azeri) + months: [ + "Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr" + ], + dayOfWeek: [ + "B", "Be", "Ça", "Ç", "Ca", "C", "Ş" + ] + }, + bs: { //Bosanski + months: [ + "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" + ], + dayOfWeek: [ + "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub" + ] + }, + ca: { //Català + months: [ + "Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre" + ], + dayOfWeek: [ + "Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds" + ] + }, + 'en-GB': { //English (British) + months: [ + "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" + ], + dayOfWeek: [ + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + ] + }, + et: { //"Eesti" + months: [ + "Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember" + ], + dayOfWeek: [ + "P", "E", "T", "K", "N", "R", "L" + ] + }, + eu: { //Euskara + months: [ + "Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua" + ], + dayOfWeek: [ + "Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La." + ] + }, + fi: { //Finnish (Suomi) + months: [ + "Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu" + ], + dayOfWeek: [ + "Su", "Ma", "Ti", "Ke", "To", "Pe", "La" + ] + }, + gl: { //Galego + months: [ + "Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec" + ], + dayOfWeek: [ + "Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab" + ] + }, + hr: { //Hrvatski + months: [ + "Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac" + ], + dayOfWeek: [ + "Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub" + ] + }, + ko: { //Korean (한국어) + months: [ + "1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월" + ], + dayOfWeek: [ + "일", "월", "화", "수", "목", "금", "토" + ] + }, + lt: { //Lithuanian (lietuvių) + months: [ + "Sausio", "Vasario", "Kovo", "Balandžio", "Gegužės", "Birželio", "Liepos", "Rugpjūčio", "Rugsėjo", "Spalio", "Lapkričio", "Gruodžio" + ], + dayOfWeek: [ + "Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš" + ] + }, + lv: { //Latvian (Latviešu) + months: [ + "Janvāris", "Februāris", "Marts", "Aprīlis ", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris" + ], + dayOfWeek: [ + "Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St" + ] + }, + mk: { //Macedonian (Македонски) + months: [ + "јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември" + ], + dayOfWeek: [ + "нед", "пон", "вто", "сре", "чет", "пет", "саб" + ] + }, + mn: { //Mongolian (Монгол) + months: [ + "1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар" + ], + dayOfWeek: [ + "Дав", "Мяг", "Лха", "Пүр", "Бсн", "Бям", "Ням" + ] + }, + 'pt-BR': { //Português(Brasil) + months: [ + "Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro" + ], + dayOfWeek: [ + "Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb" + ] + }, + sk: { //Slovenčina + months: [ + "Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December" + ], + dayOfWeek: [ + "Ne", "Po", "Ut", "St", "Št", "Pi", "So" + ] + }, + sq: { //Albanian (Shqip) + months: [ + "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" + ], + dayOfWeek: [ + "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" + ] + }, + 'sr-YU': { //Serbian (Srpski) + months: [ + "Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar" + ], + dayOfWeek: [ + "Ned", "Pon", "Uto", "Sre", "čet", "Pet", "Sub" + ] + }, + sr: { //Serbian Cyrillic (Српски) + months: [ + "јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар" + ], + dayOfWeek: [ + "нед", "пон", "уто", "сре", "чет", "пет", "суб" + ] + }, + sv: { //Svenska + months: [ + "Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December" + ], + dayOfWeek: [ + "Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör" + ] + }, + 'zh-TW': { //Traditional Chinese (繁體中文) + months: [ + "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" + ], + dayOfWeek: [ + "日", "一", "二", "三", "四", "五", "六" + ] + }, + zh: { //Simplified Chinese (简体中文) + months: [ + "一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月" + ], + dayOfWeek: [ + "日", "一", "二", "三", "四", "五", "六" + ] + }, + he: { //Hebrew (עברית) + months: [ + 'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר' + ], + dayOfWeek: [ + 'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'שבת' + ] + }, + hy: { // Armenian + months: [ + "Հունվար", "Փետրվար", "Մարտ", "Ապրիլ", "Մայիս", "Հունիս", "Հուլիս", "Օգոստոս", "Սեպտեմբեր", "Հոկտեմբեր", "Նոյեմբեր", "Դեկտեմբեր" + ], + dayOfWeek: [ + "Կի", "Երկ", "Երք", "Չոր", "Հնգ", "Ուրբ", "Շբթ" + ] + }, + kg: { // Kyrgyz + months: [ + 'Үчтүн айы', 'Бирдин айы', 'Жалган Куран', 'Чын Куран', 'Бугу', 'Кулжа', 'Теке', 'Баш Оона', 'Аяк Оона', 'Тогуздун айы', 'Жетинин айы', 'Бештин айы' + ], + dayOfWeek: [ + "Жек", "Дүй", "Шей", "Шар", "Бей", "Жум", "Ише" + ] + } }, value: '', lang: 'en', @@ -245,6 +453,7 @@ monthChangeSpinner: true, closeOnDateSelect: false, + closeOnTimeSelect: true, closeOnWithoutClick: true, closeOnInputClick: true, @@ -259,6 +468,8 @@ maxDate: false, minTime: false, maxTime: false, + disabledMinTime: false, + disabledMaxTime: false, allowTimes: [], opened: false, @@ -278,13 +489,15 @@ withoutCopyright: true, inverseButton: false, hours12: false, - next: 'xdsoft_next', + next: 'xdsoft_next', prev : 'xdsoft_prev', dayOfWeekStart: 0, parentID: 'body', timeHeightInTimePicker: 25, timepickerScrollbar: true, todayButton: true, + prevButton: true, + nextButton: true, defaultSelect: true, scrollMonth: true, @@ -297,19 +510,43 @@ allowBlank: true, yearStart: 1950, yearEnd: 2050, + monthStart: 0, + monthEnd: 11, style: '', id: '', fixed: false, roundTime: 'round', // ceil, floor className: '', weekends: [], + highlightedDates: [], + highlightedPeriods: [], disabledDates : [], + disabledWeekDays: [], yearOffset: 0, beforeShowDay: null, - enterLikeTab: true + enterLikeTab: true, + showApplyButton: false }; // fix for ie8 + if (!window.getComputedStyle) { + window.getComputedStyle = function (el, pseudo) { + this.el = el; + this.getPropertyValue = function (prop) { + var re = /(\-([a-z]){1})/g; + if (prop === 'float') { + prop = 'styleFloat'; + } + if (re.test(prop)) { + prop = prop.replace(re, function (a, b, c) { + return c.toUpperCase(); + }); + } + return el.currentStyle[prop] || null; + }; + return this; + }; + } if (!Array.prototype.indexOf) { Array.prototype.indexOf = function (obj, start) { var i, j; @@ -506,12 +743,11 @@ lazyInitTimer = 0, createDateTimePicker, destroyDateTimePicker, - _xdsoft_datetime, lazyInit = function (input) { input .on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function initOnActionCallback(event) { - if (input.is(':disabled') || input.is(':hidden') || !input.is(':visible') || input.data('xdsoft_datetimepicker')) { + if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) { return; } clearTimeout(lazyInitTimer); @@ -528,7 +764,7 @@ }; createDateTimePicker = function (input) { - var datetimepicker = $('<div ' + (options.id ? 'id="' + options.id + '"' : '') + ' ' + (options.style ? 'style="' + options.style + '"' : '') + ' class="xdsoft_datetimepicker xdsoft_' + options.theme + ' xdsoft_noselect ' + (options.weeks ? ' xdsoft_showweeks' : '') + options.className + '"></div>'), + var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'), xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'), datepicker = $('<div class="xdsoft_datepicker active"></div>'), mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' + @@ -539,6 +775,7 @@ timepicker = $('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'), timeboxparent = timepicker.find('.xdsoft_time_box').eq(0), timebox = $('<div class="xdsoft_time_variant"></div>'), + applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'), /*scrollbar = $('<div class="xdsoft_scrollbar"></div>'), scroller = $('<div class="xdsoft_scroller"></div>'),*/ monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'), @@ -551,7 +788,21 @@ current_time_index, setPos, timer = 0, - timer1 = 0; + timer1 = 0, + _xdsoft_datetime; + + if (options.id) { + datetimepicker.attr('id', options.id); + } + if (options.style) { + datetimepicker.attr('style', options.style); + } + if (options.weeks) { + datetimepicker.addClass('xdsoft_showweeks'); + } + + datetimepicker.addClass('xdsoft_' + options.theme); + datetimepicker.addClass(options.className); mounth_picker .find('.xdsoft_month span') @@ -599,6 +850,11 @@ event.preventDefault(); }) .on('mousedown.xdsoft', '.xdsoft_option', function (event) { + + if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { + _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); + } + var year = _xdsoft_datetime.currentTime.getFullYear(); if (_xdsoft_datetime && _xdsoft_datetime.currentTime) { _xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value')); @@ -617,6 +873,48 @@ }); datetimepicker.setOptions = function (_options) { + var highlightedDates = {}, + getCaretPos = function (input) { + try { + if (document.selection && document.selection.createRange) { + var range = document.selection.createRange(); + return range.getBookmark().charCodeAt(2) - 2; + } + if (input.setSelectionRange) { + return input.selectionStart; + } + } catch (e) { + return 0; + } + }, + setCaretPos = function (node, pos) { + node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node; + if (!node) { + return false; + } + if (node.createTextRange) { + var textRange = node.createTextRange(); + textRange.collapse(true); + textRange.moveEnd('character', pos); + textRange.moveStart('character', pos); + textRange.select(); + return true; + } + if (node.setSelectionRange) { + node.setSelectionRange(pos, pos); + return true; + } + return false; + }, + isValidValue = function (mask, value) { + var reg = mask + .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1') + .replace(/_/g, '{digit+}') + .replace(/([0-9]{1})/g, '{digit$1}') + .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}') + .replace(/\{digit[\+]\}/g, '[0-9_]{1}'); + return (new RegExp(reg)).test(value); + }; options = $.extend(true, {}, options, _options); if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) { @@ -627,9 +925,62 @@ options.weekends = $.extend(true, [], _options.weekends); } + if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) { + $.each(_options.highlightedDates, function (index, value) { + var splitData = $.map(value.split(','), $.trim), + exDesc, + hDate = new HighlightedDate(Date.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style + keyDate = hDate.date.dateFormat(options.formatDate); + if (highlightedDates[keyDate] !== undefined) { + exDesc = highlightedDates[keyDate].desc; + if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { + highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; + } + } else { + highlightedDates[keyDate] = hDate; + } + }); + + options.highlightedDates = $.extend(true, [], highlightedDates); + } + + if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) { + highlightedDates = $.extend(true, [], options.highlightedDates); + $.each(_options.highlightedPeriods, function (index, value) { + var splitData = $.map(value.split(','), $.trim), + dateTest = Date.parseDate(splitData[0], options.formatDate), // start date + dateEnd = Date.parseDate(splitData[1], options.formatDate), + desc = splitData[2], + hDate, + keyDate, + exDesc, + style = splitData[3]; + + while (dateTest <= dateEnd) { + hDate = new HighlightedDate(dateTest, desc, style); + keyDate = dateTest.dateFormat(options.formatDate); + dateTest.setDate(dateTest.getDate() + 1); + if (highlightedDates[keyDate] !== undefined) { + exDesc = highlightedDates[keyDate].desc; + if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) { + highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc; + } + } else { + highlightedDates[keyDate] = hDate; + } + } + }); + + options.highlightedDates = $.extend(true, [], highlightedDates); + } + if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) { - options.disabledDates = $.extend(true, [], _options.disabledDates); - } + options.disabledDates = $.extend(true, [], _options.disabledDates); + } + + if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) { + options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays); + } if ((options.open || options.opened) && (!options.inline)) { input.trigger('open.xdsoft'); @@ -659,10 +1010,10 @@ } if (options.value) { + _xdsoft_datetime.setCurrentTime(options.value); if (input && input.val) { - input.val(options.value); + input.val(_xdsoft_datetime.str); } - _xdsoft_datetime.setCurrentTime(options.value); } if (isNaN(options.dayOfWeekStart)) { @@ -683,53 +1034,21 @@ options.maxDate = _xdsoft_datetime.strToDateTime(options.maxDate).dateFormat(options.formatDate); } + applyButton.toggle(options.showApplyButton); + mounth_picker .find('.xdsoft_today_button') .css('visibility', !options.todayButton ? 'hidden' : 'visible'); + mounth_picker + .find('.' + options.prev) + .css('visibility', !options.prevButton ? 'hidden' : 'visible'); + + mounth_picker + .find('.' + options.next) + .css('visibility', !options.nextButton ? 'hidden' : 'visible'); + if (options.mask) { - var e, - getCaretPos = function (input) { - try { - if (document.selection && document.selection.createRange) { - var range = document.selection.createRange(); - return range.getBookmark().charCodeAt(2) - 2; - } - if (input.setSelectionRange) { - return input.selectionStart; - } - } catch (e) { - return 0; - } - }, - setCaretPos = function (node, pos) { - node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node; - if (!node) { - return false; - } - if (node.createTextRange) { - var textRange = node.createTextRange(); - textRange.collapse(true); - textRange.moveEnd('character', pos); - textRange.moveStart('character', pos); - textRange.select(); - return true; - } - if (node.setSelectionRange) { - node.setSelectionRange(pos, pos); - return true; - } - return false; - }, - isValidValue = function (mask, value) { - var reg = mask - .replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1') - .replace(/_/g, '{digit+}') - .replace(/([0-9]{1})/g, '{digit$1}') - .replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}') - .replace(/\{digit[\+]\}/g, '[0-9_]{1}'); - return (new RegExp(reg)).test(value); - }; input.off('keydown.xdsoft'); if (options.mask === true) { @@ -809,11 +1128,23 @@ $(this).val(null); datetimepicker.data('xdsoft_datetime').empty(); } else if (!Date.parseDate($(this).val(), options.format)) { - $(this).val((_xdsoft_datetime.now()).dateFormat(options.format)); + var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')), + splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join('')); + + // parse the numbers as 0312 => 03:12 + if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) { + $(this).val([splittedHours, splittedMinutes].map(function (item) { + return item > 9 ? item : '0' + item; + }).join(':')); + } else { + $(this).val((_xdsoft_datetime.now()).dateFormat(options.format)); + } + datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); } else { datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val()); } + datetimepicker.trigger('changedatetime.xdsoft'); }); } @@ -853,7 +1184,8 @@ datepicker .append(mounth_picker) - .append(calendar); + .append(calendar) + .append(applyButton); $(options.parentID) .append(datetimepicker); @@ -866,7 +1198,7 @@ time; if (!norecursion && options.defaultDate) { - date = _this.strToDate(options.defaultDate); + date = _this.strToDateTime(options.defaultDate); d.setFullYear(date.getFullYear()); d.setMonth(date.getMonth()); d.setDate(date.getDate()); @@ -881,7 +1213,6 @@ d.setHours(time.getHours()); d.setMinutes(time.getMinutes()); } - return d; }; @@ -906,6 +1237,11 @@ }; _this.nextMonth = function () { + + if (_this.currentTime === undefined || _this.currentTime === null) { + _this.currentTime = _this.now(); + } + var month = _this.currentTime.getMonth() + 1, year; if (month === 12) { @@ -936,6 +1272,11 @@ }; _this.prevMonth = function () { + + if (_this.currentTime === undefined || _this.currentTime === null) { + _this.currentTime = _this.now(); + } + var month = _this.currentTime.getMonth() - 1; if (month === -1) { _this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1); @@ -973,7 +1314,7 @@ } if (tmpDate && tmpDate[2]) { timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000; - currentTime = new Date((_xdsoft_datetime.now()).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset); + currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset); } else { currentTime = sDateTime ? Date.parseDate(sDateTime, options.format) : _this.now(); } @@ -1016,6 +1357,13 @@ _xdsoft_datetime = new XDSoft_datetime(); + applyButton.on('click', function (e) {//pathbrite + e.preventDefault(); + datetimepicker.data('changed', true); + _xdsoft_datetime.setCurrentTime(getCurrentValue()); + input.val(_xdsoft_datetime.str()); + datetimepicker.trigger('close.xdsoft'); + }); mounth_picker .find('.xdsoft_today_button') .on('mousedown.xdsoft', function () { @@ -1023,6 +1371,18 @@ _xdsoft_datetime.setCurrentTime(0); datetimepicker.trigger('afterOpen.xdsoft'); }).on('dblclick.xdsoft', function () { + var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate; + currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate()); + minDate = _xdsoft_datetime.strToDate(options.minDate); + minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate()); + if (currentDate < minDate) { + return; + } + maxDate = _xdsoft_datetime.strToDate(options.maxDate); + maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate()); + if (currentDate > maxDate) { + return; + } input.val(_xdsoft_datetime.str()); datetimepicker.trigger('close.xdsoft'); }); @@ -1034,7 +1394,6 @@ stop = false; (function arguments_callee1(v) { - var month = _xdsoft_datetime.currentTime.getMonth(); if ($this.hasClass(options.next)) { _xdsoft_datetime.nextMonth(); } else if ($this.hasClass(options.prev)) { @@ -1090,6 +1449,11 @@ .on('xchange.xdsoft', function (event) { clearTimeout(xchangeTimer); xchangeTimer = setTimeout(function () { + + if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) { + _xdsoft_datetime.currentTime = _xdsoft_datetime.now(); + } + var table = '', start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0), i = 0, @@ -1097,6 +1461,8 @@ today = _xdsoft_datetime.now(), maxDate = false, minDate = false, + hDate, + day, d, y, m, @@ -1106,7 +1472,8 @@ newRow = true, time = '', h = '', - line_time; + line_time, + description; while (start.getDay() !== options.dayOfWeekStart) { start.setDate(start.getDate() - 1); @@ -1139,10 +1506,12 @@ classes = []; i += 1; + day = start.getDay(); d = start.getDate(); y = start.getFullYear(); m = start.getMonth(); w = _xdsoft_datetime.getWeekOfYear(start); + description = ''; classes.push('xdsoft_date'); @@ -1156,6 +1525,8 @@ classes.push('xdsoft_disabled'); } else if (options.disabledDates.indexOf(start.dateFormat(options.formatDate)) !== -1) { classes.push('xdsoft_disabled'); + } else if (options.disabledWeekDays.indexOf(day) !== -1) { + classes.push('xdsoft_disabled'); } if (customDateSettings && customDateSettings[1] !== "") { @@ -1174,10 +1545,16 @@ classes.push('xdsoft_today'); } - if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(start.dateFormat(options.formatDate)) === -1) { + if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(start.dateFormat(options.formatDate)) !== -1) { classes.push('xdsoft_weekend'); } + if (options.highlightedDates[start.dateFormat(options.formatDate)] !== undefined) { + hDate = options.highlightedDates[start.dateFormat(options.formatDate)]; + classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style); + description = hDate.desc === undefined ? '' : hDate.desc; + } + if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) { classes.push(options.beforeShowDay(start)); } @@ -1190,7 +1567,7 @@ } } - table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '">' + + table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' + '<div>' + d + '</div>' + '</td>'; @@ -1213,17 +1590,27 @@ h = ''; m = ''; line_time = function line_time(h, m) { - var now = _xdsoft_datetime.now(); + var now = _xdsoft_datetime.now(), optionDateTime, current_time; now.setHours(h); h = parseInt(now.getHours(), 10); now.setMinutes(m); m = parseInt(now.getMinutes(), 10); - + optionDateTime = new Date(_xdsoft_datetime.currentTime); + optionDateTime.setHours(h); + optionDateTime.setMinutes(m); classes = []; - if ((options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) { + if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || (options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) { classes.push('xdsoft_disabled'); } - if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && parseInt(_xdsoft_datetime.currentTime.getHours(), 10) === parseInt(h, 10) && (options.step > 59 || Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step === parseInt(m, 10))) { + if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) { + classes.push('xdsoft_disabled'); + } + + current_time = new Date(_xdsoft_datetime.currentTime); + current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10)); + current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step); + + if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && (options.step > 59 || current_time.getMinutes() === parseInt(m, 10))) { if (options.defaultSelect || datetimepicker.data('changed')) { classes.push('xdsoft_current'); } else if (options.initTime) { @@ -1263,7 +1650,7 @@ yearselect.children().eq(0) .html(opt); - for (i = 0, opt = ''; i <= 11; i += 1) { + for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) { opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[options.lang].months[i] + '</div>'; } monthselect.children().eq(0).html(opt); @@ -1319,7 +1706,7 @@ datetimepicker.trigger('select.xdsoft', [currentTime]); input.val(_xdsoft_datetime.str()); - if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === 0 && !options.timepicker))) && !options.inline) { + if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) { datetimepicker.trigger('close.xdsoft'); } @@ -1354,9 +1741,10 @@ datetimepicker.trigger('select.xdsoft', [currentTime]); datetimepicker.data('input').val(_xdsoft_datetime.str()); - if (!options.inline) { - datetimepicker.trigger('close.xdsoft'); - } + + if (options.inline !== true && options.closeOnTimeSelect === true) { + datetimepicker.trigger('close.xdsoft'); + } if (options.onSelectTime && $.isFunction(options.onSelectTime)) { options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent); @@ -1430,7 +1818,7 @@ current_time_index = 0; setPos = function () { - var offset = datetimepicker.data('input').offset(), top = offset.top + datetimepicker.data('input')[0].offsetHeight - 1, left = offset.left, position = "absolute"; + var offset = datetimepicker.data('input').offset(), top = offset.top + datetimepicker.data('input')[0].offsetHeight - 1, left = offset.left, position = "absolute", node; if (options.fixed) { top -= $(window).scrollTop(); left -= $(window).scrollLeft(); @@ -1446,6 +1834,15 @@ left = $(window).width() - datetimepicker[0].offsetWidth; } } + + node = datetimepicker[0]; + do { + node = node.parentNode; + if (window.getComputedStyle(node).getPropertyValue('position') === 'relative' && $(window).width() >= node.offsetWidth) { + left = left - (($(window).width() - node.offsetWidth) / 2); + break; + } + } while (node.nodeName !== 'HTML'); datetimepicker.css({ left: left, top: top, @@ -1488,7 +1885,11 @@ event.stopPropagation(); }) .on('toggle.xdsoft', function (event) { - datetimepicker.is(':visible') ? datetimepicker.trigger('close.xdsoft') : datetimepicker.trigger('open.xdsoft'); + if (datetimepicker.is(':visible')) { + datetimepicker.trigger('close.xdsoft'); + } else { + datetimepicker.trigger('open.xdsoft'); + } }) .data('input', input); @@ -1499,7 +1900,6 @@ datetimepicker.setOptions(options); function getCurrentValue() { - var ct = false, time; if (options.startDate) { @@ -1509,7 +1909,7 @@ if (ct) { ct = _xdsoft_datetime.strToDateTime(ct); } else if (options.defaultDate) { - ct = _xdsoft_datetime.strToDate(options.defaultDate); + ct = _xdsoft_datetime.strToDateTime(options.defaultDate); if (options.defaultTime) { time = _xdsoft_datetime.strtotime(options.defaultTime); ct.setHours(time.getHours()); @@ -1532,12 +1932,12 @@ input .data('xdsoft_datetimepicker', datetimepicker) .on('open.xdsoft focusin.xdsoft mousedown.xdsoft', function (event) { - if (input.is(':disabled') || input.is(':hidden') || !input.is(':visible') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) { + if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) { return; } clearTimeout(timer); timer = setTimeout(function () { - if (input.is(':disabled') || input.is(':hidden') || !input.is(':visible')) { + if (input.is(':disabled')) { return; } @@ -1590,7 +1990,7 @@ } }); return this.each(function () { - var datetimepicker = $(this).data('xdsoft_datetimepicker'); + var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input; if (datetimepicker) { if ($.type(opt) === 'string') { switch (opt) { @@ -1614,6 +2014,10 @@ } datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value); break; + case 'validate': + $input = datetimepicker.data('input'); + $input.trigger('blur.xdsoft'); + break; } } else { datetimepicker @@ -1632,6 +2036,14 @@ }; $.fn.datetimepicker.defaults = default_options; }(jQuery)); + +function HighlightedDate(date, desc, style) { + "use strict"; + this.date = date; + this.desc = desc; + this.style = style; +} + (function () { /*! Copyright (c) 2013 Brandon Aaron (http://brandon.aaron.sh) @@ -1657,5 +2069,5 @@ * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more * details. */ -Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(b){if(b=="unixtime"){return parseInt(this.getTime()/1000);}if(Date.formatFunctions[b]==null){Date.createNewFormat(b);}var a=Date.formatFunctions[b];return this[a]();};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var code="Date.prototype."+funcName+" = function() {return ";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;code+="'"+String.escape(ch)+"' + ";}else{code+=Date.getFormatCode(ch);}}}eval(code.substring(0,code.length-3)+";}");};Date.getFormatCode=function(a){switch(a){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(a)+"' + ";}};Date.parseDate=function(a,c){if(c=="unixtime"){return new Date(!isNaN(parseInt(a))?parseInt(a)*1000:0);}if(Date.parseFunctions[c]==null){Date.createParser(c);}var b=Date.parseFunctions[c];return Date[b](a);};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (results && results.length > 0) {";var regex="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;regex+=String.escape(ch);}else{obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c;}}}}code+="if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}";code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$");eval(code);};Date.formatCodeToRegex=function(b,a){switch(b){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:1,c:"z = parseInt(results["+a+"], 10);\n",s:"(\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+a+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+a+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+a+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+a+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+a+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(b)};}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0");};Date.prototype.getDayOfYear=function(){var a=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var b=0;b<this.getMonth();++b){a+=Date.daysInMonth[b];}return a+this.getDate();};Date.prototype.getWeekOfYear=function(){var b=this.getDayOfYear()+(4-this.getDay());var a=new Date(this.getFullYear(),0,1);var c=(7-a.getDay()+4);return String.leftPad(Math.ceil((b-c)/7)+1,2,"0");};Date.prototype.isLeapYear=function(){var a=this.getFullYear();return((a&3)==0&&(a%100||(a%400==0&&a)));};Date.prototype.getFirstDayOfMonth=function(){var a=(this.getDay()-(this.getDate()-1))%7;return(a<0)?(a+7):a;};Date.prototype.getLastDayOfMonth=function(){var a=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(a<0)?(a+7):a;};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()];};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};String.escape=function(a){return a.replace(/('|\\)/g,"\\$1");};String.leftPad=function(d,b,c){var a=new String(d);if(c==null){c=" ";}while(a.length<b){a=c+a;}return a;};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"}; +Date.parseFunctions={count:0};Date.parseRegexes=[];Date.formatFunctions={count:0};Date.prototype.dateFormat=function(b){if(b=="unixtime"){return parseInt(this.getTime()/1000);}if(Date.formatFunctions[b]==null){Date.createNewFormat(b);}var a=Date.formatFunctions[b];return this[a]();};Date.createNewFormat=function(format){var funcName="format"+Date.formatFunctions.count++;Date.formatFunctions[format]=funcName;var codePrefix="Date.prototype."+funcName+" = function() {return ";var code="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;code+="'"+String.escape(ch)+"' + ";}else{code+=Date.getFormatCode(ch);}}}if(code.length==0){code="\"\"";}else{code=code.substring(0,code.length-3);}eval(codePrefix+code+";}");};Date.getFormatCode=function(a){switch(a){case"d":return"String.leftPad(this.getDate(), 2, '0') + ";case"D":return"Date.dayNames[this.getDay()].substring(0, 3) + ";case"j":return"this.getDate() + ";case"l":return"Date.dayNames[this.getDay()] + ";case"S":return"this.getSuffix() + ";case"w":return"this.getDay() + ";case"z":return"this.getDayOfYear() + ";case"W":return"this.getWeekOfYear() + ";case"F":return"Date.monthNames[this.getMonth()] + ";case"m":return"String.leftPad(this.getMonth() + 1, 2, '0') + ";case"M":return"Date.monthNames[this.getMonth()].substring(0, 3) + ";case"n":return"(this.getMonth() + 1) + ";case"t":return"this.getDaysInMonth() + ";case"L":return"(this.isLeapYear() ? 1 : 0) + ";case"Y":return"this.getFullYear() + ";case"y":return"('' + this.getFullYear()).substring(2, 4) + ";case"a":return"(this.getHours() < 12 ? 'am' : 'pm') + ";case"A":return"(this.getHours() < 12 ? 'AM' : 'PM') + ";case"g":return"((this.getHours() %12) ? this.getHours() % 12 : 12) + ";case"G":return"this.getHours() + ";case"h":return"String.leftPad((this.getHours() %12) ? this.getHours() % 12 : 12, 2, '0') + ";case"H":return"String.leftPad(this.getHours(), 2, '0') + ";case"i":return"String.leftPad(this.getMinutes(), 2, '0') + ";case"s":return"String.leftPad(this.getSeconds(), 2, '0') + ";case"O":return"this.getGMTOffset() + ";case"T":return"this.getTimezone() + ";case"Z":return"(this.getTimezoneOffset() * -60) + ";default:return"'"+String.escape(a)+"' + ";}};Date.parseDate=function(a,c){if(c=="unixtime"){return new Date(!isNaN(parseInt(a))?parseInt(a)*1000:0);}if(Date.parseFunctions[c]==null){Date.createParser(c);}var b=Date.parseFunctions[c];return Date[b](a);};Date.createParser=function(format){var funcName="parse"+Date.parseFunctions.count++;var regexNum=Date.parseRegexes.length;var currentGroup=1;Date.parseFunctions[format]=funcName;var code="Date."+funcName+" = function(input) {\nvar y = -1, m = -1, d = -1, h = -1, i = -1, s = -1, z = -1;\nvar d = new Date();\ny = d.getFullYear();\nm = d.getMonth();\nd = d.getDate();\nvar results = input.match(Date.parseRegexes["+regexNum+"]);\nif (results && results.length > 0) {";var regex="";var special=false;var ch="";for(var i=0;i<format.length;++i){ch=format.charAt(i);if(!special&&ch=="\\"){special=true;}else{if(special){special=false;regex+=String.escape(ch);}else{obj=Date.formatCodeToRegex(ch,currentGroup);currentGroup+=obj.g;regex+=obj.s;if(obj.g&&obj.c){code+=obj.c;}}}}code+="if (y > 0 && z > 0){\nvar doyDate = new Date(y,0);\ndoyDate.setDate(z);\nm = doyDate.getMonth();\nd = doyDate.getDate();\n}";code+="if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0 && s >= 0)\n{return new Date(y, m, d, h, i, s);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0 && i >= 0)\n{return new Date(y, m, d, h, i);}\nelse if (y > 0 && m >= 0 && d > 0 && h >= 0)\n{return new Date(y, m, d, h);}\nelse if (y > 0 && m >= 0 && d > 0)\n{return new Date(y, m, d);}\nelse if (y > 0 && m >= 0)\n{return new Date(y, m);}\nelse if (y > 0)\n{return new Date(y);}\n}return null;}";Date.parseRegexes[regexNum]=new RegExp("^"+regex+"$",'i');eval(code);};Date.formatCodeToRegex=function(b,a){switch(b){case"D":return{g:0,c:null,s:"(?:Sun|Mon|Tue|Wed|Thu|Fri|Sat)"};case"j":case"d":return{g:1,c:"d = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"l":return{g:0,c:null,s:"(?:"+Date.dayNames.join("|")+")"};case"S":return{g:0,c:null,s:"(?:st|nd|rd|th)"};case"w":return{g:0,c:null,s:"\\d"};case"z":return{g:1,c:"z = parseInt(results["+a+"], 10);\n",s:"(\\d{1,3})"};case"W":return{g:0,c:null,s:"(?:\\d{2})"};case"F":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"].substring(0, 3)], 10);\n",s:"("+Date.monthNames.join("|")+")"};case"M":return{g:1,c:"m = parseInt(Date.monthNumbers[results["+a+"]], 10);\n",s:"(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)"};case"n":case"m":return{g:1,c:"m = parseInt(results["+a+"], 10) - 1;\n",s:"(\\d{1,2})"};case"t":return{g:0,c:null,s:"\\d{1,2}"};case"L":return{g:0,c:null,s:"(?:1|0)"};case"Y":return{g:1,c:"y = parseInt(results["+a+"], 10);\n",s:"(\\d{4})"};case"y":return{g:1,c:"var ty = parseInt(results["+a+"], 10);\ny = ty > Date.y2kYear ? 1900 + ty : 2000 + ty;\n",s:"(\\d{1,2})"};case"a":return{g:1,c:"if (results["+a+"] == 'am') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(am|pm)"};case"A":return{g:1,c:"if (results["+a+"] == 'AM') {\nif (h == 12) { h = 0; }\n} else { if (h < 12) { h += 12; }}",s:"(AM|PM)"};case"g":case"G":case"h":case"H":return{g:1,c:"h = parseInt(results["+a+"], 10);\n",s:"(\\d{1,2})"};case"i":return{g:1,c:"i = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"s":return{g:1,c:"s = parseInt(results["+a+"], 10);\n",s:"(\\d{2})"};case"O":return{g:0,c:null,s:"[+-]\\d{4}"};case"T":return{g:0,c:null,s:"[A-Z]{3}"};case"Z":return{g:0,c:null,s:"[+-]\\d{1,5}"};default:return{g:0,c:null,s:String.escape(b)};}};Date.prototype.getTimezone=function(){return this.toString().replace(/^.*? ([A-Z]{3}) [0-9]{4}.*$/,"$1").replace(/^.*?\(([A-Z])[a-z]+ ([A-Z])[a-z]+ ([A-Z])[a-z]+\)$/,"$1$2$3");};Date.prototype.getGMTOffset=function(){return(this.getTimezoneOffset()>0?"-":"+")+String.leftPad(Math.floor(Math.abs(this.getTimezoneOffset())/60),2,"0")+String.leftPad(Math.abs(this.getTimezoneOffset())%60,2,"0");};Date.prototype.getDayOfYear=function(){var a=0;Date.daysInMonth[1]=this.isLeapYear()?29:28;for(var b=0;b<this.getMonth();++b){a+=Date.daysInMonth[b];}return a+this.getDate();};Date.prototype.getWeekOfYear=function(){var b=this.getDayOfYear()+(4-this.getDay());var a=new Date(this.getFullYear(),0,1);var c=(7-a.getDay()+4);return String.leftPad(Math.ceil((b-c)/7)+1,2,"0");};Date.prototype.isLeapYear=function(){var a=this.getFullYear();return((a&3)==0&&(a%100||(a%400==0&&a)));};Date.prototype.getFirstDayOfMonth=function(){var a=(this.getDay()-(this.getDate()-1))%7;return(a<0)?(a+7):a;};Date.prototype.getLastDayOfMonth=function(){var a=(this.getDay()+(Date.daysInMonth[this.getMonth()]-this.getDate()))%7;return(a<0)?(a+7):a;};Date.prototype.getDaysInMonth=function(){Date.daysInMonth[1]=this.isLeapYear()?29:28;return Date.daysInMonth[this.getMonth()];};Date.prototype.getSuffix=function(){switch(this.getDate()){case 1:case 21:case 31:return"st";case 2:case 22:return"nd";case 3:case 23:return"rd";default:return"th";}};String.escape=function(a){return a.replace(/('|\\)/g,"\\$1");};String.leftPad=function(d,b,c){var a=new String(d);if(c==null){c=" ";}while(a.length<b){a=c+a;}return a;};Date.daysInMonth=[31,28,31,30,31,30,31,31,30,31,30,31];Date.monthNames=["January","February","March","April","May","June","July","August","September","October","November","December"];Date.dayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];Date.y2kYear=50;Date.monthNumbers={Jan:0,Feb:1,Mar:2,Apr:3,May:4,Jun:5,Jul:6,Aug:7,Sep:8,Oct:9,Nov:10,Dec:11};Date.patterns={ISO8601LongPattern:"Y-m-d H:i:s",ISO8601ShortPattern:"Y-m-d",ShortDatePattern:"n/j/Y",LongDatePattern:"l, F d, Y",FullDateTimePattern:"l, F d, Y g:i:s A",MonthDayPattern:"F d",ShortTimePattern:"g:i A",LongTimePattern:"g:i:s A",SortableDateTimePattern:"Y-m-d\\TH:i:s",UniversalSortableDateTimePattern:"Y-m-d H:i:sO",YearMonthPattern:"F, Y"}; }()); diff --git a/mod/events.php b/mod/events.php index c3731bf1c..7220a3d42 100755 --- a/mod/events.php +++ b/mod/events.php @@ -280,11 +280,15 @@ function events_content(&$a) { // $plaintext = false; + $first_day = get_pconfig(local_channel(),'system','cal_first_day'); + $first_day = (($first_day) ? $first_day : 0); + $htpl = get_markup_template('event_head.tpl'); $a->page['htmlhead'] .= replace_macros($htpl,array( '$baseurl' => $a->get_baseurl(), '$editselect' => (($plaintext) ? 'none' : 'textareas'), - '$lang' => $a->language + '$lang' => $a->language, + '$first_day' => $first_day )); $o =""; @@ -689,11 +693,11 @@ function events_content(&$a) { '$required' => '<span class="required" title="' . t('Required') . '">*</span>', '$ModalCANCEL' => t('Cancel'), '$ModalOK' => t('OK'), - '$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"),'start_text',true,true,'','',true), + '$s_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$syear+5),DateTime::createFromFormat('Y-m-d H:i',"$syear-$smonth-$sday $shour:$sminute"),'start_text',true,true,'','',true,$first_day), '$n_text' => t('Finish date/time is not known or not relevant'), '$n_checked' => $n_checked, '$f_text' => t('Event Finishes:'), - '$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"),'finish_text',true,true,'start_text'), + '$f_dsel' => datetimesel($f,new DateTime(),DateTime::createFromFormat('Y',$fyear+5),DateTime::createFromFormat('Y-m-d H:i',"$fyear-$fmonth-$fday $fhour:$fminute"),'finish_text',true,true,'start_text','',false,$first_day), '$adjust' => array('adjust', t('Adjust for viewer timezone'), $a_checked, t('Important for events that happen in a particular place. Not practical for global holidays.'),), '$a_text' => t('Adjust for viewer timezone'), '$d_text' => t('Description:'), diff --git a/mod/settings.php b/mod/settings.php index 9a18d8e48..339f83cfe 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -405,7 +405,6 @@ function settings_post(&$a) { $allow_location = (((x($_POST,'allow_location')) && (intval($_POST['allow_location']) == 1)) ? 1: 0); - $blocktags = (((x($_POST,'blocktags')) && (intval($_POST['blocktags']) == 1)) ? 0: 1); // this setting is inverted! $unkmail = (((x($_POST,'unkmail')) && (intval($_POST['unkmail']) == 1)) ? 1: 0); $cntunkmail = ((x($_POST,'cntunkmail')) ? intval($_POST['cntunkmail']) : 0); @@ -416,6 +415,8 @@ function settings_post(&$a) { $post_profilechange = (($_POST['post_profilechange'] == 1) ? 1: 0); $adult = (($_POST['adult'] == 1) ? 1 : 0); + $cal_first_day = (((x($_POST,'first_day')) && (intval($_POST['first_day']) == 1)) ? 1: 0); + $channel = $a->get_channel(); $pageflags = $channel['channel_pageflags']; $existing_adult = (($pageflags & PAGE_ADULT) ? 1 : 0); @@ -503,6 +504,7 @@ function settings_post(&$a) { set_pconfig(local_channel(),'system','evdays',$evdays); set_pconfig(local_channel(),'system','photo_path',$photo_path); set_pconfig(local_channel(),'system','attach_path',$attach_path); + set_pconfig(local_channel(),'system','cal_first_day',$cal_first_day); $r = q("update channel set channel_name = '%s', channel_pageflags = %d, channel_timezone = '%s', channel_location = '%s', channel_notifyflags = %d, channel_max_anon_mail = %d, channel_max_friend_req = %d, channel_expire_days = %d $set_perms where channel_id = %d", dbesc($username), @@ -1110,6 +1112,7 @@ function settings_content(&$a) { '$removeme' => t('Remove Channel'), '$removechannel' => t('Remove this channel.'), '$firefoxshare' => t('Firefox Share $Projectname provider'), + '$cal_first_day' => array('first_day', t('Start calendar week on monday'), ((get_pconfig(local_channel(),'system','cal_first_day')) ? 1 : ''), '', $yes_no), )); call_hooks('settings_form',$o); diff --git a/view/tpl/event_head.tpl b/view/tpl/event_head.tpl index 346dfb154..ae5f21234 100755 --- a/view/tpl/event_head.tpl +++ b/view/tpl/event_head.tpl @@ -39,6 +39,8 @@ events: '{{$baseurl}}/events/json', header: false, lang: '{{$lang}}', + firstDay: {{$first_day}}, + eventLimit: 3, height: 'auto', diff --git a/view/tpl/settings.tpl b/view/tpl/settings.tpl index 7c1f4578d..2c71c64fb 100755 --- a/view/tpl/settings.tpl +++ b/view/tpl/settings.tpl @@ -159,6 +159,7 @@ {{/foreach}} </select> </div> + {{include file="field_checkbox.tpl" field=$cal_first_day}} <div class="settings-submit-wrapper" > <button type="submit" name="submit" class="btn btn-primary">{{$submit}}</button> </div> |