aboutsummaryrefslogtreecommitdiff
path: root/mod/tasks/views
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/views
parent815bb3bf5a5e8da9a7962a4a532c3129f09d5735 (diff)
parent228d3697bcd0218605be2e28131574cc85293a2e (diff)
downloadelgg-00af8cc93d689f61be48390713a6a070b7ed761f.tar.gz
elgg-00af8cc93d689f61be48390713a6a070b7ed761f.tar.bz2
Merge commit '228d3697bcd0218605be2e28131574cc85293a2e' as 'mod/tasks'
Diffstat (limited to 'mod/tasks/views')
-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
21 files changed, 1126 insertions, 0 deletions
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>