Issue #13 Due time handling (local time / UTC)
This commit is contained in:
parent
cf2f9d419e
commit
3e78376be3
36
src/IDF/Form/Field/Date.php
Normal file
36
src/IDF/Form/Field/Date.php
Normal file
@ -0,0 +1,36 @@
|
||||
<?php
|
||||
/* -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# This file is part of InDefero, an open source project management application.
|
||||
# Copyright (C) 2008-2011 Céondo Ltd and contributors.
|
||||
#
|
||||
# InDefero is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# InDefero is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
#
|
||||
# ***** END LICENSE BLOCK ***** */
|
||||
|
||||
class IDF_Form_Field_Date extends Pluf_Form_Field_Date
|
||||
{
|
||||
public function clean($value) {
|
||||
try {
|
||||
return parent::clean($value);
|
||||
} catch (Pluf_Form_Invalid $e) {
|
||||
if(false === $this->required and empty($value)) {
|
||||
return null;
|
||||
}
|
||||
throw $e;
|
||||
}
|
||||
}
|
||||
}
|
@ -112,7 +112,7 @@ class IDF_Form_IssueCreate extends Pluf_Form
|
||||
'size' => 15,
|
||||
),
|
||||
));
|
||||
$this->fields['due_dtime'] = new IDF_Form_Field_Datetime(
|
||||
$this->fields['due_dtime'] = new IDF_Form_Field_Date(
|
||||
array('required' => false,
|
||||
'label' => __('Due date'),
|
||||
'initial' => '',
|
||||
|
@ -103,7 +103,7 @@ class IDF_Form_IssueUpdate extends IDF_Form_IssueCreate
|
||||
'size' => 15,
|
||||
),
|
||||
));
|
||||
$this->fields['due_dtime'] = new IDF_Form_Field_Datetime(
|
||||
$this->fields['due_dtime'] = new IDF_Form_Field_Date(
|
||||
array('required' => false,
|
||||
'label' => __('Due date'),
|
||||
'initial' => $this->issue->due_dtime,
|
||||
|
@ -156,11 +156,18 @@ class IDF_Issue extends Pluf_Model
|
||||
IDF_Search::remove($this);
|
||||
}
|
||||
|
||||
function restore() {
|
||||
$this->due_dtime = substr($this->due_dtime, 0, 10);
|
||||
}
|
||||
|
||||
function preSave($create=false)
|
||||
{
|
||||
if ($this->id == '') {
|
||||
$this->creation_dtime = gmdate('Y-m-d H:i:s');
|
||||
}
|
||||
if($this->due_dtime) {
|
||||
$this->due_dtime .= ' 23:59:59';
|
||||
}
|
||||
$this->modif_dtime = gmdate('Y-m-d H:i:s');
|
||||
}
|
||||
|
||||
|
@ -484,7 +484,6 @@ class IDF_Views_Issue
|
||||
'date_1_week' => date('Y-m-d', strtotime('+1 week')),
|
||||
'date_two_weeks' => date('Y-m-d', strtotime('+2 week')),
|
||||
'date_one_month' => date('Y-m-d', strtotime('+1 month')),
|
||||
'default_time' => Pluf::f('issue_default_due_date_time'),
|
||||
),
|
||||
self::autoCompleteArrays($prj)
|
||||
);
|
||||
@ -731,7 +730,6 @@ class IDF_Views_Issue
|
||||
'date_1_week' => date('Y-m-d', strtotime('+1 week')),
|
||||
'date_two_weeks' => date('Y-m-d', strtotime('+2 week')),
|
||||
'date_one_month' => date('Y-m-d', strtotime('+1 month')),
|
||||
'default_time' => Pluf::f('issue_default_due_date_time'),
|
||||
),
|
||||
$arrays),
|
||||
$request);
|
||||
|
@ -506,7 +506,7 @@ $cfg['idf_strong_key_check'] = false;
|
||||
# submitted as value of the HTTP header 'Post-Commit-Hook-Hmac' during
|
||||
# such a request. Since newer versions of Indefero use the same authentication
|
||||
# mechanism (based on the same secret key) for other web hooks of the same
|
||||
# project as well, the name of this HTTP header was no longer appropriate
|
||||
# project as well, the name of this HTTP header was no longer appropriate
|
||||
# and as such changed to simply 'Web-Hook-Hmac'.
|
||||
#
|
||||
# Setting the following configuration option to 'compat' now restores the
|
||||
@ -533,7 +533,7 @@ $cfg['activity_section_weights'] = array(
|
||||
'wiki' => 2,
|
||||
'downloads' => 1,
|
||||
'review' => 1,
|
||||
);
|
||||
);
|
||||
|
||||
# Here you can define the timespan in days how long the activity calculation
|
||||
# process should look into the history to get meaningful activity values for
|
||||
@ -544,9 +544,4 @@ $cfg['activity_section_weights'] = array(
|
||||
# high enough to show a proper activity index for those projects as well.
|
||||
$cfg['activity_lookback'] = 7;
|
||||
|
||||
# Configure the default time that should be used when setting an issue due date
|
||||
# via the quick (COB, EOW, etc) menu or via the date picker
|
||||
$cfg['issue_default_due_date_time'] = '17:30';
|
||||
|
||||
return $cfg;
|
||||
|
||||
return $cfg;
|
@ -129,7 +129,6 @@
|
||||
{/block}
|
||||
{block javascript}
|
||||
<script type="text/javascript">
|
||||
var default_time = '{$default_time}';
|
||||
document.getElementById('id_summary').focus();{literal}
|
||||
$(document).ready(function(){
|
||||
$("#id_due_dtime").datepicker({
|
||||
@ -137,10 +136,7 @@ $(document).ready(function(){
|
||||
changeMonth: true,
|
||||
yearRange: '-0:+5',
|
||||
constrainInput: false,
|
||||
dateFormat: 'yy-mm-dd',
|
||||
onSelect: function(dateText, inst) {
|
||||
this.value = dateText + ' ' + default_time;
|
||||
}
|
||||
dateFormat: 'yy-mm-dd'
|
||||
});
|
||||
$('#due_dtime_wrapper').mouseover(function(){
|
||||
$('#due_dtime_more_shortcuts').show();
|
||||
|
@ -233,7 +233,6 @@
|
||||
{/block}
|
||||
{block javascript}{if $form}{include 'idf/issues/js-autocomplete.html'}
|
||||
<script type="text/javascript">
|
||||
var default_time = '{$default_time}';
|
||||
{literal}
|
||||
$(document).ready(function(){
|
||||
$("#id_due_dtime").datepicker({
|
||||
@ -241,10 +240,7 @@ $(document).ready(function(){
|
||||
changeMonth: true,
|
||||
yearRange: '-0:+5',
|
||||
constrainInput: false,
|
||||
dateFormat: 'yy-mm-dd',
|
||||
onSelect: function(dateText, inst) {
|
||||
this.value = dateText + ' ' + default_time;
|
||||
}
|
||||
dateFormat: 'yy-mm-dd'
|
||||
});
|
||||
$('#due_dtime_wrapper').mouseover(function(){
|
||||
$('#due_dtime_more_shortcuts').show();
|
||||
|
Loading…
Reference in New Issue
Block a user