diff options
author | raimund-schluessler <raimund.schluessler@googlemail.com> | 2014-04-15 01:01:07 +0400 |
---|---|---|
committer | raimund-schluessler <raimund.schluessler@googlemail.com> | 2014-04-15 01:01:07 +0400 |
commit | 59576d4538b9b984a50c083c7ff28d6201e3cdb6 (patch) | |
tree | 894d6cb18147ce4f47ff273f3c1a98674cd228e0 | |
parent | 6e38fd5deaffce31f93fe05be9f81024885d572a (diff) |
Display reminders in details view
-rw-r--r-- | css/style.css | 10 | ||||
-rw-r--r-- | css/style.less | 22 | ||||
-rw-r--r-- | lib/helper.php | 44 | ||||
-rw-r--r-- | templates/part.details.php | 14 |
4 files changed, 70 insertions, 20 deletions
diff --git a/css/style.css b/css/style.css index 4a485d2d..db81162e 100644 --- a/css/style.css +++ b/css/style.css @@ -890,14 +890,20 @@ #task-details .body .section.date .section-title.repeat { margin-top: -2px; } -#task-details .body .section .section-description { +#task-details .body .section.detail-reminder .section-description { display: none; font-size: 11px; margin-top: -6px; } -#task-details .body .section .section-description.repeat { +#task-details .body .section.detail-reminder .section-description.repeat { display: block; } +#task-details .body .section.detail-reminder.date .section-description { + display: block; +} +#task-details .body .section.detail-reminder.date .section-title { + margin-top: -2px; +} input, textarea { -moz-user-select: text; diff --git a/css/style.less b/css/style.less index 4e2fe9a0..900286a2 100644 --- a/css/style.less +++ b/css/style.less @@ -910,12 +910,22 @@ } } } - .section-description{ - display: none; - font-size: 11px; - margin-top:-6px; - &.repeat{ - display:block; + &.detail-reminder{ + .section-description{ + display: none; + font-size: 11px; + margin-top:-6px; + &.repeat{ + display:block; + } + } + &.date{ + .section-description{ + display: block; + } + .section-title{ + margin-top:-2px; + } } } } diff --git a/lib/helper.php b/lib/helper.php index 67993593..2bac5ae8 100644 --- a/lib/helper.php +++ b/lib/helper.php @@ -22,6 +22,7 @@ namespace OCA\Tasks_enhanced; +use Sabre\VObject; // use OCA\Tasks_enhanced\App; Class helper { @@ -38,6 +39,19 @@ Class helper { $task['note'] = $vtodo->getAsString('DESCRIPTION'); $task['location'] = $vtodo->getAsString('LOCATION'); $task['categories'] = $vtodo->getAsArray('CATEGORIES'); + $start = $vtodo->DTSTART; + if ($start) { + try { + $start = $start->getDateTime(); + $start->setTimezone(new \DateTimeZone($user_timezone)); + $task['start'] = $start->format('Ymd\THis'); + } catch(\Exception $e) { + $task['start'] = 'undefined'; + \OCP\Util::writeLog('tasks_enhanced', $e->getMessage(), \OCP\Util::ERROR); + } + } else { + $task['start'] = 'undefined'; + } $due = $vtodo->DUE; if ($due) { try { @@ -51,12 +65,34 @@ Class helper { } else { $task['due'] = 'undefined'; } - $reminder = $vtodo->REMINDER; + $reminder = $vtodo->VALARM; if($reminder) { try { - $reminder = $reminder->getDateTime(); - $reminder->setTimezone(new \DateTimeZone($user_timezone)); - $task['reminder'] = $reminder->format('Ymd\THis'); + + $reminderType = $reminder->TRIGGER['VALUE']->value; + $reminderTrigger = $reminder->TRIGGER->value; + $reminderAction = $reminder->ACTION->value; + + if($reminderType == 'DATE-TIME'){ + $reminderDate = $reminder->TRIGGER->getDateTime(); + $reminderDate->setTimezone(new \DateTimeZone($user_timezone)); + $reminderDate = $reminderDate->format('Ymd\THis'); + } elseif ($reminderType == 'DURATION' && $start) { + $parsed = VObject\DateTimeParser::parseDuration($reminder->TRIGGER,true); + // Calculate the reminder date from duration and start date + $reminderDate = $start->modify($parsed)->format('Ymd\THis'); + } else { + $reminderDate = 'undefined'; + } + + + $task['reminder'] = array( + 'type' => $reminderType, + 'trigger' => $reminderTrigger, + 'action' => $reminderAction, + 'date' => $reminderDate + ); + } catch(\Exception $e) { $task['reminder'] = 'undefined'; \OCP\Util::writeLog('tasks_enhanced', $e->getMessage(), \OCP\Util::ERROR); diff --git a/templates/part.details.php b/templates/part.details.php index 8afa3fee..b068781d 100644 --- a/templates/part.details.php +++ b/templates/part.details.php @@ -30,25 +30,23 @@ <input class="datepicker-input medium focus" type="text" key-value="" value="{{ task.due | dateTaskList }}" datepicker="due"> </div> </div> - <!-- - <div class="section detail-reminder" ng-class="{'date':isDue(task.reminder), 'editing':route.parameter=='reminder'}" ng-click="editReminder()" stop-event="click" + <div class="section detail-reminder" ng-class="{'date':isDue(task.reminder.date), 'editing':route.parameter=='reminder'}" ng-click="editReminder()" stop-event="click" oc-click-focus="{selector: 'div.detail-reminder input.datepicker-input', timeout: 0}"> - <span class="icon detail-reminder" ng-class="{'overdue':isOverDue(task.reminder)}"></span> - <div class="section-title" ng-class="{'overdue':isOverDue(task.reminder)}" ng-hide="route.parameter=='reminder'"> - <text rel="">{{ task.reminder | timeDetails }}</text> + <span class="icon detail-reminder" ng-class="{'overdue':isOverDue(task.reminder.date)}"></span> + <div class="section-title" ng-class="{'overdue':isOverDue(task.reminder.date)}" ng-hide="route.parameter=='reminder'"> + <text rel="">{{ task.reminder.date | timeDetails }}</text> </div> - <div class="section-description">{{ task.reminder | dateDetailsShort }}</div> + <div class="section-description">{{ task.reminder.date | dateDetailsShort }}</div> <a class="detail-delete" ng-click="deleteReminder()" stop-event="click"> <span class="icon detail-delete"></span> </a> <span class="icon detail-save" ng-click="endEdit()" stop-event="click"></span> <div class="section-edit" ng-show="route.parameter=='reminder'"> - <input class="datepicker-input medium focus" type="text" key-value="" value="{{ task.reminder | dateTaskList }}" datepicker="reminder"> + <input class="datepicker-input medium focus" type="text" key-value="" value="{{ task.reminder.date | dateTaskList }}" datepicker="reminder"> </div> </div> <ul class="subtasks buffer"> </ul> - --> <div class="note"> <div class="note-body selectable" ng-click="editNote()" stop-event="click" oc-click-focus="{selector: '.expandingArea textarea', timeout: 0}"> <!-- |