aboutsummaryrefslogtreecommitdiff
path: root/mod/tasks
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-03-17 12:00:58 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-03-17 12:00:58 -0300
commit00af8cc93d689f61be48390713a6a070b7ed761f (patch)
treec1b954f4f9061629dbf868c3036f0400a5803b4a /mod/tasks
parent815bb3bf5a5e8da9a7962a4a532c3129f09d5735 (diff)
parent228d3697bcd0218605be2e28131574cc85293a2e (diff)
downloadelgg-00af8cc93d689f61be48390713a6a070b7ed761f.tar.gz
elgg-00af8cc93d689f61be48390713a6a070b7ed761f.tar.bz2
Merge commit '228d3697bcd0218605be2e28131574cc85293a2e' as 'mod/tasks'
Diffstat (limited to 'mod/tasks')
-rw-r--r--mod/tasks/actions/tasks/comments/add.php169
-rw-r--r--mod/tasks/actions/tasks/delete.php32
-rw-r--r--mod/tasks/actions/tasks/edit.php110
-rw-r--r--mod/tasks/doc/sources/states.diabin0 -> 3492 bytes
-rw-r--r--mod/tasks/doc/states.pngbin0 -> 26173 bytes
-rw-r--r--mod/tasks/graphics/task-icons/active-large.pngbin0 -> 2220 bytes
-rw-r--r--mod/tasks/graphics/task-icons/active-medium.pngbin0 -> 1502 bytes
-rw-r--r--mod/tasks/graphics/task-icons/active-small.pngbin0 -> 1014 bytes
-rw-r--r--mod/tasks/graphics/task-icons/active-tiny.pngbin0 -> 578 bytes
-rw-r--r--mod/tasks/graphics/task-icons/assigned-large.pngbin0 -> 2258 bytes
-rw-r--r--mod/tasks/graphics/task-icons/assigned-medium.pngbin0 -> 1615 bytes
-rw-r--r--mod/tasks/graphics/task-icons/assigned-small.pngbin0 -> 1011 bytes
-rw-r--r--mod/tasks/graphics/task-icons/assigned-tiny.pngbin0 -> 596 bytes
-rw-r--r--mod/tasks/graphics/task-icons/closed-large.pngbin0 -> 2345 bytes
-rw-r--r--mod/tasks/graphics/task-icons/closed-medium.pngbin0 -> 1776 bytes
-rw-r--r--mod/tasks/graphics/task-icons/closed-small.pngbin0 -> 1294 bytes
-rw-r--r--mod/tasks/graphics/task-icons/closed-tiny.pngbin0 -> 685 bytes
-rw-r--r--mod/tasks/graphics/task-icons/done-large.pngbin0 -> 3267 bytes
-rw-r--r--mod/tasks/graphics/task-icons/done-medium.pngbin0 -> 2714 bytes
-rw-r--r--mod/tasks/graphics/task-icons/done-small.pngbin0 -> 1718 bytes
-rw-r--r--mod/tasks/graphics/task-icons/done-tiny.pngbin0 -> 933 bytes
-rw-r--r--mod/tasks/graphics/task-icons/new-large.pngbin0 -> 1282 bytes
-rw-r--r--mod/tasks/graphics/task-icons/new-medium.pngbin0 -> 956 bytes
-rw-r--r--mod/tasks/graphics/task-icons/new-small.pngbin0 -> 611 bytes
-rw-r--r--mod/tasks/graphics/task-icons/new-tiny.pngbin0 -> 397 bytes
-rw-r--r--mod/tasks/graphics/tasklist-icons/tasklist-large.pngbin0 -> 21418 bytes
-rw-r--r--mod/tasks/graphics/tasklist-icons/tasklist-medium.pngbin0 -> 10364 bytes
-rw-r--r--mod/tasks/graphics/tasklist-icons/tasklist-small.pngbin0 -> 3437 bytes
-rw-r--r--mod/tasks/graphics/tasklist-icons/tasklist-tiny.pngbin0 -> 1579 bytes
-rw-r--r--mod/tasks/languages/ca.php143
-rw-r--r--mod/tasks/languages/en.php235
-rw-r--r--mod/tasks/languages/es.php143
-rw-r--r--mod/tasks/lib/tasks.php304
-rw-r--r--mod/tasks/manifest.xml18
-rw-r--r--mod/tasks/pages/tasks/edit_task.php62
-rw-r--r--mod/tasks/pages/tasks/friends.php33
-rw-r--r--mod/tasks/pages/tasks/new_task.php48
-rw-r--r--mod/tasks/pages/tasks/owner.php58
-rw-r--r--mod/tasks/pages/tasks/view.php71
-rw-r--r--mod/tasks/pages/tasks/world.php41
-rw-r--r--mod/tasks/start.php433
-rw-r--r--mod/tasks/upgrades/2012100501.php79
-rw-r--r--mod/tasks/views/default/annotation/task_state_changed.php40
-rw-r--r--mod/tasks/views/default/forms/tasks/comments/add.php45
-rw-r--r--mod/tasks/views/default/forms/tasks/edit.php63
-rw-r--r--mod/tasks/views/default/forms/tasks/inline.php35
-rw-r--r--mod/tasks/views/default/icon/object/task.php80
-rw-r--r--mod/tasks/views/default/input/tasks/list.php27
-rw-r--r--mod/tasks/views/default/input/tasks/priority.php13
-rw-r--r--mod/tasks/views/default/js/tasks/tasklists.php114
-rw-r--r--mod/tasks/views/default/object/task.php133
-rw-r--r--mod/tasks/views/default/object/tasklist_top.php166
-rw-r--r--mod/tasks/views/default/river/object/task/create.php13
-rw-r--r--mod/tasks/views/default/tasks/css.php26
-rw-r--r--mod/tasks/views/default/tasks/group_module.php50
-rw-r--r--mod/tasks/views/default/tasks/js.php35
-rw-r--r--mod/tasks/views/default/tasks/page/elements/comments.php43
-rw-r--r--mod/tasks/views/default/tasks/participant_count.php42
-rw-r--r--mod/tasks/views/default/tasks/sidebar.php14
-rw-r--r--mod/tasks/views/default/tasks/sidebar/navigation.php60
-rw-r--r--mod/tasks/views/default/tasks/tasklist_graph.php65
-rw-r--r--mod/tasks/views/default/widgets/tasks/content.php38
-rw-r--r--mod/tasks/views/default/widgets/tasks/edit.php24
63 files changed, 3105 insertions, 0 deletions
diff --git a/mod/tasks/actions/tasks/comments/add.php b/mod/tasks/actions/tasks/comments/add.php
new file mode 100644
index 000000000..6221eccbd
--- /dev/null
+++ b/mod/tasks/actions/tasks/comments/add.php
@@ -0,0 +1,169 @@
+<?php
+/**
+ * Tasks add comment action
+ *
+ * @package ElggTasks
+ */
+
+group_gatekeeper();
+
+elgg_load_library('elgg:tasks');
+
+$entity_guid = (int) get_input('entity_guid');
+$comment_text = get_input('generic_comment');
+$state_action = get_input('state_action', false);
+
+
+// Let's see if we can get an entity with the specified GUID
+$entity = get_entity($entity_guid);
+if (!$entity) {
+ register_error(elgg_echo("generic_comment:notfound"));
+ forward(REFERER);
+}
+
+$user = elgg_get_logged_in_user_entity();
+
+if($comment_text) {
+ $annotation = create_annotation($entity->guid,
+ 'generic_comment',
+ $comment_text,
+ "",
+ $user->guid,
+ $entity->access_id);
+
+ // tell user annotation posted
+ if (!$annotation) {
+ register_error(elgg_echo("generic_comment:failure"));
+ forward(REFERER);
+ }
+}
+switch ($state_action) {
+ case 'assign':
+ add_entity_relationship(elgg_get_logged_in_user_guid(), 'subscribes', $entity_guid);
+ break;
+ case 'activate':
+ add_entity_relationship(elgg_get_logged_in_user_guid(), 'is_doing', $entity_guid);
+ break;
+ case 'assign_and_activate':
+ add_entity_relationship(elgg_get_logged_in_user_guid(), 'subscribes', $entity_guid);
+ add_entity_relationship(elgg_get_logged_in_user_guid(), 'is_doing', $entity_guid);
+ break;
+ case 'deactivate':
+ remove_entity_relationship(elgg_get_logged_in_user_guid(), 'is_doing', $entity_guid);
+ break;
+ case 'leave':
+ remove_entity_relationship(elgg_get_logged_in_user_guid(), 'is_doing', $entity_guid);
+ remove_entity_relationship(elgg_get_logged_in_user_guid(), 'subscribes', $entity_guid);
+ break;
+ case 'reopen':
+ remove_entity_relationships($entity_guid, 'is_doing', true);
+ remove_entity_relationships($entity_guid, 'subscribes', true);
+ break;
+}
+
+if (in_array($state_action, array('activate', 'assign_and_activate'))) {
+ if($active_task = tasks_get_user_active_task($user->guid)) {
+ $active_task->status = 'assigned';
+
+ create_annotation($active_task->guid,
+ 'task_state_changed',
+ 'assigned',
+ "",
+ $user->guid,
+ $active_task->access_id);
+ }
+}
+
+$new_state = tasks_get_state_from_action($state_action);
+
+if ($state_action == 'leave') {
+ $have_participants_yet = elgg_get_entities_from_relationship(array(
+ 'relationship' => 'subscribes',
+ 'relationship_guid' => $entity->guid,
+ 'inverse_relationship' => true,
+ 'count' => true,
+ ));
+ if ($have_participants_yet) {
+ $new_state = $entity->status;
+ }
+}
+
+if ($state_action == 'deactivate') {
+ $have_participants_yet = elgg_get_entities_from_relationship(array(
+ 'relationship' => 'is_doing',
+ 'relationship_guid' => $entity->guid,
+ 'inverse_relationship' => true,
+ 'count' => true,
+ ));
+ if ($have_participants_yet) {
+ $new_state = $entity->status;
+ }
+}
+
+if ($state_action == 'assign' && $entity->status == 'active') {
+ $new_state = $entity->status;
+}
+
+if($new_state) {
+ $entity->status = $new_state;
+ create_annotation($entity->guid,
+ 'task_state_changed',
+ $state_action,
+ "",
+ $user->guid,
+ $entity->access_id);
+}
+
+// notify if poster wasn't owner
+if ($entity->owner_guid != $user->guid) {
+
+ if($new_state) {
+ notify_user($entity->owner_guid,
+ $user->guid,
+ elgg_echo('tasks:email:subject'),
+ elgg_echo('tasks:email:body', array(
+ $user->name,
+ $entity->title,
+ $new_state,
+ $comment_text,
+ $entity->getURL(),
+ $user->name,
+ $user->getURL()
+ ))
+ );
+ } else {
+ notify_user($entity->owner_guid,
+ $user->guid,
+ elgg_echo('generic_comment:email:subject'),
+ elgg_echo('generic_comment:email:body', array(
+ $entity->title,
+ $user->name,
+ $comment_text,
+ $entity->getURL(),
+ $user->name,
+ $user->getURL()
+ ))
+ );
+ }
+}
+
+if ($new_state) {
+ system_message(elgg_echo("tasks:status:changed"));
+ $action = $state_action;
+} else {
+ system_message(elgg_echo("generic_comment:posted"));
+ $action = 'comment';
+}
+
+//add to river
+if (!in_array($state_action, array('activate', 'deactivate'))) {
+ $river = 'river/annotation/generic_comment/create';
+ add_to_river($river, $action, $user->guid, $entity->guid, "", 0, $annotation);
+}
+
+if ($new_state) {
+ echo "{\"new_state\": \"$new_state\"}";
+}
+
+// Forward to the page the action occurred on
+forward(REFERER);
diff --git a/mod/tasks/actions/tasks/delete.php b/mod/tasks/actions/tasks/delete.php
new file mode 100644
index 000000000..9e15831f4
--- /dev/null
+++ b/mod/tasks/actions/tasks/delete.php
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Remove a task
+ *
+ * @package ElggTasks
+ */
+
+$guid = get_input('guid');
+$task = get_entity($guid);
+if ($task) {
+ if ($task->canEdit()) {
+ $container = get_entity($task->container_guid);
+ $list = $task->list_guid;
+
+ if ($task->delete()) {
+ system_message(elgg_echo('tasks:delete:success'));
+ if ($list) {
+ if ($list = get_entity($list)) {
+ forward($list->getURL());
+ }
+ }
+ if (elgg_instanceof($container, 'group')) {
+ forward("tasks/group/$container->guid/all");
+ } else {
+ forward("tasks/owner/$container->username");
+ }
+ }
+ }
+}
+
+register_error(elgg_echo('tasks:delete:failure'));
+forward(REFERER);
diff --git a/mod/tasks/actions/tasks/edit.php b/mod/tasks/actions/tasks/edit.php
new file mode 100644
index 000000000..a69ddafe9
--- /dev/null
+++ b/mod/tasks/actions/tasks/edit.php
@@ -0,0 +1,110 @@
+<?php
+/**
+ * Create or edit a task
+ *
+ * @package ElggTasks
+ */
+
+$variables = elgg_get_config('tasks');
+$input = array();
+foreach ($variables as $name => $type) {
+ $input[$name] = get_input($name);
+ if ($name == 'title') {
+ $input[$name] = strip_tags($input[$name]);
+ }
+ if ($type == 'tags') {
+ $input[$name] = string_to_tag_array($input[$name]);
+ }
+}
+
+// Get guids
+$task_guid = (int)get_input('task_guid');
+$container_guid = (int)get_input('container_guid');
+$referer_guid = (int)get_input('referer_guid');
+
+$container = get_entity($container_guid);
+
+elgg_make_sticky_form('task');
+
+if (!$input['title']) {
+ register_error(elgg_echo('tasks:error:no_title'));
+ forward(REFERER);
+}
+
+if (!$container) {
+ forward(REFERER);
+}
+
+if ($input['priority'] == null) {
+ $input['priority'] = '2'; // normal is default
+}
+
+if ($task_guid) {
+ $task = get_entity($task_guid);
+ if (!$task || !$task->canEdit()) {
+ register_error(elgg_echo('tasks:error:no_save'));
+ forward(REFERER);
+ }
+ $new_task = false;
+} else {
+ $task = new ElggObject();
+ $task->subtype = 'task';
+ $task->status = 'new';
+ $task->time_status_changed = time();
+ $new_task = true;
+}
+
+if (sizeof($input) > 0) {
+ foreach ($input as $name => $value) {
+ $task->$name = $value;
+ }
+}
+
+$list_guid = $input['list_guid'];
+
+if ($list_guid) {
+ $task->list_guid = $list_guid;
+}
+else {
+ $task->list_guid = 0;
+}
+$task->container_guid = $container_guid;
+
+if ($task->save()) {
+
+ elgg_clear_sticky_form('task');
+
+ // Now save description as an annotation
+ $task->annotate('task', $task->description, $task->access_id);
+
+ system_message(elgg_echo('tasks:saved'));
+
+ if ($new_task) {
+ add_to_river('river/object/task/create', 'create', elgg_get_logged_in_user_guid(), $task->guid);
+ }
+
+ if ($new_task && $referer_guid && ($referer_entity = get_entity($referer_guid))) {
+ $link = elgg_view('output/url', array(
+ 'href' => $task->getURL(),
+ 'text' => $task->title,
+ ));
+ $annotation = create_annotation($referer_entity->guid,
+ 'generic_comment',
+ elgg_echo('tasks:this:referer:comment', array($link)),
+ "",
+ elgg_get_logged_in_user_guid(),
+ $referer_entity->access_id);
+ }
+
+ $task_json = array();
+ foreach ($task->getExportableValues() as $v) {
+ $task_json[$v] = $task->$v;
+ }
+ $task_json['list_guid'] = $task->list_guid;
+ echo json_encode($task_json);
+
+ forward($task->getURL());
+} else {
+ register_error(elgg_echo('tasks:error:no_save'));
+ forward(REFERER);
+}
diff --git a/mod/tasks/doc/sources/states.dia b/mod/tasks/doc/sources/states.dia
new file mode 100644
index 000000000..bab19f9bd
--- /dev/null
+++ b/mod/tasks/doc/sources/states.dia
Binary files differ
diff --git a/mod/tasks/doc/states.png b/mod/tasks/doc/states.png
new file mode 100644
index 000000000..9af95b0dc
--- /dev/null
+++ b/mod/tasks/doc/states.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/active-large.png b/mod/tasks/graphics/task-icons/active-large.png
new file mode 100644
index 000000000..e0552b40e
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/active-large.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/active-medium.png b/mod/tasks/graphics/task-icons/active-medium.png
new file mode 100644
index 000000000..465ed27f2
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/active-medium.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/active-small.png b/mod/tasks/graphics/task-icons/active-small.png
new file mode 100644
index 000000000..915efd157
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/active-small.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/active-tiny.png b/mod/tasks/graphics/task-icons/active-tiny.png
new file mode 100644
index 000000000..16a110f3a
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/active-tiny.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/assigned-large.png b/mod/tasks/graphics/task-icons/assigned-large.png
new file mode 100644
index 000000000..58631ac68
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/assigned-large.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/assigned-medium.png b/mod/tasks/graphics/task-icons/assigned-medium.png
new file mode 100644
index 000000000..c7377df6d
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/assigned-medium.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/assigned-small.png b/mod/tasks/graphics/task-icons/assigned-small.png
new file mode 100644
index 000000000..1d68db584
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/assigned-small.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/assigned-tiny.png b/mod/tasks/graphics/task-icons/assigned-tiny.png
new file mode 100644
index 000000000..1c8d1dfec
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/assigned-tiny.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/closed-large.png b/mod/tasks/graphics/task-icons/closed-large.png
new file mode 100644
index 000000000..b81fff75e
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/closed-large.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/closed-medium.png b/mod/tasks/graphics/task-icons/closed-medium.png
new file mode 100644
index 000000000..549a73ea7
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/closed-medium.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/closed-small.png b/mod/tasks/graphics/task-icons/closed-small.png
new file mode 100644
index 000000000..bc43fb107
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/closed-small.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/closed-tiny.png b/mod/tasks/graphics/task-icons/closed-tiny.png
new file mode 100644
index 000000000..a5e6eb5f6
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/closed-tiny.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/done-large.png b/mod/tasks/graphics/task-icons/done-large.png
new file mode 100644
index 000000000..7b61f452e
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/done-large.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/done-medium.png b/mod/tasks/graphics/task-icons/done-medium.png
new file mode 100644
index 000000000..d132d441e
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/done-medium.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/done-small.png b/mod/tasks/graphics/task-icons/done-small.png
new file mode 100644
index 000000000..c8157e58a
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/done-small.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/done-tiny.png b/mod/tasks/graphics/task-icons/done-tiny.png
new file mode 100644
index 000000000..d392777b4
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/done-tiny.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/new-large.png b/mod/tasks/graphics/task-icons/new-large.png
new file mode 100644
index 000000000..51f925da5
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/new-large.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/new-medium.png b/mod/tasks/graphics/task-icons/new-medium.png
new file mode 100644
index 000000000..6dfd09c5a
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/new-medium.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/new-small.png b/mod/tasks/graphics/task-icons/new-small.png
new file mode 100644
index 000000000..67cb399be
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/new-small.png
Binary files differ
diff --git a/mod/tasks/graphics/task-icons/new-tiny.png b/mod/tasks/graphics/task-icons/new-tiny.png
new file mode 100644
index 000000000..c10ed8139
--- /dev/null
+++ b/mod/tasks/graphics/task-icons/new-tiny.png
Binary files differ
diff --git a/mod/tasks/graphics/tasklist-icons/tasklist-large.png b/mod/tasks/graphics/tasklist-icons/tasklist-large.png
new file mode 100644
index 000000000..cdc590e4b
--- /dev/null
+++ b/mod/tasks/graphics/tasklist-icons/tasklist-large.png
Binary files differ
diff --git a/mod/tasks/graphics/tasklist-icons/tasklist-medium.png b/mod/tasks/graphics/tasklist-icons/tasklist-medium.png
new file mode 100644
index 000000000..5ced437be
--- /dev/null
+++ b/mod/tasks/graphics/tasklist-icons/tasklist-medium.png
Binary files differ
diff --git a/mod/tasks/graphics/tasklist-icons/tasklist-small.png b/mod/tasks/graphics/tasklist-icons/tasklist-small.png
new file mode 100644
index 000000000..147f35edb
--- /dev/null
+++ b/mod/tasks/graphics/tasklist-icons/tasklist-small.png
Binary files differ
diff --git a/mod/tasks/graphics/tasklist-icons/tasklist-tiny.png b/mod/tasks/graphics/tasklist-icons/tasklist-tiny.png
new file mode 100644
index 000000000..74f680ebd
--- /dev/null
+++ b/mod/tasks/graphics/tasklist-icons/tasklist-tiny.png
Binary files differ
diff --git a/mod/tasks/languages/ca.php b/mod/tasks/languages/ca.php
new file mode 100644
index 000000000..7722057ab
--- /dev/null
+++ b/mod/tasks/languages/ca.php
@@ -0,0 +1,143 @@
+<?php
+$language = array (
+ 'tasks' => 'Tasques',
+ 'tasks:owner' => 'Tasques de %s',
+ 'tasks:friends' => 'Tasques dels amics',
+ 'tasks:all' => 'Totes les tasques del lloc',
+ 'tasks:add' => 'Afegeix tasca',
+ 'tasks:addlist' => 'Afegeix llista',
+ 'tasks:lists' => 'Llistes de tasques',
+ 'tasks:lists:owner' => 'Llistes de tasques de %s',
+ 'tasks:lists:friends' => 'Llistes de tasques dels amics',
+ 'tasks:lists:all' => 'Totes les llistes de tasques del lloc',
+ 'tasks:group' => 'Tasques del grup',
+ 'groups:enabletasks' => 'Activa les tasques del grup',
+ 'tasks:edit' => 'Edita aquesta tasca',
+ 'tasks:delete' => 'Esborra aquesta tasca',
+ 'tasks:view' => 'Veure aquesta tasca',
+ 'tasks:lists:add' => 'Afegeix una llista de tasques',
+ 'tasks:lists:edit' => 'Edita aquesta llista de tasques',
+ 'tasks:lists:delete' => 'Esborra aquesta llista de tasques',
+ 'tasks:lists:view' => 'Veure llista de tasques',
+ 'tasks:via' => 'via tasques',
+ 'item:object:tasklist_top' => 'Llistes de tasques a dalt',
+ 'item:object:tasklist' => 'Llistes de tasques',
+ 'item:object:task' => 'Tasques',
+ 'tasks:nogroup' => 'Aquest grup encara no té tasques',
+ 'tasks:more' => 'Més tasques',
+ 'tasks:none' => 'No hi ha tasques encara',
+ 'tasks:lists:none' => 'No hi ha cap llista de tasques encara',
+ 'tasks:this' => 'Marca-ho com a tasca',
+ 'tasks:this:moreinfo' => 'Pots trobar més informació %s.',
+ 'tasks:this:moreinfo:here' => 'aquí',
+ 'tasks:this:referer:comment' => 'Nova tasca: %s',
+ 'tasks:priority:low' => 'Prioritat baixa',
+ 'tasks:priority:normal' => 'Prioritat normal',
+ 'tasks:priority:high' => 'Prioritat alta',
+ 'tasks:participant' => '%s treballant-hi',
+ 'tasks:participants' => '%s treballant-hi',
+ 'tasks:participants:see' => 'Veure qui hi està treballant',
+ 'river:create:object:task' => '%s ha creat la tasca %s',
+ 'river:create:object:tasklist' => '%s ha creat la llista de tasques %s',
+ 'river:create:object:tasklist_top' => '%s ha creat la llista de tasques %s',
+ 'river:update:object:task' => '%s ha actualitzat la tasca %s',
+ 'river:update:object:tasklist' => '%s ha actualitzat la llista de tasques %s',
+ 'river:update:object:tasklist_top' => '%s ha actualitzat la llista de tasques %s',
+ 'river:comment:object:task' => '%s ha comentat a la tasca %s',
+ 'river:comment:object:tasklist' => '%s ha comentat a la llista de tasques %s',
+ 'river:comment:object:tasklist_top' => '%s ha comentat a la llista de tasques %s',
+ 'river:assign:object:task' => '%s s\'ha assignat la tasca %s',
+ 'river:activate:object:task' => '%s ha marcat com a activa la tasca %s',
+ 'river:assign_and_activate:object:task' => '%s s\'ha assignat i ha marcat com activa la tasca %s',
+ 'river:deactivate:object:task' => '%s ha desmarcat com a activa la tasca %s',
+ 'river:mark_as_done:object:task' => '%s ha marcat com a feta la tasca %s',
+ 'river:reopen:object:task' => '%s ha reobert la tasca %s',
+ 'river:leave:object:task' => '%s ha deixat de fer la tasca %s',
+ 'river:close:object:task' => '%s ha tancat la tasca %s',
+ 'tasks:title' => 'Nom',
+ 'tasks:description' => 'Descripció',
+ 'tasks:list_guid' => 'Llista',
+ 'tasks:priority' => 'Prioritat',
+ 'tasks:tags' => 'Etiquetes',
+ 'tasks:elapsed_time' => 'Temps passat',
+ 'tasks:remaining_time' => 'Temps restant (per finalitzar la tasca)',
+ 'tasks:access_id' => 'Qui pot veure aquesta tasca?',
+ 'tasks:changehistory' => 'Historial de canvis',
+ 'tasks:comments:post' => 'Desar canvis',
+ 'tasks:add:gofull' => 'Veure formulari complet',
+ 'tasks:state:actions' => 'Accions',
+ 'tasks:state:action:noaction' => 'Deixa com a <em>%s</em>',
+ 'tasks:state:action:assign' => 'Accepta aquesta tasca',
+ 'tasks:state:action:leave' => 'Deixa aquesta tasca',
+ 'tasks:state:action:activate' => 'Marca com la teva tasca activa',
+ 'tasks:state:action:deactivate' => 'Desmarca com la teva tasca activa',
+ 'tasks:state:action:assign_and_activate' => 'Accepta i marca-la com la teva tasca activa',
+ 'tasks:state:action:mark_as_done' => 'Marca aquesta tasca com feta',
+ 'tasks:state:action:close' => 'Tanca aquesta tasca',
+ 'tasks:state:action:reopen' => 'Reobre aquesta tasca',
+ 'tasks:assigned' => 'Tasques assignades',
+ 'tasks:unassigned' => 'Tasques no assignades',
+ 'tasks:closed' => 'Tasques tancades',
+ 'tasks:lists:title' => 'Nom',
+ 'tasks:lists:description' => 'Descripció',
+ 'tasks:lists:startdate' => 'Data de començament',
+ 'tasks:enddate' => 'Data límit',
+ 'tasks:lists:tags' => 'Etiquetes',
+ 'tasks:lists:access_id' => 'Qui pot veure aquesta llista de tasques?',
+ 'tasks:noaccess' => 'No tens accés a la tasca',
+ 'tasks:cantedit' => 'No pots editar aquesta tasca',
+ 'tasks:saved' => 'Tasca desada',
+ 'tasks:notsaved' => 'La tasca no pot ser desada',
+ 'tasks:error:no_title' => 'Has d\'especificar un títol per a aquesta tasca.',
+ 'tasks:delete:success' => 'La tasca s\'ha esborrat correctament.',
+ 'tasks:delete:failure' => 'La tasca no pot ser esborrada',
+ 'tasks:status:changed' => 'L\'estat de la tasca ha estat canviat correctament',
+ 'tasks:lists:noaccess' => 'No tens accés a la llista de tasques',
+ 'tasks:lists:cantedit' => 'No pots editar aquesta llista de tasques',
+ 'tasks:lists:saved' => 'Llista de tasques desada',
+ 'tasks:lists:notsaved' => 'No es pot desar la llista de tasques',
+ 'tasks:lists:error:no_title' => 'Has d\'especificar un títol per a aquesta llista de tasques',
+ 'tasks:lists:delete:success' => 'La llista de tasques ha estat esborrada correctament',
+ 'tasks:lists:delete:failure' => 'La llista de tasques no es pot esborrar',
+ 'tasks:strapline:new' => 'Creada %s per %s',
+ 'tasks:strapline:assigned' => 'Assignada %s a %s',
+ 'tasks:strapline:unassigned' => 'Deixada %s a %s',
+ 'tasks:strapline:active' => 'Assignada %s a %s',
+ 'tasks:strapline:done' => 'Feta %s per %s',
+ 'tasks:strapline:closed' => 'Tancada %s per %s',
+ 'tasks:strapline:reopened' => 'Reoberta %s per %s',
+ 'tasks:lists:strapline' => 'Creada %s per %s.',
+ 'tasks:lists:deadline' => 'Deadline %s',
+ 'tasks:lists:graph:total' => 'Tasques de %s',
+ 'tasks:lists:graph:remaining' => 'Pendents %s',
+ 'tasks:lists:graph:assigned' => 'Assignades %s',
+ 'tasks:lists:graph:active' => 'Actives %s',
+ 'tasks:history:assign' => 's\'ha assignat aquesta tasca',
+ 'tasks:history:activate' => 'ha marcat aquesta com la seva tasca activa',
+ 'tasks:history:deactivate' => 'ha desmarcat aquesta com la seva tasca activa',
+ 'tasks:history:assign_and_activate' => 's\'ha assignat i ha marcat la tasca com a activa',
+ 'tasks:history:mark_as_done' => 'marca aquesta tasca com feta',
+ 'tasks:history:reopen' => 'ha reobert aquesta tasca',
+ 'tasks:history:leave' => 'ha deixat de fer aquesta tasca',
+ 'tasks:history:close' => 'ha tancat aquesta tasca (no l\'ha fet)',
+ 'tasks:active' => 'Tasques actives',
+ 'tasks:num' => 'Nombre de tasques a mostrar',
+ 'tasks:widget:description' => 'Aquesta és una llista de les teves tasques.',
+ 'tasks:label:view' => 'Veure tasca',
+ 'tasks:label:edit' => 'Edita tasca',
+ 'tasks:lists:label:view' => 'Veure llista de tasques',
+ 'tasks:lists:label:edit' => 'Edita llista de tasques',
+ 'tasks:sidebar:this' => 'Aquesta llista',
+ 'tasks:sidebar:children' => 'Llista les tasques',
+ 'tasks:sidebar:list' => 'Llista',
+ 'tasks:navigation' => 'Llista de tasques',
+ 'tasks:newchild' => 'Crea una tasca en aquesta llista',
+ 'tasks:backtolist' => 'Torna a \'%s\'',
+ 'friendlytime:future:minutes' => 'fa %s minuts',
+ 'friendlytime:future:minutes:singular' => 'fa un minut',
+ 'friendlytime:future:hours' => 'fa %s hores',
+ 'friendlytime:future:hours:singular' => 'fa una hora',
+ 'friendlytime:future:days' => 'fa %s dies',
+ 'friendlytime:future:days:singular' => 'demà',
+);
+add_translation("ca", $language); \ No newline at end of file
diff --git a/mod/tasks/languages/en.php b/mod/tasks/languages/en.php
new file mode 100644
index 000000000..27a670b38
--- /dev/null
+++ b/mod/tasks/languages/en.php
@@ -0,0 +1,235 @@
+<?php
+/**
+ * Tasks languages
+ *
+ * @package ElggTasks
+ */
+
+$english = array(
+
+ /**
+ * Menu items and titles
+ */
+
+ 'tasks' => "Tasks",
+ 'tasks:owner' => "%s's tasks",
+ 'tasks:friends' => "Friends' tasks",
+ 'tasks:all' => "All site tasks",
+ 'tasks:add' => "Add task",
+ 'tasks:addlist' => "Add list",
+
+ 'tasks:lists' => "Task lists",
+ 'tasks:lists:owner' => "%s's task lists",
+ 'tasks:lists:friends' => "Friends' task lists",
+ 'tasks:lists:all' => "All site task lists",
+
+ 'tasks:group' => "Group tasks",
+ 'groups:enabletasks' => 'Enable group tasks',
+
+ 'tasks:edit' => "Edit this task",
+ 'tasks:delete' => "Delete this task",
+ 'tasks:view' => "View task",
+
+ 'tasks:lists:add' => "Add a task list",
+ 'tasks:lists:edit' => "Edit this task list",
+ 'tasks:lists:delete' => "Delete this task list",
+ 'tasks:lists:view' => "View task list",
+
+ 'tasks:via' => "via tasks",
+ 'item:object:tasklist_top' => 'Task lists top',
+ 'item:object:tasklist' => 'Task lists ',
+ 'item:object:task' => 'Tasks',
+ 'tasks:nogroup' => 'This group does not have any tasks yet',
+ 'tasks:more' => 'More tasks',
+ 'tasks:none' => 'No tasks created yet',
+ 'tasks:lists:none' => 'No task list created yet',
+ 'tasks:this' => 'Task this',
+ 'tasks:this:moreinfo' => 'You can find more info %s.',
+ 'tasks:this:moreinfo:here' => 'here',
+ 'tasks:this:referer:comment' => 'Created new task: %s.',
+
+ 'tasks:priority:low' => 'Low priority',
+ 'tasks:priority:normal' => 'Normal priority',
+ 'tasks:priority:high' => 'High prioritiy',
+
+ 'tasks:participant' => '%s participant',
+ 'tasks:participants' => '%s participants',
+ 'tasks:participants:see' => 'See who is participating in it',
+
+ /**
+ * River
+ **/
+
+ 'river:create:object:task' => '%s created a task %s',
+ 'river:create:object:tasklist' => '%s created a task list %s',
+ 'river:create:object:tasklist_top' => '%s created a task list %s',
+ 'river:update:object:task' => '%s updated a task %s',
+ 'river:update:object:tasklist' => '%s updated a task list %s',
+ 'river:update:object:tasklist_top' => '%s updated a task list %s',
+ 'river:comment:object:task' => '%s commented on a task titled %s',
+ 'river:comment:object:tasklist' => '%s commented on a task list titled %s',
+ 'river:comment:object:tasklist_top' => '%s commented on a task list titled %s',
+
+ 'river:assign:object:task' => "%s assigned herself the task titled %s",
+ 'river:activate:object:task' => "%s set as active the task titled %s",
+ 'river:assign_and_activate:object:task' => "%s assigned herself and set as active the task titled %s",
+ 'river:deactivate:object:task' => "%s unset as active the task titled %s",
+ 'river:mark_as_done:object:task' => "%s set as done the task titled %s",
+ 'river:reopen:object:task' => "%s reopened the task titled %s",
+ 'river:leave:object:task' => "%s left to do the task titled %s",
+ 'river:close:object:task' => "%s closed the task titled %s",
+
+ /**
+ * Form fields
+ */
+
+ 'tasks:title' => 'Name',
+ 'tasks:description' => 'Description',
+ 'tasks:list_guid' => 'List',
+ 'tasks:priority' => 'Priority',
+ 'tasks:tags' => 'Tags',
+ 'tasks:elapsed_time' => 'Elapsed time',
+ 'tasks:remaining_time' => 'Remaining time (time to finish the task)',
+ 'tasks:access_id' => 'Who can see this task?',
+
+ 'tasks:changehistory' => 'Change history',
+ 'tasks:comments:post' => 'Save changes',
+ 'tasks:add:gofull' => 'View full form',
+
+ 'tasks:state:actions' => 'Actions',
+ 'tasks:state:action:noaction' => 'Leave as <em>%s</em>',
+ 'tasks:state:action:assign' => 'Accept this task',
+ 'tasks:state:action:leave' => 'Leave this task',
+ 'tasks:state:action:activate' => 'Set as your active task',
+ 'tasks:state:action:deactivate' => 'Unset as your active task',
+ 'tasks:state:action:assign_and_activate' => 'Accept this task and set as your active one',
+ 'tasks:state:action:mark_as_done' => 'Mark this task as done',
+ 'tasks:state:action:close' => 'Close this task',
+ 'tasks:state:action:reopen' => 'Reopen this task',
+
+ 'tasks:assigned' => 'Assigned tasks',
+ 'tasks:unassigned' => 'Unassigned tasks',
+ 'tasks:closed' => 'Closed tasks',
+
+ 'tasks:lists:title' => 'Name',
+ 'tasks:lists:description' => 'Description',
+ 'tasks:lists:startdate' => 'Start date',
+ 'tasks:enddate' => 'End date (deadline)',
+ 'tasks:lists:tags' => 'Tags',
+ 'tasks:lists:access_id' => 'Who can see this task list?',
+
+ /**
+ * Status and error messages
+ */
+ 'tasks:noaccess' => 'No access to task',
+ 'tasks:cantedit' => 'You cannot edit this task',
+ 'tasks:saved' => 'Task saved',
+ 'tasks:notsaved' => 'Task could not be saved',
+ 'tasks:error:no_title' => 'You must specify a title for this task.',
+ 'tasks:delete:success' => 'The task was successfully deleted.',
+ 'tasks:delete:failure' => 'The task could not be deleted.',
+ 'tasks:status:changed' => 'The state of the task has been changed successfully',
+
+ 'tasks:lists:noaccess' => 'No access to task list',
+ 'tasks:lists:cantedit' => 'You cannot edit this task list',
+ 'tasks:lists:saved' => 'Task list saved',
+ 'tasks:lists:notsaved' => 'Task list could not be saved',
+ 'tasks:lists:error:no_title' => 'You must specify a title for this task list.',
+ 'tasks:lists:delete:success' => 'The task list was successfully deleted.',
+ 'tasks:lists:delete:failure' => 'The task list could not be deleted.',
+
+ /**
+ * Task
+ */
+ 'tasks:strapline:new' => 'Reported %s by %s',
+ 'tasks:strapline:assigned' => 'Assigned %s to %s',
+ 'tasks:strapline:unassigned' => 'Unassigned %s to %s',
+ 'tasks:strapline:active' => 'Assigned %s to %s',
+ 'tasks:strapline:done' => 'Done %s by %s',
+ 'tasks:strapline:closed' => 'Closed %s by %s',
+ 'tasks:strapline:reopened' => 'Reopened %s by %s',
+
+ /**
+ * Task list
+ */
+ 'tasks:lists:strapline' => 'Created %s by %s. ',
+ 'tasks:lists:deadline' => 'Deadline %s',
+
+ 'tasks:lists:graph:total' => '%s tasks',
+ 'tasks:lists:graph:remaining' => '%s remaining',
+ 'tasks:lists:graph:assigned' => '%s assigned',
+ 'tasks:lists:graph:active' => '%s active',
+
+ /**
+ * Change history
+ */
+
+ 'tasks:history:assign' => "assgined herself this task",
+ 'tasks:history:activate' => "set this as her active task",
+ 'tasks:history:deactivate' => "unset this as her active task",
+ 'tasks:history:assign_and_activate' => "assigned and set this as her active task",
+ 'tasks:history:mark_as_done' => "set this task as done",
+ 'tasks:history:reopen' => "reopened this task",
+ 'tasks:history:leave' => "left to do this task",
+ 'tasks:history:close' => "closed this task (won't do)",
+
+ /**
+ * Widget
+ **/
+
+ 'tasks:active' => "Active tasks",
+ 'tasks:num' => 'Number of tasks to display',
+ 'tasks:widget:description' => "This is a list of your tasks.",
+
+ /**
+ * Submenu items
+ */
+ 'tasks:label:view' => "View task",
+ 'tasks:label:edit' => "Edit task",
+
+ 'tasks:lists:label:view' => "View task list",
+ 'tasks:lists:label:edit' => "Edit task list",
+
+ /**
+ * Sidebar items
+ */
+ 'tasks:sidebar:this' => "This list",
+ 'tasks:sidebar:children' => "List tasks",
+ 'tasks:sidebar:list' => "List",
+ 'tasks:navigation' => 'Tasks',
+
+ 'tasks:newchild' => "Create a subtask",
+ 'tasks:backtolist' => "Back to '%s'",
+
+ /**
+ * Times
+ */
+ 'friendlytime:future:minutes' => "in %s minutes",
+ 'friendlytime:future:minutes:singular' => "in a minute",
+ 'friendlytime:future:hours' => "in %s hours",
+ 'friendlytime:future:hours:singular' => "in an hour",
+ 'friendlytime:future:days' => "in %s days",
+ 'friendlytime:future:days:singular' => "tomorrow",
+
+ /**
+ * Comments
+ */
+ 'tasks:email:subject' => 'Task changed state',
+ 'tasks:email:body' => "%s changed your task \"%s\" state to %s.
+
+
+%s
+
+
+To reply or view the original item, click here:
+
+%s
+
+To view %s's profile, click here:
+
+%s
+
+You cannot reply to this email.",
+);
+
+add_translation("en", $english);
diff --git a/mod/tasks/languages/es.php b/mod/tasks/languages/es.php
new file mode 100644
index 000000000..479596527
--- /dev/null
+++ b/mod/tasks/languages/es.php
@@ -0,0 +1,143 @@
+<?php
+$language = array (
+ 'tasks' => 'Tareas',
+ 'tasks:owner' => 'Tareas de %s',
+ 'tasks:friends' => 'Tareas de amigxs',
+ 'tasks:all' => 'Todas las tareas del sitio',
+ 'tasks:add' => 'Añadir tarea',
+ 'tasks:addlist' => 'Añadir lista',
+ 'tasks:lists' => 'Lista de tareas',
+ 'tasks:lists:owner' => 'Lista de tareas de %s',
+ 'tasks:lists:friends' => 'Lista de tareas de amigxs',
+ 'tasks:lists:all' => 'Todas las listas de tareas del sitio',
+ 'tasks:group' => 'Tareas del grupo',
+ 'groups:enabletasks' => 'Activa las tareas del grupo',
+ 'tasks:edit' => 'Edita esta tarea',
+ 'tasks:delete' => 'Borra esta tarea',
+ 'tasks:view' => 'Ver esta tarea',
+ 'tasks:lists:add' => 'Añade una lista de tareas',
+ 'tasks:lists:edit' => 'Edita esta lista de tareas',
+ 'tasks:lists:delete' => 'Borra esta lista de tareas',
+ 'tasks:lists:view' => 'Ver lista de tareas',
+ 'tasks:via' => 'via tareas',
+ 'item:object:tasklist_top' => 'Lista de tareas de arriba',
+ 'item:object:tasklist' => 'Lista de tareas',
+ 'item:object:task' => 'Tareas',
+ 'tasks:nogroup' => 'Este grupo todavía no tiene tareas',
+ 'tasks:more' => 'Más tareas',
+ 'tasks:none' => 'No hay tareas todavía',
+ 'tasks:lists:none' => 'No hay listas de tareas todavía',
+ 'tasks:this' => 'Marcar como tarea',
+ 'tasks:this:moreinfo' => 'Puedes encontrar más info %s.',
+ 'tasks:this:moreinfo:here' => 'aquí',
+ 'tasks:this:referer:comment' => 'Nueva tarea: %s.',
+ 'tasks:priority:low' => 'Prioridad baja',
+ 'tasks:priority:normal' => 'Prioridad normal',
+ 'tasks:priority:high' => 'Prioridad alta',
+ 'tasks:participant' => '%s colaborando',
+ 'tasks:participants' => '%s colaboradorxs',
+ 'tasks:participants:see' => 'Ver quien está colaborando',
+ 'river:create:object:task' => '%s ha creado una tarea %s',
+ 'river:create:object:tasklist' => '%s ha creado una lista de tareas %s',
+ 'river:create:object:tasklist_top' => '%s ha creado una lista de tareas %s',
+ 'river:update:object:task' => '%s ha actualizado la tarea %s',
+ 'river:update:object:tasklist' => '%s ha actualizado la lista de tareas %s',
+ 'river:update:object:tasklist_top' => '%s ha actualizado la lista de tareas %s',
+ 'river:comment:object:task' => '%s ha comentado la lista de tareas %s',
+ 'river:comment:object:tasklist' => '%s ha comentado la lista de tareas %s',
+ 'river:comment:object:tasklist_top' => '%s ha comentado la lista de tareas %s',
+ 'river:assign:object:task' => '%s se ha asignado la tarea %s',
+ 'river:activate:object:task' => '%s ha marcado como activa la tarea %s',
+ 'river:assign_and_activate:object:task' => '%s ha marcado como activa la tarea %s y se la ha asignado',
+ 'river:deactivate:object:task' => '%s ha desmarcado como activa la tarea %s',
+ 'river:mark_as_done:object:task' => '%s ha marcado como realizada la tarea %s',
+ 'river:reopen:object:task' => '%s ha reabierto la tarea %s',
+ 'river:leave:object:task' => '%s ha dejado la tarea %s',
+ 'river:close:object:task' => '%s ha cerrado la tarea %s',
+ 'tasks:title' => 'Nombre',
+ 'tasks:description' => 'Descripción',
+ 'tasks:list_guid' => 'Lista',
+ 'tasks:priority' => 'Prioridad',
+ 'tasks:tags' => 'Etiquetas',
+ 'tasks:elapsed_time' => 'Tiempo pasado',
+ 'tasks:remaining_time' => 'Tiempo restante (para finalizar la tarea)',
+ 'tasks:access_id' => '¿Quién puede ver esta tarea?',
+ 'tasks:changehistory' => 'Historial de cambios',
+ 'tasks:comments:post' => 'Guardar cambios',
+ 'tasks:add:gofull' => 'Ver formulario completo',
+ 'tasks:state:actions' => 'Acciones',
+ 'tasks:state:action:noaction' => 'Marca como <em>%s</em>',
+ 'tasks:state:action:assign' => 'Aceptar esta tarea',
+ 'tasks:state:action:leave' => 'Abandonar esta tarea',
+ 'tasks:state:action:activate' => 'Marca como tu tarea activa',
+ 'tasks:state:action:deactivate' => 'Desmarca como tu tarea activa',
+ 'tasks:state:action:assign_and_activate' => 'Acepta y márcala como tu tarea activa',
+ 'tasks:state:action:mark_as_done' => 'Marca esta tarea como realizada',
+ 'tasks:state:action:close' => 'Cierra esta tarea',
+ 'tasks:state:action:reopen' => 'Reabre esta tarea',
+ 'tasks:assigned' => 'Tareas asignadas',
+ 'tasks:unassigned' => 'Tareas no asignadas',
+ 'tasks:closed' => 'Tareas cerradas',
+ 'tasks:lists:title' => 'Nombre',
+ 'tasks:lists:description' => 'Descripción',
+ 'tasks:lists:startdate' => 'Fecha de inicio',
+ 'tasks:enddate' => 'Fecha límite',
+ 'tasks:lists:tags' => 'Etiquetas',
+ 'tasks:lists:access_id' => '¿Quién puede ver esta lista de tareas?',
+ 'tasks:noaccess' => 'No tienes acceso a esta tarea',
+ 'tasks:cantedit' => 'No puedes editar esta tarea',
+ 'tasks:saved' => 'Tarea guardada',
+ 'tasks:notsaved' => 'La tarea no se ha podido guardar',
+ 'tasks:error:no_title' => 'Debes especificar un título para esta tarea.',
+ 'tasks:delete:success' => 'La tarea se ha borrado correctamente.',
+ 'tasks:delete:failure' => 'La tarea no se ha podido borrar.',
+ 'tasks:status:changed' => 'El estado de esta tarea ha canviado correctamente',
+ 'tasks:lists:noaccess' => 'No tienes acceso a la lista de tareas',
+ 'tasks:lists:cantedit' => 'No puedes editar esta lista de tareas',
+ 'tasks:lists:saved' => 'Lista de tareas guardada',
+ 'tasks:lists:notsaved' => 'La lista de tareas no se puede borrar',
+ 'tasks:lists:error:no_title' => 'Debes especificar un título para esta lista de tareas',
+ 'tasks:lists:delete:success' => 'La lista de tareas se ha borrado correctamente',
+ 'tasks:lists:delete:failure' => 'La lista de tareas no se ha podido borrar.',
+ 'tasks:strapline:new' => 'Creada %s por %s',
+ 'tasks:strapline:assigned' => 'Asignada %s por %s',
+ 'tasks:strapline:unassigned' => 'Abandonada %s por %s',
+ 'tasks:strapline:active' => 'Asignada %s por %s',
+ 'tasks:strapline:done' => 'Realizada %s por %s',
+ 'tasks:strapline:closed' => 'Cerrada %s por %s',
+ 'tasks:strapline:reopened' => 'Reabierta %s por %s',
+ 'tasks:lists:strapline' => 'Creada %s por %s',
+ 'tasks:lists:deadline' => 'Deadline %s',
+ 'tasks:lists:graph:total' => '%s tareas',
+ 'tasks:lists:graph:remaining' => 'Pendientes %s',
+ 'tasks:lists:graph:assigned' => 'Asignadas %s',
+ 'tasks:lists:graph:active' => 'Activas %s',
+ 'tasks:history:assign' => 'se ha asignado esta tarea',
+ 'tasks:history:activate' => 'ha marcado ésta como su tarea activa',
+ 'tasks:history:deactivate' => 'ha desmarcado ésta como su tarea activa',
+ 'tasks:history:assign_and_activate' => 'se ha asignado y ha marcado ésta como su tarea activa',
+ 'tasks:history:mark_as_done' => 'ha marcado esta tarea como realizada',
+ 'tasks:history:reopen' => 'ha reabierto esta tarea',
+ 'tasks:history:leave' => 'ha abandonado esta tarea',
+ 'tasks:history:close' => 'ha cerrado esta tarea (lo la ha realizado)',
+ 'tasks:active' => 'Tareas activas',
+ 'tasks:num' => 'Número de tareas a mostrar',
+ 'tasks:widget:description' => 'Esta es una lista de tus tareas.',
+ 'tasks:label:view' => 'Ver tarea',
+ 'tasks:label:edit' => 'Editar tarea',
+ 'tasks:lists:label:view' => 'Ver lista de tareas',
+ 'tasks:lists:label:edit' => 'Editar lista de tareas',
+ 'tasks:sidebar:this' => 'Esta lista',
+ 'tasks:sidebar:children' => 'lista de tareas',
+ 'tasks:sidebar:list' => 'Lista',
+ 'tasks:navigation' => 'Lista de tareas',
+ 'tasks:newchild' => 'Crea una tarea en esta lista',
+ 'tasks:backtolist' => 'Volver a \'%s\'',
+ 'friendlytime:future:minutes' => 'en %s minutos',
+ 'friendlytime:future:minutes:singular' => 'en un minuto',
+ 'friendlytime:future:hours' => 'en %s horas',
+ 'friendlytime:future:hours:singular' => 'en una hora',
+ 'friendlytime:future:days' => 'en %s días',
+ 'friendlytime:future:days:singular' => 'mañana',
+);
+add_translation("es", $language);
diff --git a/mod/tasks/lib/tasks.php b/mod/tasks/lib/tasks.php
new file mode 100644
index 000000000..190935102
--- /dev/null
+++ b/mod/tasks/lib/tasks.php
@@ -0,0 +1,304 @@
+<?php
+
+/**
+ * Prepare the add/edit form variables
+ *
+ * @param ElggObject $tasklist
+ * @return array
+ */
+function tasklist_prepare_form_vars($tasklist = null, $list_guid = 0) {
+
+ // input names => defaults
+ $values = array(
+ 'title' => '',
+ 'description' => '',
+ 'enddate' => '',
+ 'access_id' => ACCESS_DEFAULT,
+ 'write_access_id' => ACCESS_DEFAULT,
+ 'tags' => '',
+ 'container_guid' => elgg_get_page_owner_guid(),
+ 'guid' => null,
+ 'entity' => $tasklist,
+ 'list_guid' => $list_guid,
+ );
+
+ if ($tasklist) {
+ foreach (array_keys($values) as $field) {
+ if (isset($tasklist->$field)) {
+ $values[$field] = $tasklist->$field;
+ }
+ }
+ }
+
+ if (elgg_is_sticky_form('tasklist')) {
+ $sticky_values = elgg_get_sticky_values('tasklist');
+ foreach ($sticky_values as $key => $value) {
+ $values[$key] = $value;
+ }
+ }
+
+ elgg_clear_sticky_form('tasklist');
+
+ return $values;
+}
+
+/**
+ * Prepare the add/edit form variables
+ *
+ * @param ElggObject $task
+ * @return array
+ */
+function task_prepare_form_vars($task = null, $list_guid = 0) {
+
+ // input names => defaults
+ $values = array(
+ 'title' => get_input('title', ''),
+ 'description' => '',
+ 'priority' => '',
+ 'access_id' => ACCESS_DEFAULT,
+ 'write_access_id' => ACCESS_DEFAULT,
+ 'tags' => '',
+ 'container_guid' => elgg_get_page_owner_guid(),
+ 'guid' => null,
+ 'entity' => $task,
+ 'list_guid' => $list_guid,
+ 'referer_guid' => get_input('referer_guid', ''),
+ );
+
+ if ($task) {
+ foreach (array_keys($values) as $field) {
+ if (isset($task->$field)) {
+ $values[$field] = $task->$field;
+ }
+ }
+ }
+
+ if (elgg_is_sticky_form('task')) {
+ $sticky_values = elgg_get_sticky_values('task');
+ foreach ($sticky_values as $key => $value) {
+ $values[$key] = $value;
+ }
+ }
+
+ elgg_clear_sticky_form('task');
+
+ if ($referer = get_input('referer')) {
+ $link = elgg_view('output/url', array(
+ 'href' => $referer,
+ 'text' => elgg_echo('tasks:this:moreinfo:here'),
+ ));
+ $values['description'] .= "<p>" . elgg_echo('tasks:this:moreinfo', array($link)) . "</p>";
+ }
+
+ return $values;
+}
+
+
+function tasks_get_entities($options) {
+ $default = array(
+ 'type' => 'object',
+ 'subtype' => 'task',
+ );
+ if (!isset($options['metadata_name_value_pairs']) || !is_array($options['metadata_name_value_pairs'])) {
+ $options['metadata_name_value_pairs'] = array();
+ }
+ if (isset($options['list_guid'])) {
+ $options['metadata_name_value_pairs'][] = array(
+ 'name' => 'list_guid',
+ 'value' => $options['list_guid'],
+ );
+ unset($options['parent_guid']);
+ }
+ if (isset($options['status'])) {
+ $options['metadata_name_value_pairs'][] = array(
+ 'name' => 'status',
+ 'value' => $options['status'],
+ );
+ unset($options['status']);
+ }
+
+ $options = array_merge($default, $options);
+ return elgg_get_entities_from_metadata($options);
+}
+
+function tasks_get_actions_from_state($state){
+ switch($state) {
+
+ case 'new':
+ case 'unassigned':
+ case 'reopened':
+ $actions = array(
+ 'assign',
+ 'assign_and_activate',
+ 'mark_as_done',
+ 'close',
+ );
+ break;
+
+ case 'assigned':
+ $actions = array(
+ 'activate',
+ 'leave',
+ 'mark_as_done',
+ 'close',
+ );
+ break;
+
+ case 'active':
+ $actions = array(
+ 'deactivate',
+ 'leave',
+ 'mark_as_done',
+ 'close',
+ );
+ break;
+
+ case 'done':
+ case 'closed':
+ $actions = array(
+ 'reopen',
+ );
+ break;
+
+ }
+
+ return $actions;
+}
+
+function tasks_get_possible_actions($task, $user_guid = 0) {
+
+ if(!$user_guid) {
+ $user_guid = elgg_get_logged_in_user_guid();
+ }
+
+ $is_doing = check_entity_relationship($user_guid, 'is_doing', $task->guid);
+ $subscribes = check_entity_relationship($user_guid, 'subscribes', $task->guid);
+
+ if ($task->status == 'active' && $is_doing) {
+ $status = 'active';
+ } elseif ($task->status == 'assigned' && $subscribes) {
+ $status = 'assigned';
+ } elseif ($task->status == 'active' || $task->status == 'assigned') {
+ $status = 'unassigned';
+ } else {
+ $status = $task->status;
+ }
+
+ return tasks_get_actions_from_state($status);
+}
+
+function tasks_prepare_radio_options($task) {
+
+ $actions = tasks_get_possible_actions($task);
+
+ $actions_labels = array(
+ elgg_echo("tasks:state:action:noaction", array($task->status)) => '',
+ );
+
+ foreach($actions as $action) {
+ $actions_labels[elgg_echo("tasks:state:action:$action")] = $action;
+ }
+
+ return $actions_labels;
+}
+
+function tasks_register_actions_menu($task) {
+
+ foreach (tasks_get_possible_actions($task) as $action) {
+ $action_url = "action/tasks/comments/add?" . http_build_query(array(
+ 'entity_guid' => $task->guid,
+ 'state_action' => $action,
+ ), '', '&');
+ $action_url = elgg_add_action_tokens_to_url($action_url);
+ $item = new ElggMenuItem($action, elgg_echo("tasks:state:action:$action"), $action_url);
+ elgg_register_menu_item('tasks_hover', $item);
+ }
+}
+
+function tasks_reset_actions_menu() {
+ global $CONFIG;
+ if (isset($CONFIG->menus['tasks_hover'])) {
+ unset($CONFIG->menus['tasks_hover']);
+ }
+}
+
+function tasks_get_state_from_action($action){
+ $actions_states = array(
+ 'assign' => 'assigned',
+ 'leave' => 'unassigned',
+ 'activate' => 'active',
+ 'deactivate' => 'assigned',
+ 'assign_and_activate' => 'active',
+ 'mark_as_done' => 'done',
+ 'close' => 'closed',
+ 'reopen' => 'reopened',
+ );
+ return $actions_states[$action];
+}
+
+function tasks_get_user_active_task ($user_guid) {
+ return array_shift(elgg_get_entities_from_metadata(array(
+ 'metadata_name' => 'status',
+ 'metadata_value' => 'active',
+ 'owner_guid' => $user_guid,
+ )));
+}
+
+/**
+ * Register the navigation menu
+ *
+ * @param ElggEntity $container Container entity for the tasks
+ */
+function tasks_register_navigation_tree($container) {
+ if (!$container) {
+ return;
+ }
+
+ $tasklists_top = elgg_get_entities_from_metadata(array(
+ 'type' => 'object',
+ 'subtype' => 'task',
+ 'container_guid' => $container->getGUID(),
+ 'metadata_name' => 'list_guid',
+ 'metadata_value' => 0,
+ 'limit' => 0,
+ ));
+
+ if (!$tasklists_top) {
+ return;
+ }
+
+ foreach ($tasklists_top as $tasklist) {
+ elgg_register_menu_item('tasks_nav', array(
+ 'name' => $tasklist->getGUID(),
+ 'text' => $tasklist->title,
+ 'href' => $tasklist->getURL(),
+ ));
+
+ $stack = array();
+ array_push($stack, $tasklist);
+ while (count($stack) > 0) {
+ $list = array_pop($stack);
+ $tasklists = elgg_get_entities_from_metadata(array(
+ 'type' => 'object',
+ 'subtype' => 'task',
+ 'metadata_name' => 'list_guid',
+ 'metadata_value' => $list->guid,
+ 'container_guid' => $container->getGUID(),
+ 'limit' => 0,
+ ));
+
+ if ($tasklists) {
+ foreach ($tasklists as $tasklist) {
+ elgg_register_menu_item('tasks_nav', array(
+ 'name' => $tasklist->getGUID(),
+ 'text' => $tasklist->title,
+ 'href' => $tasklist->getURL(),
+ 'parent_name' => $list->getGUID(),
+ ));
+ array_push($stack, $tasklist);
+ }
+ }
+ }
+ }
+}
+
diff --git a/mod/tasks/manifest.xml b/mod/tasks/manifest.xml
new file mode 100644
index 000000000..5e6b386fa
--- /dev/null
+++ b/mod/tasks/manifest.xml
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin_manifest xmlns="http://www.elgg.org/plugin_manifest/1.8">
+ <name>Tasks</name>
+ <author>Lorea developers</author>
+ <version>1.8.1</version>
+ <category>bundled</category>
+ <category>content</category>
+ <category>widget</category>
+ <description>Elgg Task Management</description>
+ <website>https://lorea.org</website>
+ <copyright>(C) Lorea 2012-2013</copyright>
+ <license>GNU Affero General Public License, version 3 or later</license>
+ <requires>
+ <type>elgg_release</type>
+ <version>1.8</version>
+ </requires>
+ <activate_on_install>true</activate_on_install>
+</plugin_manifest>
diff --git a/mod/tasks/pages/tasks/edit_task.php b/mod/tasks/pages/tasks/edit_task.php
new file mode 100644
index 000000000..646418761
--- /dev/null
+++ b/mod/tasks/pages/tasks/edit_task.php
@@ -0,0 +1,62 @@
+<?php
+/**
+ * Edit a task
+ *
+ * @package ElggTasks
+ */
+
+gatekeeper();
+
+$task_guid = (int)get_input('guid');
+$task = get_entity($task_guid);
+if (!$task) {
+
+}
+
+$container = $task->getContainerEntity();
+if (!$container) {
+
+}
+
+$list = get_entity($task->list_guid);
+if (!$list) {
+
+}
+
+elgg_set_page_owner_guid($container->getGUID());
+
+if (elgg_instanceof($container, 'user')) {
+ elgg_push_breadcrumb($container->name, "tasks/owner/$container->username/");
+} elseif (elgg_instanceof($container, 'group')) {
+ elgg_push_breadcrumb($container->name, "tasks/group/$container->guid/all");
+}
+if($list) {
+ elgg_push_breadcrumb($list->title, "tasks/view/$list->guid/$list->title");
+}
+elgg_push_breadcrumb($task->title, $task->getURL());
+elgg_push_breadcrumb(elgg_echo('edit'));
+
+$title = elgg_echo("tasks:edit");
+
+if ($task->canEdit()) {
+ $vars = array(
+ 'guid' => $task_guid,
+ 'container_guid' => $container->guid,
+ );
+
+ foreach(array_keys(elgg_get_config('tasks')) as $variable){
+ $vars[$variable] = $task->$variable;
+ }
+
+ $content = elgg_view_form('tasks/edit', array(), $vars);
+} else {
+ $content = elgg_echo("tasks:noaccess");
+}
+
+$body = elgg_view_layout('content', array(
+ 'filter' => '',
+ 'content' => $content,
+ 'title' => $title,
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/tasks/pages/tasks/friends.php b/mod/tasks/pages/tasks/friends.php
new file mode 100644
index 000000000..cda0d6788
--- /dev/null
+++ b/mod/tasks/pages/tasks/friends.php
@@ -0,0 +1,33 @@
+<?php
+/**
+ * List a user's friends' tasks
+ *
+ * @package ElggTasks
+ */
+
+$owner = elgg_get_page_owner_entity();
+if (!elgg_instanceof($owner, 'user')) {
+ forward('tasks/all');
+}
+
+elgg_register_title_button('tasks', 'add');
+
+elgg_push_breadcrumb($owner->name, "tasks/owner/$owner->username");
+elgg_push_breadcrumb(elgg_echo('friends'));
+
+$title = elgg_echo('tasks:friends');
+
+$content = list_user_friends_objects($owner->guid, 'task', 10, false);
+if (!$content) {
+ $content = elgg_echo('tasks:none');
+}
+
+$params = array(
+ 'filter_context' => 'friends',
+ 'content' => $content,
+ 'title' => $title,
+);
+
+$body = elgg_view_layout('content', $params);
+
+echo elgg_view_page($title, $body);
diff --git a/mod/tasks/pages/tasks/new_task.php b/mod/tasks/pages/tasks/new_task.php
new file mode 100644
index 000000000..06a98466d
--- /dev/null
+++ b/mod/tasks/pages/tasks/new_task.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * Create a new task
+ *
+ * @package ElggTasks
+ */
+
+gatekeeper();
+
+$list_guid = (int) get_input('guid');
+$list = get_entity($list_guid);
+if (!$list) {
+}
+
+if (elgg_instanceof($list, 'object', 'task') || elgg_instanceof($list, 'object', 'tasklist')) {
+ $container = $list->getContainerEntity();
+ if (!$container) {
+ $container = elgg_get_logged_in_user_guid();
+ }
+} elseif (elgg_instanceof($list, 'user') || elgg_instanceof($list, 'group')) {
+ $container = $list;
+ // not a real list
+ $list_guid = null;
+}
+
+elgg_set_page_owner_guid($container->getGUID());
+
+if (elgg_instanceof($container, 'user')) {
+ elgg_push_breadcrumb($container->name, "tasks/owner/$container->username/");
+} elseif (elgg_instanceof($container, 'group')) {
+ elgg_push_breadcrumb($container->name, "tasks/group/$container->guid/all");
+}
+
+$title = elgg_echo('tasks:add');
+elgg_push_breadcrumb($title);
+
+
+$vars = task_prepare_form_vars(null, $list_guid);
+
+$content = elgg_view_form('tasks/edit', array(), $vars);
+
+$body = elgg_view_layout('content', array(
+ 'filter' => '',
+ 'content' => $content,
+ 'title' => $title,
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/tasks/pages/tasks/owner.php b/mod/tasks/pages/tasks/owner.php
new file mode 100644
index 000000000..801c00be9
--- /dev/null
+++ b/mod/tasks/pages/tasks/owner.php
@@ -0,0 +1,58 @@
+<?php
+/**
+ * List a user's or group's tasks
+ *
+ * @package ElggTasks
+ */
+
+$owner = elgg_get_page_owner_entity();
+if (!$owner) {
+ forward('tasks/all');
+}
+
+// access check for closed groups
+group_gatekeeper();
+
+$title = elgg_echo('tasks:lists:owner', array($owner->name));
+
+elgg_push_breadcrumb($owner->name);
+
+elgg_register_title_button('tasks', 'add');
+
+$options = array(
+ 'type' => 'object',
+ 'subtypes' => 'task',
+ 'container_guid' => elgg_get_page_owner_guid(),
+ 'full_view' => false,
+ 'metadata_name' => 'list_guid',
+ 'metadata_value' => 0,
+);
+
+$content = elgg_list_entities_from_metadata($options);
+
+if (!$content) {
+ $content = '<p>' . elgg_echo('tasks:none') . '</p>';
+}
+
+$filter_context = '';
+if (elgg_get_page_owner_guid() == elgg_get_logged_in_user_guid()) {
+ $filter_context = 'mine';
+}
+
+$sidebar = elgg_view('tasks/sidebar/navigation');
+$sidebar .= elgg_view('tasks/sidebar');
+
+$params = array(
+ 'filter_context' => $filter_context,
+ 'content' => $content,
+ 'title' => $title,
+ 'sidebar' => $sidebar,
+);
+
+if (elgg_instanceof($owner, 'group')) {
+ $params['filter'] = '';
+}
+
+$body = elgg_view_layout('content', $params);
+
+echo elgg_view_page($title, $body);
diff --git a/mod/tasks/pages/tasks/view.php b/mod/tasks/pages/tasks/view.php
new file mode 100644
index 000000000..51759dda1
--- /dev/null
+++ b/mod/tasks/pages/tasks/view.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * View a single task
+ *
+ * @package ElggTasks
+ */
+
+$guid = get_input('guid');
+$entity = get_entity($guid);
+if (!$entity) {
+ forward();
+}
+
+$container = $entity->getContainerEntity();
+$list = get_entity($entity->list_guid);
+
+elgg_set_page_owner_guid($container->guid);
+
+group_gatekeeper();
+
+if (!$container) {
+}
+
+$title = $entity->title;
+
+// bread crumbs
+if (elgg_instanceof($container, 'user')) {
+ elgg_push_breadcrumb($container->name, "tasks/owner/$container->username/");
+} elseif (elgg_instanceof($container, 'group')) {
+ elgg_push_breadcrumb($container->name, "tasks/group/$container->guid/all");
+}
+
+$crumbs = array();
+while($list && !($list instanceof ElggUser || $list instanceof ElggGroup)) {
+ array_unshift($crumbs, $list);
+ $list = get_entity($list->list_guid);
+}
+foreach($crumbs as $crumb) {
+ elgg_push_breadcrumb($crumb->title, $crumb->getURL());
+}
+elgg_push_breadcrumb($title);
+
+// content
+$content = elgg_view_entity($entity, array('full_view' => true));
+
+//if (!elgg_instanceof($entity, 'object', 'task') && $container->canWriteToContainer(0, 'object', 'task')) {
+if ($container->canWriteToContainer(0, 'object', 'task')) {
+ elgg_load_js('elgg.tasks');
+
+ $url = "tasks/add/$entity->guid";
+ elgg_register_menu_item('title', array(
+ 'name' => 'subtask',
+ 'href' => $url,
+ 'text' => elgg_echo('tasks:newchild'),
+ 'link_class' => 'elgg-button elgg-button-action',
+ ));
+
+ $can_comment = $entity->canEdit();
+ $content .= elgg_view_comments($entity, $can_comment);
+}
+/*} elseif (elgg_instanceof($entity, 'object', 'task')) {
+}*/
+
+$body = elgg_view_layout('content', array(
+ 'filter' => '',
+ 'content' => $content,
+ 'title' => $title,
+ 'sidebar' => elgg_view('tasks/sidebar/navigation', array('entity' => $entity)),
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/tasks/pages/tasks/world.php b/mod/tasks/pages/tasks/world.php
new file mode 100644
index 000000000..93dcb2762
--- /dev/null
+++ b/mod/tasks/pages/tasks/world.php
@@ -0,0 +1,41 @@
+<?php
+/**
+ * List all tasks
+ *
+ * @package ElggTasks
+ */
+
+$title = elgg_echo('tasks:all');
+
+elgg_pop_breadcrumb();
+elgg_push_breadcrumb(elgg_echo('tasks'));
+
+$lists = elgg_get_entities_from_metadata(array(
+ 'type' => 'object',
+ 'subtype' => 'task',
+ 'count' => true,
+ 'metadata_name' => 'list_guid',
+ 'metadata_value' => 0,
+));
+
+elgg_register_title_button('tasks', 'add');
+
+$content = elgg_list_entities_from_metadata(array(
+ 'type' => 'object',
+ 'subtype' => 'task',
+ 'full_view' => false,
+ 'metadata_name' => 'list_guid',
+ 'metadata_value' => 0,
+));
+if (!$content) {
+ $content = '<p>' . elgg_echo('tasks:none') . '</p>';
+}
+
+$body = elgg_view_layout('content', array(
+ 'filter_context' => 'all',
+ 'content' => $content,
+ 'title' => $title,
+ 'sidebar' => elgg_view('tasks/sidebar'),
+));
+
+echo elgg_view_page($title, $body);
diff --git a/mod/tasks/start.php b/mod/tasks/start.php
new file mode 100644
index 000000000..822aa787f
--- /dev/null
+++ b/mod/tasks/start.php
@@ -0,0 +1,433 @@
+<?php
+/**
+ * Elgg Tasks Management
+ *
+ * @package ElggTasks
+ */
+
+elgg_register_event_handler('init', 'system', 'tasks_init');
+
+/**
+ * Initialize the tasks management plugin.
+ *
+ */
+function tasks_init() {
+
+ // register a library of helper functions
+ elgg_register_library('elgg:tasks', elgg_get_plugins_path() . 'tasks/lib/tasks.php');
+
+ $item = new ElggMenuItem('tasks', elgg_echo('tasks'), 'tasks/all');
+ elgg_register_menu_item('site', $item);
+
+ // Register a page handler, so we can have nice URLs
+ elgg_register_page_handler('tasks', 'tasks_page_handler');
+
+ // Register a url handler
+ elgg_register_entity_url_handler('object', 'task', 'tasks_url');
+
+ // Register some actions
+ $action_base = elgg_get_plugins_path() . 'tasks/actions/tasks';
+ elgg_register_action("tasks/edit", "$action_base/edit.php");
+ elgg_register_action("tasks/delete", "$action_base/delete.php");
+ elgg_register_action("tasks/comments/add", "$action_base/comments/add.php");
+ // Extend the main css and js views
+ elgg_extend_view('css/elgg', 'tasks/css');
+ elgg_extend_view('js/elgg', 'tasks/js');
+
+ // register the blog's JavaScript
+ elgg_register_simplecache_view('js/tasks/tasklists');
+ elgg_register_js('elgg.tasks', elgg_get_simplecache_url('js', 'tasks/tasklists'));
+
+ elgg_register_ajax_view('object/task');
+ elgg_register_ajax_view('tasks/tasklist_graph');
+
+ // Register entity type for search
+ elgg_register_entity_type('object', 'task');
+
+ // Register a different form for annotations
+ elgg_register_plugin_hook_handler('comments', 'object', 'tasks_comments_hook');
+
+ // Register granular notification for this type
+ register_notification_object('object', 'task', elgg_echo('tasks:new'));
+ elgg_register_plugin_hook_handler('notify:entity:message', 'object', 'tasks_notify_message');
+
+ // add to groups
+ add_group_tool_option('tasks', elgg_echo('groups:enabletasks'), true);
+ elgg_extend_view('groups/tool_latest', 'tasks/group_module');
+
+ //add a widget
+ elgg_register_widget_type('tasks', elgg_echo('tasks:active'), elgg_echo('tasks:widget:description'));
+
+ // Language short codes must be of the form "tasks:key"
+ // where key is the array key below
+ elgg_set_config('tasks', array(
+ 'title' => 'text',
+ 'description' => 'longtext',
+ 'list_guid' => 'tasks/list',
+ 'enddate' => 'date',
+ 'priority' => 'tasks/priority',
+ 'tags' => 'tags',
+ 'access_id' => 'access',
+ ));
+
+ elgg_register_plugin_hook_handler('register', 'menu:owner_block', 'tasks_owner_block_menu');
+
+ elgg_register_event_handler('pagesetup', 'system', 'tasks_pagesetup');
+
+ // write permission plugin hooks
+ elgg_register_plugin_hook_handler('permissions_check', 'object', 'tasks_write_permission_check');
+ elgg_register_plugin_hook_handler('container_permissions_check', 'object', 'tasks_container_permission_check');
+
+ // icon url override
+ elgg_register_plugin_hook_handler('entity:icon:url', 'object', 'tasks_icon_url_override');
+
+ // entity menu
+ elgg_register_plugin_hook_handler('register', 'menu:entity', 'tasks_entity_menu_setup');
+
+ // register ecml views to parse
+ elgg_register_plugin_hook_handler('get_views', 'ecml', 'tasks_ecml_views_hook');
+
+ elgg_register_plugin_hook_handler('format', 'friendly:time', 'tasks_get_friendly_time');
+ elgg_register_event_handler('upgrade', 'system', 'tasks_run_upgrades');
+}
+
+function tasks_run_upgrades($event, $type, $details) {
+ if (include_once(elgg_get_plugins_path() . 'upgrade-tools/lib/upgrade_tools.php')) {
+ upgrade_module_run('tasks');
+ }
+}
+
+
+/**
+ * Dispatcher for tasks.
+ * URLs take the form of
+ * All tasks: tasks/all
+ * User's tasks: tasks/owner/<username>
+ * Friends' tasks: tasks/friends/<username>
+ * View task: tasks/view/<guid>/<title>
+ * New task: tasks/add/<guid> (container: user, group; list: tasklist)
+ * Edit task: tasks/edit/<guid>
+ * Group tasks: tasks/group/<guid>/all
+ *
+ * Title is ignored
+ *
+ * @param array $page
+ */
+function tasks_page_handler($page) {
+
+ elgg_load_library('elgg:tasks');
+
+ if (!isset($page[0])) {
+ $page[0] = 'all';
+ }
+
+ elgg_push_breadcrumb(elgg_echo('tasks'), 'tasks/all');
+
+ $base_dir = elgg_get_plugins_path() . 'tasks/pages/tasks';
+
+ $page_type = $page[0];
+ switch ($page_type) {
+ case 'owner':
+ include "$base_dir/owner.php";
+ break;
+ case 'friends':
+ include "$base_dir/friends.php";
+ break;
+ case 'view':
+ set_input('guid', $page[1]);
+ include "$base_dir/view.php";
+ break;
+ case 'add':
+ set_input('guid', $page[1]);
+ include "$base_dir/new_task.php";
+ break;
+ case 'edit':
+ set_input('guid', $page[1]);
+ include "$base_dir/edit_task.php";
+ break;
+ case 'group':
+ include "$base_dir/owner.php";
+ break;
+ case 'all':
+ default:
+ include "$base_dir/world.php";
+ break;
+ }
+
+ return;
+}
+
+/**
+ * Override the task url
+ *
+ * @param ElggObject $entity task object
+ * @return string
+ */
+function tasks_url($entity) {
+ $title = elgg_get_friendly_title($entity->title);
+ return "tasks/view/$entity->guid/$title";
+}
+
+/**
+ * Extend permissions checking to extend can-edit for write users.
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ */
+function tasks_write_permission_check($hook, $entity_type, $returnvalue, $params)
+{
+ $entity = $params['entity'];
+ if ($entity->getSubtype() == 'task') {
+
+ $user = $params['user'];
+ $container = $entity->getContainerEntity();
+ if (elgg_instanceof($container, 'group')) {
+ return $container->canWriteToContainer($user->guid, 'object', $entity->getSubtype());
+ }
+ }
+}
+
+/**
+ * Extend container permissions checking to extend can_write_to_container for write users.
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $returnvalue
+ * @param unknown_type $params
+ */
+/*
+function tasks_container_permission_check($hook, $entity_type, $returnvalue, $params) {
+
+ if (elgg_get_context() == "tasks") {
+ if (elgg_get_page_owner_guid()) {
+ if (can_write_to_container(elgg_get_logged_in_user_guid(), elgg_get_page_owner_guid())) return true;
+ }
+ if ($page_guid = get_input('task_guid',0)) {
+ $entity = get_entity($task_guid);
+ } else if ($parent_guid = get_input('list_guid',0)) {
+ $entity = get_entity($list_guid);
+ }
+ if ($entity instanceof ElggObject) {
+ if (
+ can_write_to_container(elgg_get_logged_in_user_guid(), $entity->container_guid)
+ || in_array($entity->write_access_id,get_access_list())
+ ) {
+ return true;
+ }
+ }
+ }
+
+}
+*/
+
+/**
+ * Override the default entity icon for tasks
+ *
+ * @return string Relative URL
+ */
+function tasks_icon_url_override($hook, $type, $returnvalue, $params) {
+ $entity = $params['entity'];
+ $size = $params['size'];
+ if (elgg_instanceof($entity, 'object', 'task')) {
+ $status = $entity->status;
+ if($status == 'unassigned' || $status == 'reopened') {
+ $status = 'new';
+ }
+ if (in_array($size, array('tiny', 'small', 'medium', 'large')) &&
+ in_array($status, array('active', 'assigned', 'closed', 'done', 'new'))){
+ return "mod/tasks/graphics/task-icons/$status-$size.png";
+ }
+ }
+}
+
+/**
+ * Add a menu item to the user ownerblock
+ */
+function tasks_owner_block_menu($hook, $type, $return, $params) {
+ if (elgg_instanceof($params['entity'], 'user')) {
+ $url = "tasks/owner/{$params['entity']->username}";
+ $item = new ElggMenuItem('tasks', elgg_echo('tasks'), $url);
+ $return[] = $item;
+ } else {
+ if ($params['entity']->tasks_enable != "no") {
+ $url = "tasks/group/{$params['entity']->guid}/all";
+ $item = new ElggMenuItem('tasks', elgg_echo('tasks:group'), $url);
+ $return[] = $item;
+ }
+ }
+
+ return $return;
+}
+
+/**
+ * Tasks extra menu item
+ *
+ */
+function tasks_pagesetup() {
+ if (elgg_is_logged_in()) {
+
+ $container = elgg_get_page_owner_entity();
+ if (!$container || !elgg_instanceof($container, 'group') || $container->tasks_enable != 'yes') {
+ return;
+ }
+
+ $address = urlencode(current_page_url());
+
+ elgg_register_menu_item('extras', array(
+ 'name' => 'task',
+ 'text' => elgg_view_icon('checkmark'),
+ 'href' => "tasks/add/$container->guid?referer=$address",
+ 'title' => elgg_echo('tasks:this'),
+ 'rel' => 'nofollow',
+ ));
+ }
+}
+
+/**
+ * Add links/info to entity menu particular to tasks plugin
+ */
+function tasks_entity_menu_setup($hook, $type, $return, $params) {
+ if (elgg_in_context('widgets')) {
+ return $return;
+ }
+
+ $entity = $params['entity'];
+ $handler = elgg_extract('handler', $params, false);
+ if ($handler != 'tasks') {
+ return $return;
+ }
+
+ // remove delete if not owner or admin
+ if (!elgg_is_admin_logged_in() && elgg_get_logged_in_user_guid() != $entity->getOwnerGuid()) {
+ foreach ($return as $index => $item) {
+ if ($item->getName() == 'delete') {
+ unset($return[$index]);
+ break;
+ }
+ }
+ }
+
+ if ($entity->status == 'active') {
+ $options = array(
+ 'name' => 'active',
+ 'text' => elgg_echo('tasks:active'),
+ 'href' => false,
+ 'priority' => 150,
+ );
+ $return[] = ElggMenuItem::factory($options);
+ }
+
+ $priorities = array(
+ '1' => 'low',
+ '2' => 'normal',
+ '3' => 'high',
+ );
+
+ $priority = $priorities[$entity->priority];
+
+ $options = array(
+ 'name' => 'priority',
+ 'text' => elgg_echo("tasks:priority:$priority"),
+ 'href' => false,
+ 'priority' => 150,
+ );
+
+ $return[] = ElggMenuItem::factory($options);
+
+ return $return;
+}
+
+function tasks_comments_hook($hook, $entity_type, $returnvalue, $params) {
+ if($params['entity']->getSubtype() == 'task') {
+ return elgg_view('tasks/page/elements/comments', $params);
+ }
+ return $returnvalue;
+}
+
+/**
+* Returns a more meaningful message
+*
+* @param unknown_type $hook
+* @param unknown_type $entity_type
+* @param unknown_type $returnvalue
+* @param unknown_type $params
+*/
+function tasks_notify_message($hook, $entity_type, $returnvalue, $params) {
+ $entity = $params['entity'];
+ if (elgg_instanceof($entity, 'object', 'task')) {
+ $descr = $entity->description;
+ $title = $entity->title;
+ $owner = $entity->getOwnerEntity();
+ return $owner->name . ' ' . elgg_echo("tasks:via") . ': ' . $title . "\n\n" . $descr . "\n\n" . $entity->getURL();
+ }
+ return null;
+}
+
+
+
+
+/**
+ * Return views to parse for tasks.
+ *
+ * @param unknown_type $hook
+ * @param unknown_type $entity_type
+ * @param unknown_type $return_value
+ * @param unknown_type $params
+ */
+function tasks_ecml_views_hook($hook, $entity_type, $return_value, $params) {
+ $return_value['object/task'] = elgg_echo('item:object:task');
+
+ return $return_value;
+}
+
+function tasks_get_friendly_time($hook, $type, $return_value, $params) {
+ $time = (int) $params['time'];
+ if ($time > time()) {
+ $diff = $time - time();
+
+ $minute = 60;
+ $hour = $minute * 60;
+ $day = $hour * 24;
+
+ if ($diff < $minute) {
+ return elgg_echo("friendlytime:justnow");
+ } else if ($diff < $hour) {
+ $diff = round($diff / $minute);
+ if ($diff == 0) {
+ $diff = 1;
+ }
+
+ if ($diff > 1) {
+ return elgg_echo("friendlytime:future:minutes", array($diff));
+ } else {
+ return elgg_echo("friendlytime:future:minutes:singular", array($diff));
+ }
+ } else if ($diff < $day) {
+ $diff = round($diff / $hour);
+ if ($diff == 0) {
+ $diff = 1;
+ }
+
+ if ($diff > 1) {
+ return elgg_echo("friendlytime:future:hours", array($diff));
+ } else {
+ return elgg_echo("friendlytime:future:hours:singular", array($diff));
+ }
+ } else {
+ $diff = round($diff / $day);
+ if ($diff == 0) {
+ $diff = 1;
+ }
+
+ if ($diff > 1) {
+ return elgg_echo("friendlytime:future:days", array($diff));
+ } else {
+ return elgg_echo("friendlytime:future:days:singular", array($diff));
+ }
+ }
+ $return_value = $time;
+ }
+ return $return_value;
+}
diff --git a/mod/tasks/upgrades/2012100501.php b/mod/tasks/upgrades/2012100501.php
new file mode 100644
index 000000000..6640b90d4
--- /dev/null
+++ b/mod/tasks/upgrades/2012100501.php
@@ -0,0 +1,79 @@
+<?php
+/**
+ * Move text of first annotation to group forum topic object and delete annotation
+ *
+ * First determine if the upgrade is needed and then if needed, batch the update
+ */
+
+$tasks = elgg_get_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'tasks',
+ 'limit' => 1,
+));
+
+// if not topics, no upgrade required
+if (empty($tasks)) {
+ return;
+}
+
+function tasks_2012100501($task) {
+ require_once(elgg_get_plugins_path() . 'upgrade-tools/lib/upgrade_tools.php');
+ if ($task->long_description) {
+ $task->description = $task->long_description;
+ $task->deleteMetadata('long_description');
+ $task->save();
+ }
+ if ($task->parent_guid) {
+ $task->list_guid = $task->parent_guid;
+ $task->deleteMetadata('parent_guid');
+ }
+ else {
+ $task->list_guid = 0;
+ }
+ /* Active was set as default, so it is not indicative of which tasks are
+ really active */
+ $task->deleteMetadata('active');
+
+ if ($task->done) {
+ $task->status = 'done';
+ $task->deleteMetadata('done');
+ } else {
+ $task->status = 'new';
+ }
+ // reset priority since old system was a mess
+ $task->priority = 2;
+ upgrade_change_subtype($task, 'task');
+
+ // update river
+ $options = array('object_guid' => $task->guid);
+ $items = elgg_get_river($options);
+ foreach($items as $item) {
+ if ($item->action_type == 'create') {
+ upgrade_update_river($item->id, 'river/object/task/create', $task->guid, 0);
+ }
+ elseif(in_array($item->action_type, array('done', 'undone', 'subscribe', 'unsubscribe'))) {
+ elgg_delete_river(array('id' => $item->id));
+ }
+ }
+
+ return true;
+}
+
+
+/*
+ * Run upgrade. First topics, then replies.
+ */
+$previous_access = elgg_set_ignore_access(true);
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'tasks',
+ 'limit' => 0,
+);
+$batch = new ElggBatch('elgg_get_entities', $options, "tasks_2012100501", 100, false);
+elgg_set_ignore_access($previous_access);
+
+if ($batch->callbackResult) {
+ error_log("Elgg Tasks upgrade (2012100501) succeeded");
+} else {
+ error_log("Elgg Tasks upgrade (2012100501) failed");
+}
diff --git a/mod/tasks/views/default/annotation/task_state_changed.php b/mod/tasks/views/default/annotation/task_state_changed.php
new file mode 100644
index 000000000..dded53101
--- /dev/null
+++ b/mod/tasks/views/default/annotation/task_state_changed.php
@@ -0,0 +1,40 @@
+<?php
+/**
+ * Elgg state changed annotation view
+ *
+ * @note To add or remove from the annotation menu, register handlers for the menu:annotation hook.
+ *
+ * @uses $vars['annotation']
+ */
+
+$annotation = $vars['annotation'];
+
+$owner = get_entity($annotation->owner_guid);
+if (!$owner) {
+ return true;
+}
+$icon = elgg_view_entity_icon($owner, 'tiny');
+$owner_link = "<a href=\"{$owner->getURL()}\">$owner->name</a>";
+
+$menu = elgg_view_menu('annotation', array(
+ 'annotation' => $annotation,
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz float-alt',
+));
+
+$state_action = elgg_echo("tasks:history:$annotation->value");
+
+$friendlytime = elgg_view_friendly_time($annotation->time_created);
+
+$body = <<<HTML
+<div class="mbn">
+ $menu
+ $owner_link
+ <span class="elgg-subtext">
+ $state_action
+ $friendlytime
+ </span>
+</div>
+HTML;
+
+echo elgg_view_image_block($icon, $body);
diff --git a/mod/tasks/views/default/forms/tasks/comments/add.php b/mod/tasks/views/default/forms/tasks/comments/add.php
new file mode 100644
index 000000000..ddbca14f5
--- /dev/null
+++ b/mod/tasks/views/default/forms/tasks/comments/add.php
@@ -0,0 +1,45 @@
+<?php
+/**
+ * Tasks comments add form
+ *
+ * @package ElggTasks
+ *
+ * @uses ElggEntity $vars['entity'] The entity to comment on
+ * @uses bool $vars['inline'] Show a single line version of the form?
+ */
+
+elgg_load_library('elgg:tasks');
+
+if (isset($vars['entity']) && elgg_is_logged_in()) {
+
+ $inline = elgg_extract('inline', $vars, false);
+
+ if ($inline) {
+ echo elgg_view('input/text', array('name' => 'generic_comment'));
+ echo elgg_view('input/submit', array('value' => elgg_echo('comment')));
+ } else {
+?>
+ <div>
+ <label><?php echo elgg_echo("generic_comments:add"); ?></label>
+ <?php echo elgg_view('input/longtext', array('name' => 'generic_comment')); ?>
+ <br /><label><?php echo elgg_echo('tasks:state:actions'); ?></label>
+ <?php
+ echo elgg_view('input/radio', array(
+ 'name' => 'state_action',
+ 'options' => tasks_prepare_radio_options($vars['entity']),
+ ));
+ ?>
+ </div>
+ <div class="elgg-foot">
+<?php
+ echo elgg_view('input/submit', array('value' => elgg_echo("tasks:comments:post")));
+?>
+ </div>
+<?php
+ }
+
+ echo elgg_view('input/hidden', array(
+ 'name' => 'entity_guid',
+ 'value' => $vars['entity']->getGUID()
+ ));
+}
diff --git a/mod/tasks/views/default/forms/tasks/edit.php b/mod/tasks/views/default/forms/tasks/edit.php
new file mode 100644
index 000000000..27061987d
--- /dev/null
+++ b/mod/tasks/views/default/forms/tasks/edit.php
@@ -0,0 +1,63 @@
+<?php
+/**
+ * Task edit form body
+ *
+ * @package ElggTasks
+ */
+
+$variables = elgg_get_config('tasks');
+foreach ($variables as $name => $type) {
+?>
+<div>
+<?php
+ // dont show label for task lists since for now it's hidden
+ if ($type != 'tasks/list') {
+?>
+ <label><?php echo elgg_echo("tasks:$name") ?></label>
+ <?php
+ if ($type != 'longtext') {
+ echo '<br />';
+ }
+ }
+ ?>
+ <?php echo elgg_view("input/$type", array(
+ 'name' => $name,
+ 'value' => $vars[$name],
+ ));
+ ?>
+</div>
+<?php
+}
+
+$cats = elgg_view('categories', $vars);
+if (!empty($cats)) {
+ echo $cats;
+}
+
+
+echo '<div class="elgg-foot">';
+if ($vars['guid']) {
+ echo elgg_view('input/hidden', array(
+ 'name' => 'task_guid',
+ 'value' => $vars['guid'],
+ ));
+}
+echo elgg_view('input/hidden', array(
+ 'name' => 'container_guid',
+ 'value' => $vars['container_guid'],
+));
+echo elgg_view('input/hidden', array(
+ 'name' => 'list_guid',
+ 'value' => $vars['list_guid'],
+));
+// Referers value isn't saved in the task
+if ($vars['referer_guid']) {
+ echo elgg_view('input/hidden', array(
+ 'name' => 'referer_guid',
+ 'value' => $vars['referer_guid'],
+ ));
+}
+
+echo elgg_view('input/submit', array('value' => elgg_echo('save')));
+
+echo '</div>';
diff --git a/mod/tasks/views/default/forms/tasks/inline.php b/mod/tasks/views/default/forms/tasks/inline.php
new file mode 100644
index 000000000..68075ce09
--- /dev/null
+++ b/mod/tasks/views/default/forms/tasks/inline.php
@@ -0,0 +1,35 @@
+<?php
+/*
+ *
+ */
+echo '<h3>'.elgg_echo('tasks:add').'</h3>';
+echo elgg_view('input/text', array(
+ 'name' => 'title',
+ 'class' => 'elgg-autofocus',
+));
+echo elgg_view('input/access', array(
+ 'name' => 'access_id',
+ 'value' => $vars['list']->access_id,
+));
+echo elgg_view('input/hidden', array(
+ 'name' => 'tags',
+ 'value' => '',
+));
+echo '<div class="elgg-foot mtm">';
+echo elgg_view('input/hidden', array(
+ 'name' => 'list_guid',
+ 'value' => $vars['list']->guid,
+));
+echo elgg_view('input/hidden', array(
+ 'name' => 'container_guid',
+ 'value' => $vars['list']->container_guid,
+));
+echo elgg_view('input/submit', array(
+ 'value' => elgg_echo('save'),
+));
+echo elgg_view('output/url', array(
+ 'text' => elgg_echo('tasks:add:gofull'),
+ 'href' => "tasks/add/{$vars['list']->guid}",
+ 'class' => 'elgg-button elgg-button-special'
+));
+echo '</div>'; \ No newline at end of file
diff --git a/mod/tasks/views/default/icon/object/task.php b/mod/tasks/views/default/icon/object/task.php
new file mode 100644
index 000000000..d1d519bc4
--- /dev/null
+++ b/mod/tasks/views/default/icon/object/task.php
@@ -0,0 +1,80 @@
+<?php
+/**
+ * Elgg task icon
+ *
+ * @uses $vars['entity'] The task entity.
+ * @uses $vars['size'] The size - tiny, small, medium or large. (medium)
+ * @uses $vars['use_hover'] Display the hover menu? (true)
+ * @uses $vars['use_link'] Wrap a link around image? (true)
+ * @uses $vars['img_class'] Optional CSS class added to img
+ * @uses $vars['link_class'] Optional CSS class for the link
+ * @uses $vars['href'] Optional override of the link href
+ */
+
+$task = elgg_extract('entity', $vars);
+$size = elgg_extract('size', $vars, 'medium');
+if (!in_array($size, array('topbar', 'tiny', 'small', 'medium', 'large', 'master'))) {
+ $size = 'medium';
+}
+
+$use_link = elgg_extract('use_link', $vars, true);
+
+if (!elgg_instanceof($task, 'object', 'task')) {
+ return true;
+}
+
+$title = htmlspecialchars($task->title, ENT_QUOTES, 'UTF-8', false);
+$guid = $task->guid;
+
+$img_class = '';
+if (isset($vars['img_class'])) {
+ $img_class = $vars['img_class'];
+}
+
+$use_hover = elgg_extract('use_hover', $vars, $task->canEdit());
+if (isset($vars['hover']) ) {
+ $use_hover = $vars['hover'];
+}
+
+$icon_url = elgg_format_url($task->getIconURL($size));
+$icon = elgg_view('output/img', array(
+ 'src' => $icon_url,
+ 'alt' => $name,
+ 'title' => $name,
+ 'class' => $img_class,
+));
+
+?>
+<div class="elgg-avatar elgg-task-icon">
+<?php
+
+if ($use_hover) {
+
+ tasks_register_actions_menu($task);
+
+ $params = array(
+ 'entity' => $task,
+ 'guid' => $guid,
+ 'title' => $title,
+ 'class' => 'elgg-menu-hover',
+ );
+ echo elgg_view_icon('hover-menu');
+ echo elgg_view_menu('tasks_hover', $params);
+
+ tasks_reset_actions_menu();
+}
+
+if ($use_link) {
+ $class = elgg_extract('link_class', $vars, '');
+ $url = elgg_extract('href', $vars, $task->getURL());
+ echo elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => $icon,
+ 'is_trusted' => true,
+ 'class' => $class,
+ ));
+} else {
+ echo "<a>$icon</a>";
+}
+?>
+</div>
diff --git a/mod/tasks/views/default/input/tasks/list.php b/mod/tasks/views/default/input/tasks/list.php
new file mode 100644
index 000000000..864f227ab
--- /dev/null
+++ b/mod/tasks/views/default/input/tasks/list.php
@@ -0,0 +1,27 @@
+<?php
+
+$container_guid = get_input('container_guid', elgg_get_page_owner_guid());
+
+$entities = elgg_get_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'tasklist_top',
+ 'container_guid' => $container_guid,
+ 'limit' => 0,
+));
+
+if ($entities) {
+ $options_values = array();
+ foreach ($entities as $entity) {
+ $options_values[$entity->guid] = $entity->title;
+ }
+} else {
+ $container_name = get_entity($container_guid)->name;
+ $options_values = array(0 => elgg_echo('tasks:owner', array($container_name)));
+}
+
+/*echo elgg_view('input/dropdown', array(
+ 'name' => $vars['name'],
+ 'options_values' => $options_values,
+ 'value' => $vars['value'],
+));*/
+echo elgg_view('input/hidden', array('name' => $vars['name'], 'value' => $vars['value']));
diff --git a/mod/tasks/views/default/input/tasks/priority.php b/mod/tasks/views/default/input/tasks/priority.php
new file mode 100644
index 000000000..43973beaa
--- /dev/null
+++ b/mod/tasks/views/default/input/tasks/priority.php
@@ -0,0 +1,13 @@
+<?php
+
+$vars['options_values'] = array(
+ '1' => 'low',
+ '2' => 'normal',
+ '3' => 'high',
+);
+
+if(!isset($vars['value']) || !$vars['value']){
+ $vars['value'] = '2';
+}
+
+echo elgg_view('input/dropdown', $vars);
diff --git a/mod/tasks/views/default/js/tasks/tasklists.php b/mod/tasks/views/default/js/tasks/tasklists.php
new file mode 100644
index 000000000..3c20b2db2
--- /dev/null
+++ b/mod/tasks/views/default/js/tasks/tasklists.php
@@ -0,0 +1,114 @@
+<?php
+/*
+ *
+ */
+?>
+
+elgg.provide('elgg.tasks');
+
+elgg.tasks.newTask = function(event) {
+ var values = {};
+ $.each($(this).serializeArray(), function(i, field) {
+ values[field.name] = field.value;
+ });
+ elgg.action($(this).attr('action'), {
+ data: values,
+ success: function(json) {
+ var unassignedlist = $('#tasks-status-unassigned');
+ if (!unassignedlist.length) {
+ window.location.reload();
+ return;
+ }
+ elgg.tasks.insert(json.output.guid, unassignedlist);
+ elgg.tasks.updateTaskGraph();
+ }
+ });
+ this.reset();
+ $(this).slideUp();
+ event.preventDefault();
+}
+
+elgg.tasks.updateTaskGraph = function() {
+ var tasklist_graph = $('.elgg-main > .elgg-item .tasklist-graph').parent();
+ var guid = parseInt(window.location.href.substr(elgg.config.wwwroot.length + 'tasks/view/'.length));
+ elgg.get({
+ url: elgg.config.wwwroot + "ajax/view/tasks/tasklist_graph",
+ dataType: "html",
+ cache: false,
+ data: {
+ guid: guid,
+ },
+ success: function(htmlData) {
+ if (htmlData.length > 0) {
+ tasklist_graph.html(htmlData);
+ }
+ }
+ });
+}
+
+elgg.tasks.insert = function(guid, list) {
+ elgg.get({
+ url: elgg.config.wwwroot + "ajax/view/object/task",
+ dataType: "html",
+ cache: false,
+ data: {
+ guid: guid,
+ },
+ success: function(htmlData) {
+ if (htmlData.length > 0) {
+ htmlData = '<li class="elgg-item" id="elgg-object-'
+ + guid + '">' + htmlData + '</li>';
+
+ if (list.find('.elgg-list-entity').length > 0) {
+ list.find('.elgg-list-entity').prepend(htmlData)
+ } else {
+ $('<ul class="elgg-list elgg-list-entity">').append(htmlData).appendTo(list.show());
+ }
+ }
+ }
+ });
+}
+
+elgg.tasks.changeStatus = function(event) {
+ var action = $('a', this).attr('href');
+ var guid = (new RegExp('[\\?&]entity_guid=([^&#]*)').exec(action))[1];
+ elgg.action(action, {
+ success: function(json) {
+ switch (json.output.new_state) {
+ case 'assigned':
+ case 'active':
+ var list = 'assigned';
+ break;
+ case 'new':
+ case 'unassigned':
+ case 'reopened':
+ var list = 'unassigned';
+ break;
+ case 'done':
+ case 'closed':
+ var list = 'closed';
+ break;
+ }
+ var newlist = $('#tasks-status-' + list);
+ $('#elgg-object-' + guid).remove();
+ elgg.tasks.insert(guid, newlist);
+ elgg.tasks.updateTaskGraph();
+ }
+ });
+ event.preventDefault();
+};
+
+elgg.tasks.init = function() {
+ $('.elgg-menu-title .elgg-menu-item-subtask a').click(function(event) {
+ $('#tasks-inline-form')
+ .slideToggle()
+ .find('[name="title"]').focus();
+ event.preventDefault();
+ });
+
+ $('#tasks-inline-form').submit(elgg.tasks.newTask);
+
+ $('body').delegate('.elgg-menu-tasks-hover li', 'click', elgg.tasks.changeStatus);
+};
+
+elgg.register_hook_handler('init', 'system', elgg.tasks.init);
diff --git a/mod/tasks/views/default/object/task.php b/mod/tasks/views/default/object/task.php
new file mode 100644
index 000000000..d8ed01233
--- /dev/null
+++ b/mod/tasks/views/default/object/task.php
@@ -0,0 +1,133 @@
+<?php
+/**
+ * View for task object
+ *
+ * @package ElggTasks
+ *
+ * @uses $vars['entity'] The task object
+ * @uses $vars['full_view'] Whether to display the full view
+ */
+
+elgg_load_library('elgg:tasks');
+
+$full = elgg_extract('full_view', $vars, FALSE);
+$task = elgg_extract('entity', $vars, FALSE);
+
+if (!$task) {
+ return TRUE;
+}
+
+$options = array('metadata_name' => 'list_guid', 'metadata_value' => $task->guid, 'type' => 'object', 'subtype' => 'task');
+$has_children = elgg_get_entities_from_metadata($options);
+if ($has_children) {
+ echo elgg_view('object/tasklist_top', $vars);
+ return;
+}
+
+
+$icon = elgg_view_entity_icon($task, 'tiny');
+
+$status = $task->status;
+
+if(!in_array($status, array('new', 'assigned', 'unassigned', 'active', 'done', 'closed', 'reopened'))){
+ $status = 'new';
+}
+
+$annotation = $task->getAnnotations('task_state_changed', 2, 0, 'desc');
+$more_than_one = count($annotation) > 1;
+
+if ($annotation) {
+ $annotation = $annotation[0];
+} else {
+ $annotation = new stdClass();
+ $annotation->owner_guid = $task->owner_guid;
+ $annotation->time_created = $task->time_created;
+}
+
+if (in_array($status, array('assigned', 'active', 'done')) && $more_than_one) {
+ $owner_link = elgg_view('tasks/participant_count', array('entity' => $task));
+} else {
+ $owner = get_entity($annotation->owner_guid);
+ $owner_link = elgg_view('output/url', array(
+ 'href' => $owner->getURL(),
+ 'text' => $owner->name,
+ ));
+}
+$date = elgg_view_friendly_time($annotation->time_created);
+$strapline = elgg_echo("tasks:strapline:$status", array($date, $owner_link));
+$tags = elgg_view('output/tags', array('tags' => $task->tags));
+
+$comments_count = $task->countComments();
+//only display if there are commments
+if ($comments_count != 0) {
+ $text = elgg_echo("comments") . " ($comments_count)";
+ $comments_link = elgg_view('output/url', array(
+ 'href' => $task->getURL() . '#task-comments',
+ 'text' => $text,
+ ));
+} else {
+ $comments_link = '';
+}
+
+
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $task,
+ 'handler' => 'tasks',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
+
+$subtitle = "$strapline $categories $comments_link";
+
+// do not show the metadata and controls in widget view
+if (elgg_in_context('widgets')) {
+ $metadata = '';
+}
+
+if ($full) {
+ $body = elgg_view('output/longtext', array('value' => $task->description));
+ $new_task_form = elgg_view_form('tasks/inline', array(
+ 'id' => 'tasks-inline-form',
+ 'class' => 'hidden',
+ 'action' => 'action/tasks/edit',
+ ), array(
+ 'list' => $task,
+ ));
+
+ $body .= elgg_view('tasks/info/extend', $vars);
+
+ $body .= $new_task_form;
+
+ $params = array(
+ 'entity' => $page,
+ 'title' => false,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ );
+ $params = $params + $vars;
+ $list_body = elgg_view('object/elements/summary', $params);
+
+ $info = elgg_view_image_block($icon, $list_body);
+
+ echo <<<HTML
+$info
+$body
+HTML;
+
+} else {
+ // brief view
+
+ $excerpt = elgg_get_excerpt($task->description);
+
+ $params = array(
+ 'entity' => $task,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => false,
+ );
+ $params = $params + $vars;
+ $list_body = elgg_view('object/elements/summary', $params);
+
+ echo elgg_view_image_block($icon, $list_body);
+}
diff --git a/mod/tasks/views/default/object/tasklist_top.php b/mod/tasks/views/default/object/tasklist_top.php
new file mode 100644
index 000000000..9ce5ca1c6
--- /dev/null
+++ b/mod/tasks/views/default/object/tasklist_top.php
@@ -0,0 +1,166 @@
+<?php
+/**
+ * View for task object
+ *
+ * @package ElggTasks
+ *
+ * @uses $vars['entity'] The task list object
+ * @uses $vars['full_view'] Whether to display the full view
+ */
+
+
+$full = elgg_extract('full_view', $vars, FALSE);
+$tasklist = elgg_extract('entity', $vars, FALSE);
+
+if (!$tasklist) {
+ return TRUE;
+}
+
+$icon = elgg_view_entity_icon($tasklist, 'tiny');
+
+$owner = get_entity($tasklist->owner_guid);
+$owner_link = elgg_view('output/url', array(
+ 'href' => $owner->getURL(),
+ 'text' => $owner->name,
+));
+
+$date = elgg_view_friendly_time($tasklist->time_created);
+$strapline = elgg_echo("tasks:lists:strapline", array($date, $owner_link));
+
+if (isset($tasklist->enddate) && $tasklist->enddate) {
+ $deadline = elgg_view_friendly_time(strtotime($tasklist->enddate));
+ $strapline .= elgg_echo("tasks:lists:deadline", array($deadline));
+}
+
+$tags = elgg_view('output/tags', array('tags' => $tasklist->tags));
+
+$comments_count = $tasklist->countComments();
+//only display if there are commments
+if ($comments_count != 0) {
+ $text = elgg_echo("comments") . " ($comments_count)";
+ $comments_link = elgg_view('output/url', array(
+ 'href' => $tasklist->getURL() . '#tasklist-comments',
+ 'text' => $text,
+ ));
+} else {
+ $comments_link = '';
+}
+
+$metadata = elgg_view_menu('entity', array(
+ 'entity' => $vars['entity'],
+ 'handler' => 'tasks',
+ 'sort_by' => 'priority',
+ 'class' => 'elgg-menu-hz',
+));
+
+$subtitle = "$strapline $categories $comments_link";
+
+// do not show the metadata and controls in widget view
+if (elgg_in_context('widgets')) {
+ $metadata = '';
+}
+
+if ($full) {
+ $body = elgg_view('output/longtext', array('value' => $tasklist->description));
+
+ $content = elgg_view('tasks/tasklist_graph', array(
+ 'entity' => $tasklist,
+ ));
+
+ $params = array(
+ 'entity' => $tasklist,
+ 'title' => false,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => $tags,
+ 'content' => $content,
+ );
+ $params = $params + $vars;
+ $list_body = elgg_view('object/elements/summary', $params);
+
+ $info = elgg_view_image_block($icon, $list_body);
+
+ $new_task_form = elgg_view_form('tasks/inline', array(
+ 'id' => 'tasks-inline-form',
+ 'class' => 'hidden',
+ 'action' => 'action/tasks/edit',
+ ), array(
+ 'list' => $tasklist,
+ ));
+
+ $assigned_tasks = elgg_list_entities(array(
+ 'list_guid' => $tasklist->guid,
+ 'status' => array('assigned', 'active'),
+ 'full_view' => false,
+ 'offset' => (int) get_input('assigned_offset'),
+ 'offset_key' => 'assigned_offset',
+ ), 'tasks_get_entities');
+
+ $info_vars = array(
+ 'id' => 'tasks-status-assigned',
+ 'class' => !$assigned_tasks ? 'hidden' : false,
+ );
+ $assigned_tasks = elgg_view_module('info', elgg_echo('tasks:assigned'), $assigned_tasks, $info_vars);
+
+ $unassigned_tasks = elgg_list_entities(array(
+ 'list_guid' => $tasklist->guid,
+ 'status' => array('new', 'unassigned', 'reopened'),
+ 'full_view' => false,
+ 'offset' => (int) get_input('unassigned_offset'),
+ 'offset_key' => 'unassigned_offset',
+ ), 'tasks_get_entities');
+
+ $info_vars = array(
+ 'id' => 'tasks-status-unassigned',
+ 'class' => !$unassigned_tasks ? 'hidden' : false,
+ );
+ $unassigned_tasks = elgg_view_module('info', elgg_echo('tasks:unassigned'), $unassigned_tasks, $info_vars);
+
+ $closed_tasks = elgg_list_entities(array(
+ 'list_guid' => $tasklist->guid,
+ 'status' => array('done', 'closed'),
+ 'full_view' => false,
+ 'offset' => (int) get_input('closed_offset'),
+ 'offset_key' => 'closed_offset',
+ ), 'tasks_get_entities');
+
+ $info_vars = array(
+ 'id' => 'tasks-status-closed',
+ 'class' => !$closed_tasks ? 'hidden' : false,
+ );
+ $closed_tasks = elgg_view_module('info', elgg_echo('tasks:closed'), $closed_tasks, $info_vars);
+
+
+
+ echo <<<HTML
+<div class="elgg-item">
+$info
+</div>
+$body
+$new_task_form
+<div class="mtl">
+$assigned_tasks
+$unassigned_tasks
+$closed_tasks
+</div>
+HTML;
+
+} else {
+ // brief view
+
+ $content = elgg_view('tasks/tasklist_graph', array(
+ 'entity' => $tasklist,
+ ));
+
+ $params = array(
+ 'entity' => $tasklist,
+ 'metadata' => $metadata,
+ 'subtitle' => $subtitle,
+ 'tags' => false,
+ 'content' => $content,
+ );
+ $params = $params + $vars;
+ $list_body = elgg_view('object/elements/summary', $params);
+
+ echo elgg_view_image_block($icon, $list_body);
+}
diff --git a/mod/tasks/views/default/river/object/task/create.php b/mod/tasks/views/default/river/object/task/create.php
new file mode 100644
index 000000000..4c31def33
--- /dev/null
+++ b/mod/tasks/views/default/river/object/task/create.php
@@ -0,0 +1,13 @@
+<?php
+/**
+ * Page river view.
+ */
+
+$object = $vars['item']->getObjectEntity();
+$excerpt = strip_tags($object->description);
+$excerpt = elgg_get_excerpt($excerpt);
+
+echo elgg_view('river/elements/layout', array(
+ 'item' => $vars['item'],
+ 'message' => $excerpt,
+)); \ No newline at end of file
diff --git a/mod/tasks/views/default/tasks/css.php b/mod/tasks/views/default/tasks/css.php
new file mode 100644
index 000000000..fc1b670a7
--- /dev/null
+++ b/mod/tasks/views/default/tasks/css.php
@@ -0,0 +1,26 @@
+.tasklist-graph {
+ height: 10px;
+ line-height: 10px;
+ border: 2px solid #CCCCCC;
+}
+
+.tasklist-graph div {
+ background: #4690D6;
+}
+
+.elgg-input-radios label {
+ font-weight: normal;
+}
+
+.elgg-menu-extras .elgg-icon-checkmark {
+ background-position: 0 -126px;
+}
+
+#tasks-inline-form {
+ padding: 10px
+}
+
+.elgg-tasks-participants {
+ position: absolute;
+ width: 345px;
+} \ No newline at end of file
diff --git a/mod/tasks/views/default/tasks/group_module.php b/mod/tasks/views/default/tasks/group_module.php
new file mode 100644
index 000000000..8f2c424b8
--- /dev/null
+++ b/mod/tasks/views/default/tasks/group_module.php
@@ -0,0 +1,50 @@
+<?php
+/**
+ * Group tasks module
+ */
+
+elgg_load_library('elgg:tasks');
+
+$group = elgg_get_page_owner_entity();
+
+if ($group->tasks_enable == "no") {
+ return true;
+}
+
+$all_link = elgg_view('output/url', array(
+ 'href' => "tasks/group/$group->guid/all",
+ 'text' => elgg_echo('link:view:all'),
+ 'is_trusted' => true,
+));
+
+elgg_push_context('widgets');
+$entities = tasks_get_entities(array(
+ 'type' => 'object',
+ 'subtype' => 'task',
+ 'container_guid' => elgg_get_page_owner_guid(),
+ 'limit' => 6,
+ 'list_guid' => 0,
+));
+
+$content = elgg_view_entity_list($entities, array(
+ 'full_view' => false,
+ 'pagination' => false,
+));
+elgg_pop_context();
+
+if (!$content) {
+ $content = '<p>' . elgg_echo('tasks:none') . '</p>';
+}
+
+$new_link = elgg_view('output/url', array(
+ 'href' => "tasks/add/$group->guid",
+ 'text' => elgg_echo('tasks:add'),
+ 'is_trusted' => true,
+));
+
+echo elgg_view('groups/profile/module', array(
+ 'title' => elgg_echo('tasks:group'),
+ 'content' => $content,
+ 'all_link' => $all_link,
+ 'add_link' => $new_link,
+));
diff --git a/mod/tasks/views/default/tasks/js.php b/mod/tasks/views/default/tasks/js.php
new file mode 100644
index 000000000..985e95e0a
--- /dev/null
+++ b/mod/tasks/views/default/tasks/js.php
@@ -0,0 +1,35 @@
+<?php
+/*
+ *
+ */
+?>
+
+elgg.provide('elgg.ui.getSelection');
+
+elgg.ui.getSelection = function () {
+ if (window.getSelection) {
+ return window.getSelection().toString();
+ }
+ else if (document.getSelection) {
+ return document.getSelection();
+ }
+ else if (document.selection) {
+ // this is specifically for IE
+ return document.selection.createRange().text;
+ }
+}
+
+$(function() {
+ $('.elgg-menu-extras .elgg-menu-item-task a').click(function() {
+ var title = encodeURIComponent(elgg.ui.getSelection());
+ if (!title) {
+ title = encodeURIComponent($('h2.elgg-heading-main').text());
+ }
+ referer_guid = $('.elgg-form-comments-add input[name="entity_guid"]').val();
+ var href = $(this).attr('href') + "&title=" + title;
+ if (referer_guid) {
+ href += "&referer_guid=" + referer_guid;
+ }
+ $(this).attr('href', href);
+ });
+}); \ No newline at end of file
diff --git a/mod/tasks/views/default/tasks/page/elements/comments.php b/mod/tasks/views/default/tasks/page/elements/comments.php
new file mode 100644
index 000000000..ef1737a63
--- /dev/null
+++ b/mod/tasks/views/default/tasks/page/elements/comments.php
@@ -0,0 +1,43 @@
+<?php
+/**
+ * List comments with optional add form
+ *
+ * @uses $vars['entity'] ElggEntity
+ * @uses $vars['show_add_form'] Display add form or not
+ * @uses $vars['id'] Optional id for the div
+ * @uses $vars['class'] Optional additional class for the div
+ */
+
+$show_add_form = elgg_extract('show_add_form', $vars, true);
+
+$id = '';
+if (isset($vars['id'])) {
+ $id = "id =\"{$vars['id']}\"";
+}
+
+$class = 'elgg-comments';
+if (isset($vars['class'])) {
+ $class = "$class {$vars['class']}";
+}
+
+// work around for deprecation code in elgg_view()
+unset($vars['internalid']);
+
+echo "<div $id class=\"$class\">";
+
+$options = array(
+ 'guid' => $vars['entity']->getGUID(),
+ 'annotation_names' => array('generic_comment', 'task_state_changed'),
+);
+$html = elgg_list_annotations($options);
+if ($html) {
+ echo '<h3>' . elgg_echo('tasks:changehistory') . '</h3>';
+ echo $html;
+}
+
+if ($show_add_form) {
+ $form_vars = array('name' => 'elgg_add_comment');
+ echo elgg_view_form('tasks/comments/add', $form_vars, $vars);
+}
+
+echo '</div>';
diff --git a/mod/tasks/views/default/tasks/participant_count.php b/mod/tasks/views/default/tasks/participant_count.php
new file mode 100644
index 000000000..781588693
--- /dev/null
+++ b/mod/tasks/views/default/tasks/participant_count.php
@@ -0,0 +1,42 @@
+<?php
+/**
+ * Count of who is participating in a task
+ *
+ * @uses $vars['entity']
+ */
+
+$guid = $vars['entity']->getGUID();
+
+$list = '';
+$num_of_participants = elgg_get_entities_from_relationship(array(
+ 'relationship' => 'subscribes',
+ 'relationship_guid' => $guid,
+ 'inverse_relationship' => true,
+ 'count' => true,
+));
+//var_dump($num_of_participants);
+if ($num_of_participants) {
+ // display the number of participants
+ if ($num_of_participants == 1) {
+ $participants_string = elgg_echo('tasks:participant', array($num_of_participants));
+ } else {
+ $participants_string = elgg_echo('tasks:participants', array($num_of_participants));
+ }
+ $params = array(
+ 'text' => $participants_string,
+ 'title' => elgg_echo('tasks:participants:see'),
+ 'rel' => 'popup',
+ 'href' => "#tasks-participants-$guid"
+ );
+ $list = elgg_view('output/url', $params);
+ $list .= "<div class='elgg-module elgg-module-popup elgg-tasks-participants hidden clearfix' id='tasks-participants-$guid'>";
+ $list .= elgg_list_entities_from_relationship(array(
+ 'relationship' => 'subscribes',
+ 'relationship_guid' => $guid,
+ 'inverse_relationship' => true,
+ 'limit' => 99,
+ 'list_class' => 'elgg-list-tasks-participants',
+ ));
+ $list .= "</div>";
+ echo $list;
+}
diff --git a/mod/tasks/views/default/tasks/sidebar.php b/mod/tasks/views/default/tasks/sidebar.php
new file mode 100644
index 000000000..141965b92
--- /dev/null
+++ b/mod/tasks/views/default/tasks/sidebar.php
@@ -0,0 +1,14 @@
+<?php
+/**
+ * File sidebar
+ */
+
+echo elgg_view('page/elements/comments_block', array(
+ 'subtypes' => 'task',
+ 'owner_guid' => elgg_get_page_owner_guid(),
+));
+
+echo elgg_view('page/elements/tagcloud_block', array(
+ 'subtypes' => 'task',
+ 'owner_guid' => elgg_get_page_owner_guid(),
+));
diff --git a/mod/tasks/views/default/tasks/sidebar/navigation.php b/mod/tasks/views/default/tasks/sidebar/navigation.php
new file mode 100644
index 000000000..389f4fb8a
--- /dev/null
+++ b/mod/tasks/views/default/tasks/sidebar/navigation.php
@@ -0,0 +1,60 @@
+<?php
+/**
+ * Navigation menu for a user's or a group's pages
+ *
+ * @uses $vars['page'] Page object if manually setting selected item
+ */
+
+// add the jquery treeview files for navigation
+elgg_load_js('jquery-treeview');
+elgg_load_css('jquery-treeview');
+
+
+$entity = elgg_extract('entity', $vars, false);
+if (elgg_instanceof($entity, 'object', 'task') && ($list = get_entity($entity->list_guid))) {
+ $url = $list->getURL();
+} elseif ($entity) {
+ $url = $entity->getURL();
+}
+
+$title = elgg_echo('tasks:navigation');
+
+tasks_register_navigation_tree(elgg_get_page_owner_entity());
+
+$content = elgg_view_menu('tasks_nav', array('class' => 'tasks-nav'));
+if (!$content) {
+ $content = '<p>' . elgg_echo('tasks:none') . '</p>';
+}
+
+echo elgg_view_module('aside', $title, $content);
+
+?><?php //@todo JS 1.8: no ?>
+<script type="text/javascript">
+$(document).ready(function() {
+ $(".tasks-nav").treeview({
+ persist: "location",
+ collapsed: true,
+ unique: true
+ });
+
+<?php
+if ($entity) {
+ // if on a history page, we need to manually select the correct menu item
+ // code taken from the jquery.treeview library
+?>
+ var current = $(".tasks-nav a[href='<?php echo $url; ?>']");
+ var items = current.addClass("selected").parents("ul, li").add( current.next() ).show();
+ var CLASSES = $.treeview.classes;
+ items.filter("li")
+ .swapClass( CLASSES.collapsable, CLASSES.expandable )
+ .swapClass( CLASSES.lastCollapsable, CLASSES.lastExpandable )
+ .find(">.hitarea")
+ .swapClass( CLASSES.collapsableHitarea, CLASSES.expandableHitarea )
+ .swapClass( CLASSES.lastCollapsableHitarea, CLASSES.lastExpandableHitarea );
+<?php
+}
+?>
+
+});
+
+</script>
diff --git a/mod/tasks/views/default/tasks/tasklist_graph.php b/mod/tasks/views/default/tasks/tasklist_graph.php
new file mode 100644
index 000000000..f46066a8a
--- /dev/null
+++ b/mod/tasks/views/default/tasks/tasklist_graph.php
@@ -0,0 +1,65 @@
+<?php
+
+elgg_load_library('elgg:tasks');
+
+$entity = $vars['entity'];
+
+$total = tasks_get_entities(array(
+ 'list_guid' => $vars['entity']->guid,
+ 'count' => true,
+));
+$closed = tasks_get_entities(array(
+ 'list_guid' => $vars['entity']->guid,
+ 'status' => 'closed',
+ 'count' => true,
+));
+$total_link = $entity->getURL()."#all";
+// Closed tasks aren't contabilized in graph.
+$total -= $closed;
+
+$done = tasks_get_entities(array(
+ 'list_guid' => $vars['entity']->guid,
+ 'status' => 'done',
+ 'count' => true,
+));
+
+$remaining = $total - $done;
+$remaining_link = $entity->getURL()."#remaining";
+
+$assigned = tasks_get_entities(array(
+ 'list_guid' => $vars['entity']->guid,
+ 'status' => array('assigned', 'active'),
+ 'count' => true,
+));
+$assigned_link = $entity->getURL()."#assigned";
+
+$active = tasks_get_entities(array(
+ 'list_guid' => $vars['entity']->guid,
+ 'status' => 'active',
+ 'count' => true,
+));
+$active_link = $entity->getURL()."#active";
+
+if ($total == 0) {
+ $percent = 0;
+} else {
+ $percent = $done / $total * 100;
+}
+
+?>
+
+<div>
+<div class="tasklist-graph">
+ <div style="width:<?php echo $percent.'%'; ?>">&nbsp;</div>
+</div>
+
+<?php
+
+echo '<a href="'.$total_link.'">' . elgg_echo('tasks:lists:graph:total', array($total)) . '</a>, ';
+echo '<a href="'.$remaining_link.'">' . elgg_echo('tasks:lists:graph:remaining', array($remaining)) . '</a>, ';
+echo '<a href="'.$assigned_link.'">' . elgg_echo('tasks:lists:graph:assigned', array($assigned)) . '</a>, ';
+echo '<a href="'.$active_link.'">' . elgg_echo('tasks:lists:graph:active', array($active)) . '</a>';
+
+?>
+
+</div>
diff --git a/mod/tasks/views/default/widgets/tasks/content.php b/mod/tasks/views/default/widgets/tasks/content.php
new file mode 100644
index 000000000..bdc694653
--- /dev/null
+++ b/mod/tasks/views/default/widgets/tasks/content.php
@@ -0,0 +1,38 @@
+<?php
+/**
+ * Elgg tasks widget
+ *
+ * @package ElggTasks
+ */
+
+elgg_load_library("elgg:tasks");
+
+$num = (int) $vars['entity']->tasks_num;
+
+// We show active first
+$options = array(
+ 'type' => 'object',
+ 'subtype' => 'task',
+ 'relationship_guid' => $vars['entity']->owner_guid,
+ 'relationship' => 'subscribes',
+ 'metadata_name' => 'status',
+ 'metadata_value' => array('assigned', 'active'),
+ 'limit' => $num,
+ 'full_view' => FALSE,
+ 'pagination' => FALSE,
+);
+$content = elgg_get_entities_from_relationship($options);
+
+echo elgg_view_entity_list($content, $options);
+
+if ($content) {
+ $url = "tasks/owner/" . elgg_get_page_owner_entity()->username;
+ $more_link = elgg_view('output/url', array(
+ 'href' => $url,
+ 'text' => elgg_echo('tasks:more'),
+ 'is_trusted' => true,
+ ));
+ echo "<span class=\"elgg-widget-more\">$more_link</span>";
+} else {
+ echo elgg_echo('tasks:none');
+}
diff --git a/mod/tasks/views/default/widgets/tasks/edit.php b/mod/tasks/views/default/widgets/tasks/edit.php
new file mode 100644
index 000000000..8d0cdbdd9
--- /dev/null
+++ b/mod/tasks/views/default/widgets/tasks/edit.php
@@ -0,0 +1,24 @@
+<?php
+/**
+ * Elgg tasks widget edit
+ *
+ * @package ElggTasks
+ */
+
+// set default value
+if (!isset($vars['entity']->tasks_num)) {
+ $vars['entity']->tasks_num = 4;
+}
+
+$params = array(
+ 'name' => 'params[tasks_num]',
+ 'value' => $vars['entity']->tasks_num,
+ 'options' => array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10),
+);
+$dropdown = elgg_view('input/dropdown', $params);
+
+?>
+<div>
+ <?php echo elgg_echo('tasks:num'); ?>:
+ <?php echo $dropdown; ?>
+</div>