mirror of
https://github.com/maxpozdeev/mytinytodo.git
synced 2026-03-11 08:55:27 +00:00
+ All tasks tab (tasks ordered by date)
This commit is contained in:
parent
6cc0dee633
commit
9eb9fb19ad
6 changed files with 56 additions and 11 deletions
26
src/ajax.php
26
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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -85,7 +85,7 @@ $().ready(function(){
|
|||
<div id="tabs_buttons">
|
||||
<div class="mtt-tabs-select-button mtt-tabs-button" title="<?php _e('list_select'); ?>"><span></span></div>
|
||||
</div>
|
||||
|
||||
<div id="list_all" class="mtt-tabs-alltasks"><a href="#alltasks"><span><?php _e('alltasks'); ?><span></a></div>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Reference in a new issue