Commit e950736a authored by Côme Chilliet's avatar Côme Chilliet

Merge branch '5931-use-date-html5-input-type-for-dateattribute' into '1.4-dev'

Resolve "Use date HTML5 input type for DateAttribute"

See merge request fusiondirectory/fd!591
parents 2d3101bd d346a7e3
This diff is collapsed.
div.datepicker {
position: absolute;
text-align: center;
border: 1px #aaa solid;
font-family: arial;
background: #fcfcfc;
font-size: 10px;
padding: 0;
}
.datepicker-calendar table {
font-size: 10px;
border: 1px solid #fcfcfc;
margin: 0;
padding: 0;
text-align: center;
}
div.datepicker .datepicker-header {
font-size: 11px;
font-weight: bold;
background: #f0f0f0;
border-bottom: 1px solid #aaa;
padding: 2px;
text-align: center;
}
div.datepicker .datepicker-header table.header {
width: 175px;
border: 0;
padding: 0;
text-align: center;
border-spacing: 0;
border-collapse: collapse;
}
td.prev,td.prev-year,td.next,td.next-year {
width: 8%;
cursor: pointer;
font-weight: bold;
line-height: 16px;
}
td.prev:hover,td.prev-year:hover,td.next:hover,td.next-year:hover {
background-color: #d0d0d0;
}
td.header {
text-align: center;
width: 68%;
font-weight: bold;
line-height: 16px;
}
.datepicker-header {
height: 16px;
}
.datepicker-calendar table tbody tr {
border: 1px solid #fcfcfc;
margin: 0;
padding: 0;
}
.datepicker-calendar table tbody tr td {
box-sizing: content-box;
border: 1px #eaeaea solid;
margin: 0;
padding: 0;
text-align: center;
height: 16px;
line-height: 16px;
width: 21px;
cursor: pointer;
}
.datepicker-calendar table tbody tr td:hover,
.datepicker-calendar table tbody tr td.outbound:hover,
.datepicker-calendar table tbody tr td.today:hover {
border: 1px #cce9ff solid;
background: #e9f5ff;
cursor: pointer;
}
.datepicker-calendar table tbody tr td.wday {
box-sizing: content-box;
border: 1px #aaa solid;
background: #ccc;
cursor: text;
width: 21px;
height: 16px;
line-height: 16px;
font-weight: bold;
}
.datepicker-calendar table tbody tr td.outbound {
background: #f4f3f3;
}
.datepicker-calendar table tbody tr td.today,
.datepicker-calendar table tbody tr td.today:hover {
box-sizing: content-box;
border: 1px #cce9ff solid;
background: #e9f5ff;
background-image: url(../../images/date_active.png);
background-repeat: no-repeat;
width: 21px;
height: 16px;
line-height: 16px;
}
.datepicker-calendar table tbody tr td.nclick,
.datepicker-calendar table tbody tr td.nclick-outbound {
cursor: default;
color: #aaa;
width: 21px;
height: 16px;
line-height: 16px;
}
.datepicker-calendar table tbody tr td.nclick-outbound {
background: #e8e4e4;
width: 21px;
height: 16px;
line-height: 16px;
}
.datepicker-calendar table tbody tr td.nclick:hover,
.datepicker-calendar table tbody tr td.nclick-outbound:hover {
border: 1px #eaeaea solid;
background: #fcfcfc;
}
.datepicker-calendar table tbody tr td.nclick-outbound:hover {
background: #e8e4e4;
}
div.datepicker div.datepicker-footer {
font-size: 10px;
background: #f0f0f0;
border-top: 1px solid #aaa;
cursor: pointer;
text-align: center;
padding: 2px;
}
.date {
float: left;
text-align: center;
width: 90px;
}
html.rtl .date {
float: right;
}
.datepicker-opener-table {
box-sizing: border-box;
border: 1px solid transparent;
padding: 0;
border-spacing: 0;
margin: 0 0 0 93px;
background: transparent url(../../geticon.php?context=applications&icon=office-calendar&size=16) no-repeat 0 0;
width: 20px;
height: 20px;
cursor: pointer;
}
html.rtl .datepicker-opener-table {
margin: 0 93px 0 0;
}
.datepicker-opener {
width: 16px;
height: 16px;
margin: 0 0 0 3px;
cursor: pointer;
}
html.rtl .datepicker-opener {
margin: 0 3px 0 0;
}
<link rel="stylesheet" type="text/css" href="{filePath file="style.css"}" media="screen"/>
<link rel="stylesheet" type="text/css" href="{filePath file="form.css"}" media="screen"/>
<link rel="stylesheet" type="text/css" href="{filePath file="datepicker.css"}" media="screen"/>
<link rel="stylesheet" type="text/css" href="{filePath file="menu.css"}" media="screen"/>
<link rel="stylesheet" type="text/css" href="{filePath file="lists.css"}" media="screen"/>
<link rel="stylesheet" type="text/css" href="{filePath file="tabs.css"}" media="screen"/>
......
......@@ -24,7 +24,6 @@
<script src="include/dragdrop.js" type="text/javascript"></script>
<script src="include/controls.js" type="text/javascript"></script>
<script src="include/pulldown.js" type="text/javascript"></script>
<script src="include/datepicker.js" type="text/javascript"></script>
{/if}
<script src="include/tsorter.js" type="text/javascript"></script>
{foreach from=$js_files item=file}
......
......@@ -222,32 +222,6 @@ class filter
return $result;
}
/*!
* \brief Get the date picker
*
* \param array $element
*/
function getDatePicker ($element)
{
global $lang;
$tag = $element['tag'];
$value = '';
if (!empty($this->elementValues[$tag])) {
try {
$value = LdapGeneralizedTime::fromString($this->elementValues[$tag])->format('d.m.Y');
} catch (Exception $e) {
$value = $this->elementValues[$tag];
}
}
return '<input type="text" name="'.$tag.'" id="'.$tag.'"'.
' value="'.$value.'"'.
' class="date" />'.
'<script type="text/javascript">
var datepicker = new DatePicker({ relative : \''.$tag.'\', language : \''.preg_replace('/_.*$/', '', $lang).'\', keepFieldEmpty : true, enableCloseEffect : false, enableShowEffect : false });
</script>';
}
/*!
* \brief Set the combobox options
*
......@@ -360,10 +334,6 @@ class filter
$htmlCode = $this->getCombobox($element);
break;
case 'date':
$htmlCode = $this->getDatePicker($element);
break;
default:
throw new FusionDirectoryException('Unknown element type specified: '.$element['type'].'!');
}
......@@ -500,16 +470,7 @@ class filter
// only if we didn't get a _GET
foreach ($this->elements as $tag => $element) {
if (!empty($_POST[$tag])) {
if ($element['type'] == 'date') {
try {
$date = new DateTime($_POST[$tag], new DateTimeZone('UTC'));
$this->elementValues[$tag] = LdapGeneralizedTime::toString($date);
} catch (Exception $e) {
$this->elementValues[$tag] = validate($_POST[$tag]);
}
} else {
$this->elementValues[$tag] = validate($_POST[$tag]);
}
$this->elementValues[$tag] = validate($_POST[$tag]);
} else {
$this->elementValues[$tag] = '';
}
......
......@@ -49,12 +49,14 @@ class DateAttribute extends Attribute
try {
$this->minDate = new DateTime($min, new DateTimeZone('UTC'));
} catch (Exception $e) {
// Failed to parse min date, ignore
}
}
if ($max !== NULL) {
try {
$this->maxDate = new DateTime($max, new DateTimeZone('UTC'));
} catch (Exception $e) {
// Failed to parse max date, ignore
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment