From 8c9b905248f04e66d8cd19d1f8e7e71e155e1c0b Mon Sep 17 00:00:00 2001 From: Chuck Hagenbuch Date: Sun, 7 Nov 2010 15:44:55 -0500 Subject: [PATCH] More progress on mobile task view. Links don't load correctly yet, but mark as complete/incomplete does work. Haven't gotten the right icons to show up yet. --- nag/mobile.php | 56 +++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 7 deletions(-) diff --git a/nag/mobile.php b/nag/mobile.php index e35cf25fd..7db040985 100644 --- a/nag/mobile.php +++ b/nag/mobile.php @@ -26,6 +26,14 @@ if (is_a($tasks, 'PEAR_Error')) { + @@ -61,13 +69,13 @@ if ($tasks->hasTasks()) { while ($task = $tasks->each()) { $dynamic_sort &= !$task->hasSubTasks(); + $style = ''; if (!empty($task->completed)) { - $style = 'linedRow closed'; + $style = 'closed'; } elseif (!empty($task->due) && $task->due < time()) { - $style = 'linedRow overdue'; - } else { - $style = 'linedRow'; + $style = 'overdue'; } + if ($style) { $style = ' class="' . $style . '"'; } if ($task->tasklist == '**EXTERNAL**') { // Just use a new share that this user owns for tasks from @@ -83,15 +91,49 @@ if ($tasks->hasTasks()) { } } - echo '
  • ' . htmlspecialchars($task->name) . '
  • '; + $task_link = '#'; + if ($share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::READ)) { + $task_link = $task->view_link; + } + + if ($share->hasPermission($GLOBALS['registry']->getAuth(), Horde_Perms::EDIT)) { + if (!$task->completed) { + $icon = 'nag-unchecked'; + if (!$task->childrenCompleted()) { + $href = '#'; + $label = _("Incomplete sub tasks, complete them first"); + } else { + $href = $task->complete_link; + $label = sprintf(_("Complete \"%s\""), $task->name); + } + } else { + $icon = 'nag-checked'; + if ($task->parent && $task->parent->completed) { + $href = '#'; + $label = _("Completed parent task, mark it as incomplete first"); + } else { + $href = $task->complete_link; + $label = sprintf(_("Mark \"%s\" as incomplete"), $task->name); + } + } + } else { + $href = '#'; + if ($task->completed) { + $label = _("Completed"); + $icon = 'nag-checked'; + } else { + $label = _("Not completed"); + $icon = 'nag-unchecked'; + } + } + + echo '' . htmlspecialchars($task->name) . '' . $label . ''; } } ?> -
    - -- 2.11.0