diff --git a/src/ajax.php b/src/ajax.php
index cf403bd..b15bb3c 100644
--- a/src/ajax.php
+++ b/src/ajax.php
@@ -23,12 +23,13 @@ if(isset($_GET['loadLists']))
{
check_token();
$t = array();
+ $t['total'] = 0;
if (!is_logged()) $sqlWhere = 'WHERE published=1';
else {
$sqlWhere = '';
$t['list'][] = prepareAllTasksList(); // show alltasks lists only for authorized user
+ $t['total'] = 1;
}
- $t['total'] = 1;
$q = $db->dq("SELECT * FROM {$db->prefix}lists $sqlWhere ORDER BY ow ASC, id ASC");
while($r = $q->fetchAssoc())
{
diff --git a/src/content/lang/en.json b/src/content/lang/en.json
index 64aff7e..ea8fa73 100644
--- a/src/content/lang/en.json
+++ b/src/content/lang/en.json
@@ -161,6 +161,8 @@
"actionNoteCancel": "cancel",
"error": "Some error occurred (click for details)",
"denied": "Access denied",
+ "listNotFound": "Not found",
+ "noPublicLists": "No public tasks",
"invalidpass": "Wrong password",
"addList": "Create new list",
"addListDefault": "Todo",
diff --git a/src/content/themes/default/index.php b/src/content/themes/default/index.php
index 32e6b09..4540901 100644
--- a/src/content/themes/default/index.php
+++ b/src/content/themes/default/index.php
@@ -116,6 +116,10 @@ $().ready(function(){
+
+
@@ -258,7 +262,7 @@ $().ready(function(){
diff --git a/src/content/themes/default/style.css b/src/content/themes/default/style.css
index 6154250..4ff9d7a 100644
--- a/src/content/themes/default/style.css
+++ b/src/content/themes/default/style.css
@@ -66,6 +66,7 @@ a { color:#0000ff; cursor:pointer; text-decoration:underline; }
#msg.mtt-info .msg-details { border:1px solid #EFC300;}
#lists { font-size:0.95rem; display:flex; align-items:flex-start; justify-content:flex-end; }
+#mtt_body.readonly.no-lists #lists > * { visibility: hidden; }
.tabs-n-button { flex-grow:1; display:flex; align-items:flex-start; }
.tab-height-wrapper { box-sizing:border-box; height:2.2rem; display:flex; align-items:center; }
.mtt-tabs { list-style:none; padding:0; margin:0; display:flex; justify-content:flex-start; flex-wrap:wrap; }
@@ -103,7 +104,9 @@ a { color:#0000ff; cursor:pointer; text-decoration:underline; }
.mtt-img-button:hover, .mtt-img-button.mtt-menu-button-active { background-color:#efefef; cursor:pointer; }
.mtt-img-button span { display:block; width:16px; height:16px; }
-#mtt_body.no-lists #toolbar > * { visibility:hidden; }
+#mtt_body.no-lists #toolbar > * { visibility:hidden; }
+#mtt_body.no-list-selected #toolbar > * { visibility:hidden; }
+#mtt_body.readonly.no-lists #toolbar { visibility: hidden; }
#toolbar { padding:8px; border-bottom:1px solid #DEDEDE; background:#ededed; }
#toolbar .mtt-img-button:hover { background-color:#ddd; }
@@ -145,7 +148,8 @@ a { color:#0000ff; cursor:pointer; text-decoration:underline; }
/* */
#page_tasks h3 { display:flex; align-items:baseline; }
-#mtt_body.no-lists #page_tasks h3 > * { visibility:hidden; }
+#mtt_body.no-lists #page_tasks h3 { visibility:hidden; }
+#mtt_body.no-list-selected #page_tasks h3 { visibility:hidden; }
.mtt-notes-showhide { font-size:1rem; font-weight:normal; margin-left:5px; margin-right:5px; }
.mtt-notes-showhide a { text-decoration:none; border-bottom:1px dotted; }
@@ -298,6 +302,22 @@ li.task-row.task-completed .task-note-block .task-note { text-decoration:line-th
.prio-zero { /*background-color:#dedede;*/ }
.task-prio.prio-zero { display:none; }
+#tasks_info {
+ display: flex;
+ justify-content: center;
+ align-content: center;
+ flex-direction: column;
+ min-height: 100px;
+ border: 1px solid #ccc;
+ border-radius: 5px;
+}
+#tasks_info .v {
+ font-size: 1.1rem;
+ font-weight: bold;
+ text-align: center;
+}
+
+
.form-row { margin-top:0.6rem; }
.form-row .h { font-weight:bold; color:#333333; }
.form-row div.h { margin-bottom:3px; }
@@ -446,6 +466,7 @@ li.mtt-item-hidden { display:none; }
#slmenucontainer li.mtt-list-hidden a { font-style:italic; }
#cmenulistscontainer li.mtt-list-hidden { font-style:italic; }
#mtt_body.readonly .mtt-need-list { display:none; }
+#mtt_body.readonly .mtt-need-authorized { display:none; }
#btnRssFeed .menu-icon { background:url(images/rss.svg) no-repeat; }
#btnRssFeed.mtt-item-disabled .menu-icon { background:url(images/rss-disabled.svg) no-repeat; }
diff --git a/src/includes/class.lang.php b/src/includes/class.lang.php
index 870a4c0..82d74ea 100644
--- a/src/includes/class.lang.php
+++ b/src/includes/class.lang.php
@@ -112,6 +112,8 @@ class Lang
'actionNoteCancel',
'error',
'denied',
+ 'listNotFound',
+ 'noPublicLists',
'invalidpass',
'addList',
'addListDefault',
diff --git a/src/includes/mytinytodo.js b/src/includes/mytinytodo.js
index b4c580e..001369a 100644
--- a/src/includes/mytinytodo.js
+++ b/src/includes/mytinytodo.js
@@ -675,6 +675,7 @@ var mytinytodo = window.mytinytodo = _mtt = {
}
$('#page_tasks').hide();
$('#tasklist').html('');
+ $('#tasks_info').hide();
tabLists.clear();
@@ -682,7 +683,7 @@ var mytinytodo = window.mytinytodo = _mtt = {
{
var ti = '';
var openListId = 0;
- if(res && res.total)
+ if(res && res.total && res.list)
{
// open required or first non-hidden list
for(var i=0; i 0) {
+ $('#mtt_body').removeClass('no-lists');
+ }
+ else {
+ $('#mtt_body').addClass('no-lists');
+ }
+
+ if (_mtt.options.openList != 0 && openListId == 0) {
+ // cant open list - not found
+ $('#tasks_info .v').text(_mtt.lang.get('listNotFound'))
+ $('#tasks_info').show();
+ }
+ else if (tabLists.length() == 0) {
+ if (flag.readOnly) $('#tasks_info .v').text(_mtt.lang.get('noPublicLists'));
+ else $('#tasks_info .v').text(_mtt.lang.get('listNotFound'))
+ $('#tasks_info').show();
+ }
+
_mtt.options.openList = 0;
+ $('#lists .mtt-tabs-selected').removeClass('mtt-tabs-selected');
+ $('#mtt_body').addClass('no-list-selected');
$('#lists ul').html(ti);
$('#lists').show();
_mtt.doAction('listsLoaded');
- tabSelect(openListId);
+ if (tabLists.length() > 0 && openListId != 0) {
+ tabSelect(openListId);
+ }
$('#page_tasks').show();
-
});
},
@@ -1378,11 +1387,18 @@ function tabSelect(elementOrId)
id = id.split('_', 2)[1];
if (id === 'all') id = -1;
}
+
if ( !tabLists.exists(id) ) {
- // TODO: handle unknown list
- flashError(_mtt.lang.get('denied'));
+ $('#tasks_info .v').text(_mtt.lang.get('listNotFound'))
+ $('#tasks_info').show();
+ $('.mtt-need-list').addClass('mtt-item-disabled');
return;
}
+ else {
+ $('#tasks_info').hide();
+ $('.mtt-need-list').removeClass('mtt-item-disabled');
+ $('#mtt_body').removeClass('no-list-selected');
+ }
var prevList = curList;
curList = tabLists.get(id);
@@ -1409,7 +1425,7 @@ function tabSelect(elementOrId)
var isFirstLoad = flag.firstLoad;
updateHistoryState( { list:id }, _mtt.urlForList(curList), newTitle );
- if(curList.hidden) {
+ if (curList.hidden && flag.readOnly != true) {
curList.hidden = false;
_mtt.db.request('setHideList', {list:curList.id, hide:0});
}