From 3e78376be3e36fb30d60eb538027ee38c455086b Mon Sep 17 00:00:00 2001 From: Simon Holywell Date: Fri, 13 Apr 2012 14:07:18 +0100 Subject: [PATCH] Issue #13 Due time handling (local time / UTC) --- src/IDF/Form/Field/Date.php | 36 ++++++++++++++++++++++++ src/IDF/Form/IssueCreate.php | 2 +- src/IDF/Form/IssueUpdate.php | 2 +- src/IDF/Issue.php | 7 +++++ src/IDF/Views/Issue.php | 2 -- src/IDF/conf/idf.php-dist | 11 ++------ src/IDF/templates/idf/issues/create.html | 6 +--- src/IDF/templates/idf/issues/view.html | 6 +--- 8 files changed, 50 insertions(+), 22 deletions(-) create mode 100644 src/IDF/Form/Field/Date.php diff --git a/src/IDF/Form/Field/Date.php b/src/IDF/Form/Field/Date.php new file mode 100644 index 0000000..9ddb6c2 --- /dev/null +++ b/src/IDF/Form/Field/Date.php @@ -0,0 +1,36 @@ +required and empty($value)) { + return null; + } + throw $e; + } + } +} diff --git a/src/IDF/Form/IssueCreate.php b/src/IDF/Form/IssueCreate.php index b39d7bb..8c2ab16 100644 --- a/src/IDF/Form/IssueCreate.php +++ b/src/IDF/Form/IssueCreate.php @@ -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' => '', diff --git a/src/IDF/Form/IssueUpdate.php b/src/IDF/Form/IssueUpdate.php index cea30f2..160f306 100644 --- a/src/IDF/Form/IssueUpdate.php +++ b/src/IDF/Form/IssueUpdate.php @@ -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, diff --git a/src/IDF/Issue.php b/src/IDF/Issue.php index 0bef730..0ec01ea 100644 --- a/src/IDF/Issue.php +++ b/src/IDF/Issue.php @@ -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'); } diff --git a/src/IDF/Views/Issue.php b/src/IDF/Views/Issue.php index bd69999..e68f860 100644 --- a/src/IDF/Views/Issue.php +++ b/src/IDF/Views/Issue.php @@ -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); diff --git a/src/IDF/conf/idf.php-dist b/src/IDF/conf/idf.php-dist index 1b44df7..db89199 100644 --- a/src/IDF/conf/idf.php-dist +++ b/src/IDF/conf/idf.php-dist @@ -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; \ No newline at end of file diff --git a/src/IDF/templates/idf/issues/create.html b/src/IDF/templates/idf/issues/create.html index 32363bc..8754bdb 100644 --- a/src/IDF/templates/idf/issues/create.html +++ b/src/IDF/templates/idf/issues/create.html @@ -129,7 +129,6 @@ {/block} {block javascript}