From 44746f7ce7b0cbf376c3d0fca66c5511f9786960 Mon Sep 17 00:00:00 2001 From: Max Pozdeev Date: Thu, 26 Nov 2009 14:46:00 +0300 Subject: [PATCH] * optimized calls of updateAccessStatus() --- src/ajax.js | 12 ++++++------ src/index.php | 3 +-- src/init.php | 9 --------- 3 files changed, 7 insertions(+), 17 deletions(-) diff --git a/src/ajax.js b/src/ajax.js index c804072..d6cbdb1 100644 --- a/src/ajax.js +++ b/src/ajax.js @@ -487,8 +487,7 @@ function doAuth(form) if(json.logged) { flag.isLogged = true; - updateAccessStatus(); - loadLists(); + loadLists(0,1); } else { flashError(lang.invalidpass); @@ -505,8 +504,7 @@ function logout() resetAjaxErrorTrigger(); }, 'json'); flag.isLogged = false; - updateAccessStatus(); - loadLists(); + loadLists(0,1); return false; } @@ -900,7 +898,7 @@ function toggleAllNotes(show) } } -function loadLists(onInit) +function loadLists(onInit, updAccess) { if(filter.search != '') { filter.search = ''; @@ -939,12 +937,14 @@ function loadLists(onInit) $('#page_tasks h3').children().addClass('invisible'); $('#mylistscontainer .mtt-need-list').addClass('mtt-disabled'); $('#rss_icon').hide(); - if(flag.needAuth && !flag.isLogged) $('#page_tasks').hide(); } ti += ''; $('#lists>ul').html(ti); $('#lists').show(); }); + $('#page_tasks').hide(); + $('#tasklist').html(''); + if(updAccess) updateAccessStatus(); } function addList() diff --git a/src/index.php b/src/index.php index 085141e..13b305f 100644 --- a/src/index.php +++ b/src/index.php @@ -63,9 +63,8 @@ $().ready(function(){ { echo "\tflag.needAuth = true;\n"; if(is_logged()) echo "\tflag.isLogged = true;\n"; - echo "\tupdateAccessStatus();\n"; } - echo "\tloadLists(1);\n"; + echo "\tloadLists(1, 1);\n"; ?> preloadImg(); $("#duedate").datepicker({dateFormat: '', firstDay: , diff --git a/src/init.php b/src/init.php index 88dac19..eb06687 100644 --- a/src/init.php +++ b/src/init.php @@ -40,15 +40,6 @@ if($needAuth && !isset($dontStartSession)) session_start(); } -/* -function canAllRead() -{ - global $config; - if(!isset($config['password']) || $config['password'] == '') return true; - if(isset($config['allowread']) && $config['allowread']) return true; - return false; -}*/ - function is_logged() { if(!isset($_SESSION['logged']) || !$_SESSION['logged']) return false;