1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-03 16:10:26 +00:00

[cookie]changed 'topinfo' to 'note_id'

This commit is contained in:
llj
2012-08-21 11:27:09 +08:00
parent 81c88a323e
commit 468cc92f9b
2 changed files with 8 additions and 8 deletions

View File

@@ -31,7 +31,7 @@ class InfobarMiddleware(object):
return ret return ret
def process_request(self, request): def process_request(self, request):
topinfo_close = request.COOKIES.get('topinfo', '') topinfo_close = request.COOKIES.get('note_id', '')
cur_note = cache.get('CUR_TOPINFO') if cache.get('CUR_TOPINFO') else \ cur_note = cache.get('CUR_TOPINFO') if cache.get('CUR_TOPINFO') else \
self.get_from_db() self.get_from_db()

View File

@@ -136,17 +136,17 @@ $('#info-bar .close').click(function() {
$('#info-bar').addClass('hide'); $('#info-bar').addClass('hide');
if (navigator.cookieEnabled) { if (navigator.cookieEnabled) {
var cookies = document.cookie.split('; '), var cookies = document.cookie.split('; '),
topinfo_exist = false, note_id_exist = false,
topinfo_new_value = $(this).attr('data') + ',' + '; max-age=' + 14*24*60*60 + '; path=' + '{{ SITE_ROOT }}'; new_note_id = $(this).attr('data') + ',' + '; max-age=' + 14*24*60*60 + '; path=' + '{{ SITE_ROOT }}';
for (var i = 0, len = cookies.length; i < len; i++) { for (var i = 0, len = cookies.length; i < len; i++) {
if (cookies[i].split('=')[0] == 'topinfo') { if (cookies[i].split('=')[0] == 'note_id') {
topinfo_exist = true; note_id_exist = true;
document.cookie = 'topinfo=' + cookies[i].split('=')[1] + topinfo_new_value; document.cookie = 'note_id=' + cookies[i].split('=')[1] + new_note_id;
break; break;
} }
} }
if (!topinfo_exist) { if (!note_id_exist) {
document.cookie = 'topinfo=' + topinfo_new_value; document.cookie = 'note_id=' + new_note_id;
} }
} }
}); });