1
0
Fork 0

Merge pull request #1598 from rabuzarus/datepicker

new datetimepicker for event creation
This commit is contained in:
fabrixxm 2015-05-24 10:16:29 +02:00
commit 3a71978b0d
14 changed files with 2280 additions and 171 deletions

View file

@ -131,134 +131,114 @@ function datetime_convert($from = 'UTC', $to = 'UTC', $s = 'now', $fmt = "Y-m-d
function dob($dob) {
list($year,$month,$day) = sscanf($dob,'%4d-%2d-%2d');
$y = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
$f = get_config('system','birthday_input_format');
if(! $f)
$f = 'ymd';
$o = datesel($f,'',1920,$y,true,$year,$month,$day);
if($dob === '0000-00-00')
$value = '';
else
$value = (($year) ? datetime_convert('UTC','UTC',$dob,'Y-m-d') : datetime_convert('UTC','UTC',$dob,'m-d'));
$o = '<input type="text" name="dob" value="' . $value . '" placeholder="' . t('YYYY-MM-DD or MM-DD') . '" />';
// if ($dob && $dob != '0000-00-00')
// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),mktime(0,0,0,$month,$day,$year),'dob');
// else
// $o = datesel($f,mktime(0,0,0,0,0,1900),mktime(),false,'dob');
return $o;
}
function datesel_format($f) {
$o = '';
if(strlen($f)) {
for($x = 0; $x < strlen($f); $x ++) {
switch($f[$x]) {
case 'y':
if(strlen($o))
$o .= '-';
$o .= t('year');
break;
case 'm':
if(strlen($o))
$o .= '-';
$o .= t('month');
break;
case 'd':
if(strlen($o))
$o .= '-';
$o .= t('day');
break;
default:
break;
}
}
}
return $o;
}
// returns a date selector.
// $f = format string, e.g. 'ymd' or 'mdy'
// $pre = prefix (if needed) for HTML name and class fields
// $ymin = first year shown in selector dropdown
// $ymax = last year shown in selector dropdown
// $allow_blank = allow an empty response on any field
// $y = already selected year
// $m = already selected month
// $d = already selected day
/**
* returns a date selector
* @param $format
* format string, e.g. 'ymd' or 'mdy'. Not currently supported
* @param $min
* unix timestamp of minimum date
* @param $max
* unix timestap of maximum date
* @param $default
* unix timestamp of default date
* @param $id
* id and name of datetimepicker (defaults to "datetimepicker")
*/
if(! function_exists('datesel')) {
function datesel($f,$pre,$ymin,$ymax,$allow_blank,$y,$m,$d) {
$o = '';
if(strlen($f)) {
for($z = 0; $z < strlen($f); $z ++) {
if($f[$z] === 'y') {
$o .= "<select name=\"{$pre}year\" class=\"{$pre}year\" size=\"1\">";
if($allow_blank) {
$sel = (($y == '0000') ? " selected=\"selected\" " : "");
$o .= "<option value=\"0000\" $sel ></option>";
}
if($ymax > $ymin) {
for($x = $ymax; $x >= $ymin; $x --) {
$sel = (($x == $y) ? " selected=\"selected\" " : "");
$o .= "<option value=\"$x\" $sel>$x</option>";
}
}
else {
for($x = $ymax; $x <= $ymin; $x ++) {
$sel = (($x == $y) ? " selected=\"selected\" " : "");
$o .= "<option value=\"$x\" $sel>$x</option>";
}
}
}
elseif($f[$z] == 'm') {
$o .= "</select> <select name=\"{$pre}month\" class=\"{$pre}month\" size=\"1\">";
for($x = (($allow_blank) ? 0 : 1); $x <= 12; $x ++) {
$sel = (($x == $m) ? " selected=\"selected\" " : "");
$y = (($x) ? $x : '');
$o .= "<option value=\"$x\" $sel>$y</option>";
}
}
elseif($f[$z] == 'd') {
$o .= "</select> <select name=\"{$pre}day\" class=\"{$pre}day\" size=\"1\">";
for($x = (($allow_blank) ? 0 : 1); $x <= 31; $x ++) {
$sel = (($x == $d) ? " selected=\"selected\" " : "");
$y = (($x) ? $x : '');
$o .= "<option value=\"$x\" $sel>$y</option>";
}
}
}
}
$o .= "</select>";
return $o;
function datesel($format, $min, $max, $default, $id = 'datepicker') {
return datetimesel($format,$min,$max,$default,$id,true,false, '','');
}}
/**
* returns a time selector
* @param $format
* format string, e.g. 'ymd' or 'mdy'. Not currently supported
* @param $h
* already selected hour
* @param $m
* already selected minute
* @param $id
* id and name of datetimepicker (defaults to "timepicker")
*/
if(! function_exists('timesel')) {
function timesel($pre,$h,$m) {
$o = '';
$o .= "<select name=\"{$pre}hour\" class=\"{$pre}hour\" size=\"1\">";
for($x = 0; $x < 24; $x ++) {
$sel = (($x == $h) ? " selected=\"selected\" " : "");
$o .= "<option value=\"$x\" $sel>$x</option>";
}
$o .= "</select> : <select name=\"{$pre}minute\" class=\"{$pre}minute\" size=\"1\">";
for($x = 0; $x < 60; $x ++) {
$sel = (($x == $m) ? " selected=\"selected\" " : "");
$o .= "<option value=\"$x\" $sel>$x</option>";
}
$o .= "</select>";
return $o;
function timesel($format, $h, $m, $id='timepicker') {
return datetimesel($format,new DateTime(),new DateTime(),new DateTime("$h:$m"),$id,false,true);
}}
/**
* @brief Returns a datetime selector.
*
* @param $format
* format string, e.g. 'ymd' or 'mdy'. Not currently supported
* @param $min
* unix timestamp of minimum date
* @param $max
* unix timestap of maximum date
* @param $default
* unix timestamp of default date
* @param string $id
* id and name of datetimepicker (defaults to "datetimepicker")
* @param boolean $pickdate
* true to show date picker (default)
* @param boolean $picktime
* true to show time picker (default)
* @param $minfrom
* set minimum date from picker with id $minfrom (none by default)
* @param $maxfrom
* set maximum date from picker with id $maxfrom (none by default)
* @param boolean $required default false
* @return string Parsed HTML output.
*
* @todo Once browser support is better this could probably be replaced with
* native HTML5 date picker.
*/
if(! function_exists('datetimesel')) {
function datetimesel($format, $min, $max, $default, $id = 'datetimepicker', $pickdate = true, $picktime = true, $minfrom = '', $maxfrom = '', $required = false) {
$o = '';
$dateformat = '';
if($pickdate) $dateformat .= 'Y-m-d';
if($pickdate && $picktime) $dateformat .= ' ';
if($picktime) $dateformat .= 'H:i';
$minjs = $min ? ",minDate: new Date({$min->getTimestamp()}*1000), yearStart: " . $min->format('Y') : '';
$maxjs = $max ? ",maxDate: new Date({$max->getTimestamp()}*1000), yearEnd: " . $max->format('Y') : '';
$input_text = $default ? 'value="' . date($dateformat, $default->getTimestamp()) . '"' : '';
$defaultdatejs = $default ? ",defaultDate: new Date({$default->getTimestamp()}*1000)" : '';
$pickers = '';
if(!$pickdate) $pickers .= ',datepicker: false';
if(!$picktime) $pickers .= ',timepicker: false';
$extra_js = '';
if($minfrom != '')
$extra_js .= "\$('#$minfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#$id').data('xdsoft_datetimepicker').setOptions({minDate: currentDateTime})}})";
if($maxfrom != '')
$extra_js .= "\$('#$maxfrom').data('xdsoft_datetimepicker').setOptions({onChangeDateTime: function (currentDateTime) { \$('#$id').data('xdsoft_datetimepicker').setOptions({maxDate: currentDateTime})}})";
$readable_format = $dateformat;
$readable_format = str_replace('Y','yyyy',$readable_format);
$readable_format = str_replace('m','mm',$readable_format);
$readable_format = str_replace('d','dd',$readable_format);
$readable_format = str_replace('H','HH',$readable_format);
$readable_format = str_replace('i','MM',$readable_format);
$o .= "<div class='date'><input type='text' placeholder='$readable_format' name='$id' id='$id' $input_text />";
$o .= '</div>';
$o .= "<script type='text/javascript'>\$(function () {var picker = \$('#$id').datetimepicker({step:5,format:'$dateformat' $minjs $maxjs $pickers $defaultdatejs}); $extra_js})</script>";
return $o;
}}
// implements "3 seconds ago" etc.
// based on $posted_date, (UTC).

View file

@ -0,0 +1,19 @@
Copyright (c) 2013 http://xdsoft.net
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View file

@ -0,0 +1,20 @@
datetimepicker
==============
[Documentation][doc]
jQuery Plugin Date and Time Picker
DateTimePicker
![ScreenShot](https://raw2.github.com/xdan/datetimepicker/master/screen/1.png)
DatePicker
![ScreenShot](https://raw2.github.com/xdan/datetimepicker/master/screen/2.png)
TimePicker
![ScreenShot](https://raw2.github.com/xdan/datetimepicker/master/screen/3.png)
[doc]: http://xdsoft.net/jqplugins/datetimepicker/

View file

@ -0,0 +1,418 @@
.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;
padding: 8px;
padding-left: 0px;
padding-top: 2px;
position: absolute;
z-index: 9999;
-moz-box-sizing: border-box;
box-sizing: border-box;
display:none;
}
.xdsoft_datetimepicker iframe {
position: absolute;
left: 0;
top: 0;
width: 75px;
height: 210px;
background: transparent;
border:none;
}
/*For IE8 or lower*/
.xdsoft_datetimepicker button {
border:none !important;
}
.xdsoft_noselect{
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
-o-user-select: none;
user-select: none;
}
.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 *{
-moz-box-sizing: border-box;
box-sizing: border-box;
padding:0px;
margin:0px;
}
.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{
width: 224px;
float:left;
margin-left:8px;
}
.xdsoft_datetimepicker.xdsoft_showweeks .xdsoft_datepicker{
width: 256px;
}
.xdsoft_datetimepicker .xdsoft_timepicker{
width: 58px;
float:left;
text-align:center;
margin-left:8px;
margin-top:0px;
}
.xdsoft_datetimepicker .xdsoft_datepicker.active+.xdsoft_timepicker{
margin-top:8px;
margin-bottom:3px
}
.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{
background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAAAeCAYAAADaW7vzAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTN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Xpcc1AlSFEfLmouD+1knuxBDUVrvOBmoOC/rEcN7OQxKVeJTCiAdUzUJhA2Oez9QTkp72OTVcxDcXY8iKNkxGAJXmJCOQwOa6dhyXsOa6XwEGAKdeb5ET3rQdAAAAAElFTkSuQmCC);
}
.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_today_button{
float: left;
background-position:-70px 0px;
margin-left:5px;
}
.xdsoft_datetimepicker .xdsoft_next{
float: right;
background-position:0px 0px;
}
.xdsoft_datetimepicker .xdsoft_next,
.xdsoft_datetimepicker .xdsoft_prev ,
.xdsoft_datetimepicker .xdsoft_today_button{
background-color: transparent;
background-repeat: no-repeat;
border: 0px none currentColor;
cursor: pointer;
display: block;
height: 30px;
opacity: 0.5;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
outline: medium none currentColor;
overflow: hidden;
padding: 0px;
position: relative;
text-indent: 100%;
white-space: nowrap;
width: 20px;
}
.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;
font-size: 12px;
text-align: center;
border-collapse:collapse;
cursor:pointer;
border-bottom-width:0px;
height:25px;
line-height:25px;
}
.xdsoft_datetimepicker .xdsoft_timepicker .xdsoft_time_box >div > div:first-child{
border-top-width:0px;
}
.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{
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{
color: #fff;
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.xdsoft_current{
background: #33AAFF;
box-shadow: #178FE5 0px 1px 3px 0px inset;
color:#fff;
font-weight: 700;
}
.xdsoft_datetimepicker .xdsoft_month{
width:100px;
text-align:right;
}
.xdsoft_datetimepicker .xdsoft_calendar{
clear:both;
}
.xdsoft_datetimepicker .xdsoft_year{
width: 48px;
margin-left: 5px;
}
.xdsoft_datetimepicker .xdsoft_calendar table{
border-collapse:collapse;
width:100%;
}
.xdsoft_datetimepicker .xdsoft_calendar td > div{
padding-right:5px;
}
.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;
font-size: 12px;
text-align: right;
vertical-align: middle;
padding:0px;
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_calendar th{
background: #F1F1F1;
}
.xdsoft_datetimepicker .xdsoft_calendar td.xdsoft_today{
color:#33AAFF;
}
.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;
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;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=50)";
}
.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{
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{
color: inherit !important;
background: inherit !important;
box-shadow: inherit !important;
}
.xdsoft_datetimepicker .xdsoft_calendar th{
font-weight: 700;
text-align: center;
color: #999;
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_time_box{
position:relative;
border:1px solid #ccc;
}
.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_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 .xdsoft_timepicker .xdsoft_time_box{
border-bottom:1px solid #222222;
}
.xdsoft_datetimepicker.xdsoft_dark .xdsoft_timepicker .xdsoft_time_box >div >div{
background: #0a0a0a;
border-top:1px solid #222222;
color: #999999;
}
.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 > div > .xdsoft_option:hover{
color: #000;
background: #007fff;
}
.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;
}
.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-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TM4RjQzRTIxMUU0OUEzQUVBMkQ1MTFENUE4NiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/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{
background: #0a0a0a;
border:1px solid #222222;
color: #999999;
}
.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_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;
color:#000;
}
.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;
}
.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_dark .xdsoft_time_box{
border:1px solid #333;
}
.xdsoft_dark .xdsoft_scrollbar >.xdsoft_scroller{
background:#333 !important;
}

File diff suppressed because one or more lines are too long

View file

@ -15,17 +15,9 @@ function events_post(&$a) {
$event_id = ((x($_POST,'event_id')) ? intval($_POST['event_id']) : 0);
$cid = ((x($_POST,'cid')) ? intval($_POST['cid']) : 0);
$uid = local_user();
$startyear = intval($_POST['startyear']);
$startmonth = intval($_POST['startmonth']);
$startday = intval($_POST['startday']);
$starthour = intval($_POST['starthour']);
$startminute = intval($_POST['startminute']);
$finishyear = intval($_POST['finishyear']);
$finishmonth = intval($_POST['finishmonth']);
$finishday = intval($_POST['finishday']);
$finishhour = intval($_POST['finishhour']);
$finishminute = intval($_POST['finishminute']);
$start_text = escape_tags($_REQUEST['start_text']);
$finish_text = escape_tags($_REQUEST['finish_text']);
$adjust = intval($_POST['adjust']);
$nofinish = intval($_POST['nofinish']);
@ -33,12 +25,23 @@ function events_post(&$a) {
// The default setting for the `private` field in event_store() is false, so mirror that
$private_event = false;
$start = sprintf('%d-%d-%d %d:%d:0',$startyear,$startmonth,$startday,$starthour,$startminute);
if($nofinish)
if($start_text) {
$start = $start_text;
}
else {
$start = sprintf('%d-%d-%d %d:%d:0',$startyear,$startmonth,$startday,$starthour,$startminute);
}
if($nofinish) {
$finish = '0000-00-00 00:00:00';
else
}
if($finish_text) {
$finish = $finish_text;
}
else {
$finish = sprintf('%d-%d-%d %d:%d:0',$finishyear,$finishmonth,$finishday,$finishhour,$finishminute);
}
if($adjust) {
$start = datetime_convert(date_default_timezone_get(),'UTC',$start);
@ -214,8 +217,8 @@ function events_content(&$a) {
if($mode == 'view') {
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
$thisyear = datetime_convert('UTC',date_default_timezone_get(),'now','Y');
$thismonth = datetime_convert('UTC',date_default_timezone_get(),'now','m');
if(! $y)
$y = intval($thisyear);
if(! $m)
@ -405,6 +408,19 @@ function events_content(&$a) {
$orig_event = $r[0];
}
// Passed parameters overrides anything found in the DB
if($mode === 'edit' || $mode === 'new') {
if(!x($orig_event)) $orig_event = array();
// In case of an error the browser is redirected back here, with these parameters filled in with the previous values
if(x($_REQUEST,'nofinish')) $orig_event['nofinish'] = $_REQUEST['nofinish'];
if(x($_REQUEST,'adjust')) $orig_event['adjust'] = $_REQUEST['adjust'];
if(x($_REQUEST,'summary')) $orig_event['summary'] = $_REQUEST['summary'];
if(x($_REQUEST,'description')) $orig_event['description'] = $_REQUEST['description'];
if(x($_REQUEST,'location')) $orig_event['location'] = $_REQUEST['location'];
if(x($_REQUEST,'start')) $orig_event['start'] = $_REQUEST['start'];
if(x($_REQUEST,'finish')) $orig_event['finish'] = $_REQUEST['finish'];
}
if($mode === 'edit' || $mode === 'new') {
$n_checked = ((x($orig_event) && $orig_event['nofinish']) ? ' checked="checked" ' : '');
@ -426,9 +442,6 @@ function events_content(&$a) {
$sh_checked .= ' disabled="disabled" ';
$tpl = get_markup_template('event_form.tpl');
$sdt = ((x($orig_event)) ? $orig_event['start'] : 'now');
$fdt = ((x($orig_event)) ? $orig_event['finish'] : 'now');
@ -454,28 +467,24 @@ function events_content(&$a) {
if(! $f)
$f = 'ymd';
$dateformat = datesel_format($f);
$timeformat = t('hour:minute');
require_once('include/acl_selectors.php');
require_once('include/acl_selectors.php');
$tpl = get_markup_template('event_form.tpl');
$o .= replace_macros($tpl,array(
'$post' => $a->get_baseurl() . '/events',
'$eid' => $eid,
'$cid' => $cid,
'$uri' => $uri,
'$title' => t('Event details'),
'$desc' => sprintf( t('Format is %s %s. Starting date and Title are required.'),$dateformat,$timeformat),
'$desc' => t('Starting date and Title are required.'),
'$s_text' => t('Event Starts:') . ' <span class="required" title="' . t('Required') . '">*</span>',
'$s_dsel' => datesel($f,'start',$syear+5,$syear,false,$syear,$smonth,$sday),
'$s_tsel' => timesel('start',$shour,$sminute),
'$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),
'$n_text' => t('Finish date/time is not known or not relevant'),
'$n_checked' => $n_checked,
'$f_text' => t('Event Finishes:'),
'$f_dsel' => datesel($f,'finish',$fyear+5,$fyear,false,$fyear,$fmonth,$fday),
'$f_tsel' => timesel('finish',$fhour,$fminute),
'$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'),
'$a_text' => t('Adjust for viewer timezone'),
'$a_checked' => $a_checked,
'$d_text' => t('Description:'),

View file

@ -190,27 +190,23 @@ function profiles_post(&$a) {
return;
}
$year = intval($_POST['year']);
if($year < 1900 || $year > 2100 || $year < 0)
$year = 0;
$month = intval($_POST['month']);
if(($month > 12) || ($month < 0))
$month = 0;
$mtab = array(0,31,29,31,30,31,30,31,31,30,31,30,31);
$day = intval($_POST['day']);
if(($day > $mtab[$month]) || ($day < 0))
$day = 0;
// It's OK to have an empty (0) year, but if you supplied a year you have to have a non-zero month and day
if($year && ! $month)
$month = 1;
if($year && ! $day)
$day = 1;
$dob = '0000-00-00';
$dob = sprintf('%04d-%02d-%02d',$year,$month,$day);
$dob = $_POST['dob'] ? escape_tags(trim($_POST['dob'])) : '0000-00-00'; // FIXME: Needs to be validated?
$y = substr($dob,0,4);
if((! ctype_digit($y)) || ($y < 1900))
$ignore_year = true;
else
$ignore_year = false;
if($dob != '0000-00-00') {
if(strpos($dob,'0000-') === 0) {
$ignore_year = true;
$dob = substr($dob,5);
}
$dob = datetime_convert('UTC','UTC',(($ignore_year) ? '1900-' . $dob : $dob),(($ignore_year) ? 'm-d' : 'Y-m-d'));
if($ignore_year)
$dob = '0000-' . $dob;
}
$name = notags(trim($_POST['name']));
if(! strlen($name)) {
@ -701,7 +697,7 @@ function profiles_content(&$a) {
'$lbl_fullname' => t('Your Full Name:'),
'$lbl_title' => t('Title/Description:'),
'$lbl_gender' => t('Your Gender:'),
'$lbl_bd' => sprintf( t("Birthday \x28%s\x29:"),datesel_format($f)),
'$lbl_bd' => t("Birthday :"),
'$lbl_address' => t('Street Address:'),
'$lbl_city' => t('Locality/City:'),
'$lbl_zip' => t('Postal/Zip Code:'),

View file

@ -13,10 +13,10 @@
<input type="hidden" name="preview" id="event-edit-preview" value="0" />
<div id="event-start-text">{{$s_text}}</div>
{{$s_dsel}} {{$s_tsel}}
{{$s_dsel}}
<div id="event-finish-text">{{$f_text}}</div>
{{$f_dsel}} {{$f_tsel}}
{{$f_dsel}}
<div id="event-datetime-break"></div>

View file

@ -5,6 +5,7 @@
<link rel="stylesheet" href="{{$baseurl}}/view/global.css" type="text/css" media="all" />
<link rel="stylesheet" href="{{$baseurl}}/library/colorbox/colorbox.css" type="text/css" media="screen" />
<link rel="stylesheet" href="{{$baseurl}}/library/jgrowl/jquery.jgrowl.css" type="text/css" media="screen" />
<link rel="stylesheet" href="{{$baseurl}}/library/datetimepicker/jquery.datetimepicker.css" type="text/css" media="screen" />
<link rel="stylesheet" type="text/css" href="{{$stylesheet}}" media="all" />
@ -34,6 +35,7 @@
<script type="text/javascript" src="{{$baseurl}}/js/fk.autocomplete.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/library/colorbox/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="{{$baseurl}}/library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="{{$baseurl}}/library/datetimepicker/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/acl.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/webtoolkit.base64.js" ></script>

View file

@ -5,6 +5,7 @@
<script type="text/javascript" src="{{$baseurl}}/view/theme/frost-mobile/js/readmore.min.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/jquery.textinputs.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="{{$baseurl}}/library/datetimepicker/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="{{$baseurl}}/js/fk.autocomplete.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/view/theme/frost-mobile/js/acl.js" ></script>

View file

@ -4,6 +4,7 @@
<base href="{{$baseurl}}/" />
<meta name="generator" content="{{$generator}}" />
<link rel="stylesheet" href="{{$baseurl}}/library/jgrowl/jquery.jgrowl.css" type="text/css" media="screen" />
<link rel="stylesheet" href="{{$baseurl}}/library/datetimepicker/jquery.datetimepicker.css" type="text/css" media="screen" />
<script type="text/javascript" src="{{$baseurl}}/js/jquery.js"></script>
<link rel="stylesheet" type="text/css" href="{{$stylesheet}}" media="all" />

View file

@ -15,6 +15,7 @@
<script type="text/javascript" src="{{$baseurl}}/library/colorbox/jquery.colorbox-min.js"></script>
{{*<!--<script type="text/javascript" src="{{$baseurl}}/library/tiptip/jquery.tipTip.minified.js"></script>-->*}}
<script type="text/javascript" src="{{$baseurl}}/library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="{{$baseurl}}/library/datetimepicker/jquery.datetimepicker.js"></script>
<script type="text/javascript" src="{{$baseurl}}/view/theme/frost/js/acl.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/webtoolkit.base64.js" ></script>

View file

@ -13,10 +13,10 @@
<input type="hidden" name="preview" id="event-edit-preview" value="0" />
<div id="event-start-text">{{$s_text}}</div>
{{$s_dsel}} {{$s_tsel}}
{{$s_dsel}}
<div id="event-finish-text">{{$f_text}}</div>
{{$f_dsel}} {{$f_tsel}}
{{$f_dsel}}
<div id="event-datetime-break"></div>

View file

@ -5,6 +5,7 @@
<link rel="stylesheet" href="{{$baseurl}}/library/colorbox/colorbox.css" type="text/css" media="screen" />
{{*<!--<link rel="stylesheet" href="{{$baseurl}}/library/tiptip/tipTip.css" type="text/css" media="screen" />-->*}}
<link rel="stylesheet" href="{{$baseurl}}/library/jgrowl/jquery.jgrowl.css" type="text/css" media="screen" />
<link rel="stylesheet" href="{{$baseurl}}/library/datetimepicker/jquery.datetimepicker.css" type="text/css" media="screen" />
<link rel="stylesheet" type="text/css" href="{{$stylesheet}}" media="all" />