summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorThomas Bruederli <bruederli@kolabsys.com>2013-10-23 15:12:42 (GMT)
committerJeroen van Meeuwen (Kolab Systems) <vanmeeuwen@kolabsys.com>2013-10-31 11:51:28 (GMT)
commitd0315100ea8bc7e42be9e62957d3b93289311098 (patch)
treea16c913b2f35e1ba9686ff305f9861cb90099fd7 /plugins
parent5c4530245713dab4d7ed38f273dacc31f4699365 (diff)
downloadroundcubemail-plugins-kolab-d0315100ea8bc7e42be9e62957d3b93289311098.tar.gz
Add UI elements to expand/collapse all tasks (#2291)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/tasklist/skins/larry/sprites.pngbin3016 -> 3741 bytes
-rw-r--r--plugins/tasklist/skins/larry/tasklist.css38
-rw-r--r--plugins/tasklist/skins/larry/templates/mainview.html11
-rw-r--r--plugins/tasklist/tasklist.js27
-rw-r--r--plugins/tasklist/tasklist.php16
5 files changed, 83 insertions, 9 deletions
diff --git a/plugins/tasklist/skins/larry/sprites.png b/plugins/tasklist/skins/larry/sprites.png
index 5224f6f..b20b2db 100644
--- a/plugins/tasklist/skins/larry/sprites.png
+++ b/plugins/tasklist/skins/larry/sprites.png
Binary files differ
diff --git a/plugins/tasklist/skins/larry/tasklist.css b/plugins/tasklist/skins/larry/tasklist.css
index caa5067..70ab8da 100644
--- a/plugins/tasklist/skins/larry/tasklist.css
+++ b/plugins/tasklist/skins/larry/tasklist.css
@@ -66,7 +66,7 @@ body.attachmentwin #topnav .topright {
}
#taskselector {
- margin: -4px 0 0;
+ margin: -4px 40px 0 0;
padding: 0;
}
@@ -336,6 +336,27 @@ body.attachmentwin #topnav .topright {
background: -ms-linear-gradient(top, #eee 0%, #dfdfdf 100%);
background: linear-gradient(top, #eee 0%, #dfdfdf 100%);
border-bottom: 1px solid #ccc;
+ position: relative;
+}
+
+#tasksview .buttonbar .buttonbar-right {
+ position: absolute;
+ top: 6px;
+ right: 8px;
+}
+
+.buttonbar-right .listmenu {
+ display: inline-block;
+ cursor: pointer;
+}
+
+.buttonbar-right .listmenu .inner {
+ display: inline-block;
+ height: 18px;
+ width: 20px;
+ padding: 0;
+ background: url(sprites.png) 0 -237px no-repeat;
+ text-indent: -5000px;
}
#thelist {
@@ -547,11 +568,24 @@ body.attachmentwin #topnav .topright {
border-top: 1px solid #219de6;
}
-ul.toolbarmenu li span.add {
+ul.toolbarmenu li span.add,
+ul.toolbarmenu li span.expand,
+ul.toolbarmenu li span.collapse {
background-image: url(sprites.png);
+}
+
+ul.toolbarmenu li span.add {
background-position: 0 -100px;
}
+ul.toolbarmenu li span.expand {
+ background-position: 0 -258px;
+}
+
+ul.toolbarmenu li span.collapse {
+ background-position: 0 -280px;
+}
+
ul.toolbarmenu li span.delete {
background-position: 0 -1508px;
}
diff --git a/plugins/tasklist/skins/larry/templates/mainview.html b/plugins/tasklist/skins/larry/templates/mainview.html
index 9196d02..b85f7fb 100644
--- a/plugins/tasklist/skins/larry/templates/mainview.html
+++ b/plugins/tasklist/skins/larry/templates/mainview.html
@@ -59,6 +59,10 @@
<li class="nodate"><a href="#nodate"><roundcube:label name="tasklist.nodate" ucfirst="true" /></a></li>
<li class="complete"><a href="#complete"><roundcube:label name="tasklist.complete" /><span class="count"></span></a></li>
</ul>
+
+ <div class="buttonbar-right">
+ <roundcube:button name="taskviewmenulink" id="taskviewmenulink" type="link" title="tasklist.viewoptions" class="listmenu viewoptions" onclick="UI.show_popup('taskviewmenu');return false" innerClass="inner" content="&#9881;" />
+ </div>
</div>
<div class="scroller">
@@ -92,6 +96,13 @@
</ul>
</div>
+<div id="taskviewmenu" class="popupmenu">
+ <ul class="toolbarmenu">
+ <li><roundcube:button command="expand-all" label="expand-all" class="icon" classAct="icon active" innerclass="icon expand" /></li>
+ <li><roundcube:button command="collapse-all" label="collapse-all" class="icon" classAct="icon active" innerclass="icon collapse" /></li>
+ </ul>
+</div>
+
<div id="taskshow">
<div class="form-section" id="task-parent-title"></div>
<div class="form-section">
diff --git a/plugins/tasklist/tasklist.js b/plugins/tasklist/tasklist.js
index 631494c..742f23a 100644
--- a/plugins/tasklist/tasklist.js
+++ b/plugins/tasklist/tasklist.js
@@ -92,6 +92,7 @@ function rcube_tasklist_ui(settings)
this.add_childtask = add_childtask;
this.quicksearch = quicksearch;
this.reset_search = reset_search;
+ this.expand_collapse = expand_collapse;
this.list_remove = list_remove;
this.list_edit_dialog = list_edit_dialog;
this.unlock_saving = unlock_saving;
@@ -520,6 +521,30 @@ function rcube_tasklist_ui(settings)
}
/**
+ * Expand/collapse all task items with childs
+ */
+ function expand_collapse(expand)
+ {
+ var collapsed = !expand;
+
+ $('.taskitem .childtasks')[(collapsed ? 'hide' : 'show')]();
+ $('.taskitem .childtoggle')
+ .removeClass(collapsed ? 'expanded' : 'collapsed')
+ .addClass(collapsed ? 'collapsed' : 'expanded')
+ .html(collapsed ? '&#9654;' : '&#9660;');
+
+ // store new toggle collapse states
+ var ids = [];
+ for (var id in listdata) {
+ if (listdata[id].children && listdata[id].children.length)
+ ids.push(id);
+ }
+ if (ids.length) {
+ rcmail.http_post('tasks/task', { action:'collapse', t:{ id:ids.join(',') }, collapsed:collapsed?1:0 });
+ }
+ }
+
+ /**
*
*/
function append_tags(taglist)
@@ -1781,6 +1806,8 @@ window.rcmail && rcmail.addEventListener('init', function(evt) {
rcmail.register_command('search', function(){ rctasks.quicksearch(); }, true);
rcmail.register_command('reset-search', function(){ rctasks.reset_search(); }, true);
+ rcmail.register_command('expand-all', function(){ rctasks.expand_collapse(true); }, true);
+ rcmail.register_command('collapse-all', function(){ rctasks.expand_collapse(false); }, true);
rctasks.init();
});
diff --git a/plugins/tasklist/tasklist.php b/plugins/tasklist/tasklist.php
index e6b5d1c..68d82c4 100644
--- a/plugins/tasklist/tasklist.php
+++ b/plugins/tasklist/tasklist.php
@@ -248,13 +248,15 @@ class tasklist extends rcube_plugin
break;
case 'collapse':
- if (intval(get_input_value('collapsed', RCUBE_INPUT_GPC))) {
- $this->collapsed_tasks[] = $rec['id'];
- }
- else {
- $i = array_search($rec['id'], $this->collapsed_tasks);
- if ($i !== false)
- unset($this->collapsed_tasks[$i]);
+ foreach (explode(',', $rec['id']) as $rec_id) {
+ if (intval(get_input_value('collapsed', RCUBE_INPUT_GPC))) {
+ $this->collapsed_tasks[] = $rec_id;
+ }
+ else {
+ $i = array_search($rec_id, $this->collapsed_tasks);
+ if ($i !== false)
+ unset($this->collapsed_tasks[$i]);
+ }
}
$this->rc->user->save_prefs(array('tasklist_collapsed_tasks' => join(',', array_unique($this->collapsed_tasks))));