3 commits - plugins/calendar plugins/tasklist

Thomas Brüderli bruederli at kolabsys.com
Wed Jul 11 17:28:36 CEST 2012


 plugins/calendar/skins/larry/calendar.css |    2 -
 plugins/tasklist/skins/larry/tasklist.css |   22 ++++++++---
 plugins/tasklist/tasklist.js              |   60 +++++++++++++++++++++---------
 plugins/tasklist/tasklist.php             |    2 -
 4 files changed, 62 insertions(+), 24 deletions(-)

New commits:
commit 1809ed09f1c5c756dd117e86e30ba3c9ccfc44bc
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Jul 11 17:28:25 2012 +0200

    Load either all complete or incomplete tasks from the server. Fo further filtering on the client

diff --git a/plugins/tasklist/tasklist.js b/plugins/tasklist/tasklist.js
index 7865e1a..2ef58b2 100644
--- a/plugins/tasklist/tasklist.js
+++ b/plugins/tasklist/tasklist.js
@@ -48,6 +48,7 @@ function rcube_tasklist(settings)
     /*  private vars  */
     var selector = 'all';
     var filtermask = FILTER_MASK_ALL;
+    var loadstate = { filter:-1, lists:'' };
     var idcount = 0;
     var saving_lock;
     var ui_loading;
@@ -274,46 +275,72 @@ function rcube_tasklist(settings)
     }
 
     /**
-     * fetch tasks from server
+     * List tasks matching the given selector
      */
     function list_tasks(sel)
     {
+        if (rcmail.busy)
+            return;
+
         if (sel && filter_masks[sel] !== undefined) {
             filtermask = filter_masks[sel];
             selector = sel;
         }
 
-        var active = active_lists();
-        if (active.length) {
+        var active = active_lists(),
+            basefilter = filtermask == FILTER_MASK_COMPLETE ? FILTER_MASK_COMPLETE : FILTER_MASK_ALL,
+            reload = active.join(',') != loadstate.lists || basefilter != loadstate.filter;
+
+        if (active.length && reload) {
             ui_loading = rcmail.set_busy(true, 'loading');
-            rcmail.http_request('fetch', { filter:filtermask, lists:active.join(','), q:search_query }, true);
+            rcmail.http_request('fetch', { filter:basefilter, lists:active.join(','), q:search_query }, true);
         }
-        else
+        else if (reload)
             data_ready([]);
+        else
+            render_tasklist();
 
         $('#taskselector li.selected').removeClass('selected');
         $('#taskselector li.'+selector).addClass('selected');
     }
 
     /**
-     * callback if task data from server is ready
+     * Callback if task data from server is ready
+     */
+    function data_ready(response)
+    {
+        listdata = {};
+        loadstate.lists = response.lists;
+        loadstate.filter = response.filter;
+        for (var i=0; i < response.data.length; i++) {
+            listdata[response.data[i].id] = response.data[i];
+        }
+
+        render_tasklist();
+        rcmail.set_busy(false, 'loading', ui_loading);
+    }
+
+    /**
+     *
      */
-    function data_ready(data)
+    function render_tasklist()
     {
         // clear display
-        var msgbox = $('#listmessagebox').hide(),
+        var rec,
+            count = 0,
+            msgbox = $('#listmessagebox').hide(),
             list = $(rcmail.gui_objects.resultlist).html('');
-        listdata = {};
 
-        for (var i=0; i < data.length; i++) {
-            listdata[data[i].id] = data[i];
-            render_task(data[i]);
+        for (var id in listdata) {
+            rec = listdata[id];
+            if (match_filter(rec)) {
+                render_task(rec);
+                count++;
+            }
         }
 
-        if (!data.length)
+        if (!count)
             msgbox.html(rcmail.gettext('notasksfound','tasklist')).show();
-
-        rcmail.set_busy(false, 'loading', ui_loading);
     }
 
     /**
@@ -714,8 +741,7 @@ function rcube_tasklist(settings)
      */
     function match_filter(rec)
     {
-        // TBD.
-        return true;
+        return !filtermask || (filtermask & rec.mask) > 0;
     }
 
     /**
diff --git a/plugins/tasklist/tasklist.php b/plugins/tasklist/tasklist.php
index 27a5644..fd43b44 100644
--- a/plugins/tasklist/tasklist.php
+++ b/plugins/tasklist/tasklist.php
@@ -387,7 +387,7 @@ class tasklist extends rcube_plugin
         // sort tasks according to their hierarchy level and due date
         usort($data, array($this, 'task_sort_cmp'));
 
-        $this->rc->output->command('plugin.data_ready', $data);
+        $this->rc->output->command('plugin.data_ready', array('filter' => $f, 'lists' => $lists, 'data' => $data));
     }
 
     /**


commit a9436f3b9e3c6c043a7c96be47635636653f6e1f
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Jul 11 17:27:05 2012 +0200

    Restrict css rule on calendar UI

diff --git a/plugins/calendar/skins/larry/calendar.css b/plugins/calendar/skins/larry/calendar.css
index ede1605..d0d108d 100644
--- a/plugins/calendar/skins/larry/calendar.css
+++ b/plugins/calendar/skins/larry/calendar.css
@@ -981,7 +981,7 @@ a.alarm-action-snooze:after {
 	height: 160px;
 }
 
-span.spacer {
+.calendarmain span.spacer {
 	padding-left: 3em;
 }
 


commit 2223267d4f956e943d5d2ac9013f436901e4cd73
Author: Thomas Bruederli <bruederli at kolabsys.com>
Date:   Wed Jul 11 17:26:21 2012 +0200

    Slightly less flashy count bubbles; restict css rules for global UI elemens on tasks module

diff --git a/plugins/tasklist/skins/larry/tasklist.css b/plugins/tasklist/skins/larry/tasklist.css
index 063632d..8c642fa 100644
--- a/plugins/tasklist/skins/larry/tasklist.css
+++ b/plugins/tasklist/skins/larry/tasklist.css
@@ -30,7 +30,7 @@
 	width: 240px;
 }
 
-body.tasklistview #searchmenulink {
+.tasklistview #searchmenulink {
 	width: 15px;
 }
 
@@ -116,7 +116,12 @@ body.tasklistview #searchmenulink {
 	right: 5px;
 	min-width: 1.8em;
 	padding: 2px 4px;
-	background: #ff3800;
+	background: #004558;
+	background: -moz-linear-gradient(top, #005d76 0%, #004558 100%);
+	background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#005d76), color-stop(100%,#004558));
+	background: -o-linear-gradient(top, #005d76 0%, #004558 100%);
+	background: -ms-linear-gradient(top, #005d76 0%, #004558 100%);
+	background: linear-gradient(top, #005d76 0%, #004558 100%);
 	box-shadow: 0 1px 2px 0 rgba(24,24,24,0.6);
 	color: #fff;
 	border-radius: 3px;
@@ -134,12 +139,19 @@ body.tasklistview #searchmenulink {
 	margin-left: -5px;
 	border-style: solid;
 	border-width: 5px 5px 0;
-	border-color: #ff3800 transparent;
+	border-color: #004558 transparent;
 	/* reduce the damage in FF3.0 */
 	display: block; 
 	width: 0;
 }
 
+#taskselector li.overdue .count {
+	background: #ff3800;
+}
+
+#taskselector li.overdue .count:after {
+	border-color: #ff3800 transparent;
+}
 
 /*
 #taskselector li .count {
@@ -214,7 +226,7 @@ body.tasklistview #searchmenulink {
 	white-space: nowrap;
 }
 
-#quicksearchbar {
+.tasklistview #quicksearchbar {
 	top: -7px;
 }
 
@@ -473,7 +485,7 @@ ul.toolbarmenu li span.delete {
 #rootdroppable {
 	display: none;
 	position: absolute;
-	top: 3px;
+	top: 36px;
 	left: 1em;
 	right: 1em;
 	height: 5px;





More information about the commits mailing list