diff --git a/src/ajax.php b/src/ajax.php index 88d8b73..f2f3266 100644 --- a/src/ajax.php +++ b/src/ajax.php @@ -33,9 +33,14 @@ elseif(isset($_GET['loadTasks'])) stop_gpc($_GET); $listId = (int)_get('list'); check_read_access($listId); - $sqlWhere = " AND {$db->prefix}todolist.list_id=". $listId; + + $sqlWhere = $inner = ''; + if($listId == -1) { + $userLists = getUserListsSimple(); + $sqlWhere .= " AND {$db->prefix}todolist.list_id IN (". implode(array_keys($userLists), ','). ") "; + } + else $sqlWhere .= " AND {$db->prefix}todolist.list_id=". $listId; if(_get('compl') == 0) $sqlWhere .= ' AND compl=0'; - $inner = ''; $tag = trim(_get('t')); if($tag != '') @@ -54,12 +59,12 @@ elseif(isset($_GET['loadTasks'])) } if(sizeof($tagIds) > 1) { - $inner = "INNER JOIN (SELECT task_id, COUNT(tag_id) AS c FROM {$db->prefix}tag2task WHERE list_id=$listId AND tag_id IN (". + $inner .= "INNER JOIN (SELECT task_id, COUNT(tag_id) AS c FROM {$db->prefix}tag2task WHERE list_id=$listId AND tag_id IN (". implode(',',$tagIds). ") GROUP BY task_id) ON id=task_id"; $sqlWhere = " AND c=". sizeof($tagIds); //overwrite sqlWhere! } elseif($tagIds) { - $inner = "INNER JOIN {$db->prefix}tag2task ON id=task_id"; + $inner .= "INNER JOIN {$db->prefix}tag2task ON id=task_id"; $sqlWhere .= " AND tag_id = ". $tagIds[0]; } @@ -82,6 +87,7 @@ elseif(isset($_GET['loadTasks'])) elseif($sort == 4) $sqlSort .= "d_edited ASC, prio DESC, ow ASC"; // byDateModified elseif($sort == 104) $sqlSort .= "d_edited DESC, prio ASC, ow DESC"; // byDateModified (reverse) else $sqlSort .= "ow ASC"; + $t = array(); $t['total'] = 0; $t['list'] = array(); @@ -542,6 +548,7 @@ function prepareTaskRow($r) return array( 'id' => $r['id'], 'title' => escapeTags($r['title']), + 'listId' => $r['list_id'], 'date' => htmlarray($dCreated), 'dateInt' => (int)$r['d_created'], 'dateInline' => htmlarray(formatTime($formatCreatedInline, $r['d_created'])), @@ -857,4 +864,15 @@ function prepareList($row) ); } +function getUserListsSimple() +{ + $db = DBConnection::instance(); + $a = array(); + $q = $db->dq("SELECT id,name FROM {$db->prefix}lists ORDER BY id ASC"); + while($r = $q->fetch_row()) { + $a[$r[0]] = $r[1]; + } + return $a; +} + ?> \ No newline at end of file diff --git a/src/lang/class.default.php b/src/lang/class.default.php index e2a7213..a4ba3ca 100644 --- a/src/lang/class.default.php +++ b/src/lang/class.default.php @@ -100,6 +100,7 @@ class DefaultLang 'feed_completed_tasks' => "Completed tasks", 'feed_modified_tasks' => "Modified tasks", 'feed_new_tasks' => "New tasks", + 'alltasks' => "All tasks", /* Settings */ 'set_header' => "Settings", diff --git a/src/lang/en.php b/src/lang/en.php index f7e6fa7..c713826 100644 --- a/src/lang/en.php +++ b/src/lang/en.php @@ -102,6 +102,7 @@ class Lang extends DefaultLang 'feed_completed_tasks' => "Completed tasks", 'feed_modified_tasks' => "Modified tasks", 'feed_new_tasks' => "New tasks", + 'alltasks' => "All tasks", /* Settings */ 'set_header' => "Settings", diff --git a/src/mytinytodo.js b/src/mytinytodo.js index ece0090..49aeab9 100644 --- a/src/mytinytodo.js +++ b/src/mytinytodo.js @@ -19,12 +19,16 @@ var tabLists = { _lists: {}, _length: 0, _order: [], - clear: function(){ this._lists = {}; this._length = 0; this._order = []; }, + _alltasks: {}, + clear: function(){ + this._lists = {}; this._length = 0; this._order = []; + this._alltasks = { id:-1, showCompl:0, sort:3 }; + }, length: function(){ return this._length; }, - exists: function(id){ if(this._lists[id]) return true; else return false; }, + exists: function(id){ if(this._lists[id] || id==-1) return true; else return false; }, add: function(list){ this._lists[list.id] = list; this._length++; this._order.push(list.id); }, replace: function(list){ this._lists[list.id] = list; }, - get: function(id){ return this._lists[id]; }, + get: function(id){ if(id==-1) return this._alltasks; else return this._lists[id]; }, getAll: function(){ var r = []; for(var i in this._order) { r.push(this._lists[this._order[i]]); }; return r; }, reorder: function(order){ this._order = order; } }; @@ -239,6 +243,11 @@ var mytinytodo = window.mytinytodo = _mtt = { } return false; }); + + $('#list_all').click(function(event){ + tabSelected(-1); + return false; + }); $('#lists li.mtt-tab .list-action').live('click', function(){ listMenu(this); @@ -1083,9 +1092,19 @@ function tabSelected(elementOrId) } if(!tabLists.exists(id)) return; $('#lists .mtt-tabs-selected').removeClass('mtt-tabs-selected'); - $('#list_'+id).addClass('mtt-tabs-selected'); + $('#list_all').removeClass('mtt-tabs-selected'); + + if(id == -1) { + $('#list_all').addClass('mtt-tabs-selected'); + } + else { + $('#list_'+id).addClass('mtt-tabs-selected'); + } + if(curList.id != id) { + if(id == -1) $('#page_tasks').addClass('show-all-tasks'); + else $('#page_tasks').removeClass('show-all-tasks'); if(filter.search != '') liveSearchToggle(0, 1); mytinytodo.doAction('listSelected', tabLists.get(id)); } diff --git a/src/themes/default/index.php b/src/themes/default/index.php index 4fc9f3f..9bf9413 100644 --- a/src/themes/default/index.php +++ b/src/themes/default/index.php @@ -85,7 +85,7 @@ $().ready(function(){
- +
diff --git a/src/themes/default/style.css b/src/themes/default/style.css index 90af488..4066876 100644 --- a/src/themes/default/style.css +++ b/src/themes/default/style.css @@ -56,16 +56,21 @@ a { color:#0000ff; cursor:pointer; text-decoration:underline; } .mtt-tabs.mtt-tabs-only-one li { display:none; } .mtt-tabs.mtt-tabs-only-one li.mtt-tabs-selected { display:block; } #page_tasks.readonly li.mtt-tabs-selected span { margin-right:0; } + +.mtt-tabs-alltasks { margin:1px 3px 0 3px; float:right; border-right:1px solid #ededed; background:#fbfbfb url(images/tab_hover.gif) no-repeat top left; } +.mtt-tabs-alltasks a { position:relative; margin:0; font-size:0.9em; font-weight:bold; text-decoration:none; text-align:center; white-space:nowrap; color:#444444; display:block; height:21px; padding:6px 2px 0px 6px; outline:none; vertical-align:top; } +.mtt-tabs-alltasks.mtt-tabs-selected { border-left:none; border-right:1px solid #ededed; background:#ededed url(images/corner_left.gif) no-repeat top left; } +#page_tasks.readonly .mtt-tabs-alltasks { display:none; } #tabs_buttons { float:right; padding-top:4px; - padding-bottom:3px; + padding-bottom:2px; padding-left:2px; padding-right:2px; border:1px solid #ededed; border-bottom:none; - -moz-border-radius-topleft:5px; -webkit-border-top-left-radius:5px; border-top-left-radius:5px; + margin-top:1px; -moz-border-radius-topright:5px; -webkit-border-top-right-radius:5px; border-top-right-radius:5px; } @@ -118,6 +123,7 @@ a { color:#0000ff; cursor:pointer; text-decoration:underline; } #newtask_adv span { background:url(images/buttons.png) 0 -48px no-repeat; } #newtask_adv:hover span { background-position:-16px -48px; } +#page_tasks.show-all-tasks #htab_newtask { display:none; } /* Live Search */